pull/1/head
Yax 5 years ago
parent eee81df2ca
commit 7fa100db51

@ -7,7 +7,6 @@
{{ comments }}
<!--
<div id="comment-form">
<strong>Votre commentaire</strong>
<form role="form" action="/newcomment" autocomplete="off" method="post">
@ -21,8 +20,10 @@
value="{{ stacosys_token }}">
<input class="hidden" id="url" name="url" type="text" placeholder="Article"
value="/{{ post_url }}">
<input class="hidden" id="captcha" name="captcha" type="text"
placeholder="Etes vous humain ?">
<label class="remarque">Remarque</label>
<input class="remarque" name="remarque"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"
placeholder="nom@domaine.com">
</fieldset>
<fieldset>
<textarea id="message" name="message" rows="4"
@ -47,7 +48,6 @@
class="button--info">Prévisualiser</button>
</form>
</div>
-->
</div>

@ -50,21 +50,23 @@ locale.setlocale(locale.LC_ALL, "")
# initialize markdown
class HighlightRenderer(mistune.Renderer):
options = {'escape': False, 'hard_wrap':True}
options = {"escape": False, "hard_wrap": True}
def block_code(self, code, lang):
if not lang:
return '\n<pre><code>%s</code></pre>\n' % \
mistune.escape(code)
return "\n<pre><code>%s</code></pre>\n" % mistune.escape(code)
lexer = get_lexer_by_name(lang, stripall=True)
formatter = html.HtmlFormatter()
return highlight(code, lexer, formatter)
renderer = HighlightRenderer()
markdown = mistune.Markdown(renderer=renderer)
def fread(filename):
"""Read file and close the file."""
with open(filename, "r") as f:
@ -148,13 +150,19 @@ def read_content(filename):
summary = markdown(clean_html_tag(text[:summary_index]))
else:
summary = truncate(markdown(clean_html_tag(text)))
clean_text = text.replace('<!-- more -->', '')
clean_text = text.replace("<!-- more -->", "")
text = markdown(clean_text)
else:
summary = truncate(text)
# Update the dictionary with content and RFC 2822 date.
content.update({"content": text, "rfc_2822_date": rfc_2822_format(content["date"]), "summary": summary})
content.update(
{
"content": text,
"rfc_2822_date": rfc_2822_format(content["date"]),
"summary": summary,
}
)
return content
@ -216,7 +224,7 @@ def make_posts(
page_params["post_url"] = page_params["year"] + "/" + page_params["slug"]
# categories
categories = get_header_list_value('category', page_params)
categories = get_header_list_value("category", page_params)
out_cats = []
for category in categories:
out_cat = render(category_layout, category=category, url=slugify(category))
@ -225,13 +233,12 @@ def make_posts(
page_params["category_label"] = "".join(out_cats)
# tags
tags = get_header_list_value('tag', page_params)
tags = get_header_list_value("tag", page_params)
page_params["tags"] = tags
# stacosys comments
page_params["comment_count"] = 0
page_params["comments"] = ''
page_params["comments"] = ""
if params["stacosys_url"]:
req_url = params["stacosys_url"] + "/comments"
query_params = dict(
@ -466,7 +473,6 @@ def main():
**params
)
# Create sitemap
make_list(
blog_posts,

@ -170,6 +170,10 @@ a:hover, a:active {
display: none;
}
#comment-form > form > fieldset > .remarque {
display: none;
}
.comment-separator {
height:1px;
background:#717171;

Loading…
Cancel
Save