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

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

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

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

Loading…
Cancel
Save