URL fixes
This commit is contained in:
parent
9ecdc007d9
commit
66a52435d1
10 changed files with 16 additions and 44 deletions
|
|
@ -208,13 +208,11 @@ class MarkdownToMicronReader(MarkdownReader):
|
||||||
|
|
||||||
metadata = self._parse_metadata(meta)
|
metadata = self._parse_metadata(meta)
|
||||||
content = '\n'.join(lines)
|
content = '\n'.join(lines)
|
||||||
|
|
||||||
m2μr = MicronRenderer()
|
m2μr = MicronRenderer()
|
||||||
m2μ = Markdown(renderer=m2μr)
|
m2μ = Markdown(renderer=m2μr)
|
||||||
m2μ.inline.register('underlined', UNDERLINED, parse_underlined, before='emphasis')
|
m2μ.inline.register('underlined', UNDERLINED, parse_underlined, before='emphasis')
|
||||||
m2μ.renderer.register('underlined', render_underlined_mu)
|
m2μ.renderer.register('underlined', render_underlined_mu)
|
||||||
content = m2μ(content)
|
content = m2μ(content)
|
||||||
print(content)
|
|
||||||
return content, metadata
|
return content, metadata
|
||||||
|
|
||||||
# === M I C R O N W R I T E R ===
|
# === M I C R O N W R I T E R ===
|
||||||
|
|
@ -245,9 +243,8 @@ class MicronWriter(Writer):
|
||||||
# set localsiteurl for context so that Contents can adjust links
|
# set localsiteurl for context so that Contents can adjust links
|
||||||
if localcontext['localsiteurl']:
|
if localcontext['localsiteurl']:
|
||||||
context['localsiteurl'] = localcontext['localsiteurl']
|
context['localsiteurl'] = localcontext['localsiteurl']
|
||||||
output = template.render(localcontext)
|
output = template.render(localcontext).replace('.html', '.mu')
|
||||||
path = sanitised_join(output_path, name)
|
path = sanitised_join(output_path, name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.dirname(path))
|
os.makedirs(os.path.dirname(path))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,11 @@
|
||||||
{% extends "base.mu" %}
|
{% extends "base.mu" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
>{{ article.title }}
|
>{{ article.title }}
|
||||||
|
{% import 'translations.mu' as translations with context %}
|
||||||
{% import 'translations.mu' as translations with context %}
|
{{ translations.translations_for(article) }}
|
||||||
{{ translations.translations_for(article) }}
|
{{ article.locale_date }} {% if article.authors %}by {% for author in article.authors %}{{ author }}{% endfor %}{% endif %}
|
||||||
{{ article.locale_date }}
|
|
||||||
{% if article.authors %}
|
|
||||||
|
|
||||||
by {% for author in article.authors %}{{ author }}{% endfor %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{{ article.content }}
|
{{ article.content }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
>Authors on {{ SITENAME }}
|
>Authors on {{ SITENAME }}
|
||||||
|
|
||||||
{%- for author, articles in authors|sort %}
|
{%- for author, articles in authors|sort %}
|
||||||
+ `[{{ author }}`/{{ author.url }}] ({{ articles|count }})
|
+ `[{{ author }}`:/{{ author.url }}] ({{ articles|count }})
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,9 @@
|
||||||
`# lang: {{ DEFAULT_LANG }}
|
# lang: {{ DEFAULT_LANG }}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
>{% block title %}{{ SITENAME }}{% endblock title %}
|
> {% block title %}{{ SITENAME }}{% endblock title %}
|
||||||
{% endblock head %}
|
{% endblock head %}
|
||||||
|
|
||||||
{% for title, link in MENUITEMS %}
|
{% for title, link in MENUITEMS %}`[{{ title }}`{{ link }}]{% endfor %}{% if DISPLAY_PAGES_ON_MENU %}{% for p in PAGES %}`[{{ p.title }}`/{{ p.url }}]{% endfor %}{% else %}{% if DISPLAY_CATEGORIES_ON_MENU %}{% for cat, null in categories %}`[{% if cat == category %}`_{% endif %}{{ cat }}{% if cat == category %}`_{% endif %}`/{{ cat.url }}]{% endfor %}{% endif %}{% endif %}
|
||||||
`[{{ title }}`{{ link }}]
|
|
||||||
{% endfor %}
|
|
||||||
{% if DISPLAY_PAGES_ON_MENU %}
|
|
||||||
{% for p in PAGES %}
|
|
||||||
`[{{ p.title }}`/{{ p.url }}]
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% if DISPLAY_CATEGORIES_ON_MENU %}
|
|
||||||
{% for cat, null in categories %}
|
|
||||||
`[{% if cat == category %}`_{% endif %}{{ cat }}{% if cat == category %}`_{% endif %}`/{{ cat.url }}]
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.mu" %}
|
{% extends "base.mu" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% for category, articles in categories %}
|
{% for category, articles in categories %}
|
||||||
+ `[{{ category }}`/{{ category.url }}]
|
+ `[{{ category }}`:/{{ category.url }}]
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,8 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% block content_title %}
|
{% block content_title %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% for article in articles %}
|
{% for article in articles %}
|
||||||
|
+ [{{ article.locale_date }}] `!`_`[{{ article.title }}`:/{{ article.url }}]`_`!
|
||||||
+[{{ article.locale_date }}]
|
|
||||||
>>>>`[`!{{ article.title }}`!`/{{ article.url }}]
|
|
||||||
>>>>{{ article.summary }}
|
|
||||||
|
|
||||||
-
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{% if DEFAULT_PAGINATION %}
|
{% if DEFAULT_PAGINATION %}
|
||||||
-
|
-
|
||||||
{% if articles_page.has_previous() %}`[<<`/{{ articles_previous_page.url }}] {% endif %}Page {{ articles_page.number }} / {{ articles_paginator.num_pages }}{% if articles_page.has_next() %} `[>>`/{{ articles_next_page.url }}]{% endif %}
|
{% if articles_page.has_previous() %}`[<<`:/{{ articles_previous_page.url }}] {% endif %}Page {{ articles_page.number }} / {{ articles_paginator.num_pages }}{% if articles_page.has_next() %} `[>>`:/{{ articles_next_page.url }}]{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
{% for article in dates %}
|
{% for article in dates %}
|
||||||
+[{{ article.locale_date }}]
|
+[{{ article.locale_date }}]
|
||||||
>>>>`[`!{{ article.title }}`!`/{{ article.url }}]
|
>>>>`[`!{{ article.title }}`!`:/{{ article.url }}]
|
||||||
>>>>{{ article.summary }}
|
>>>>{{ article.summary }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.mu" %}
|
{% extends "base.mu" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% for tag, articles in tags %}
|
{% for tag, articles in tags %}
|
||||||
+ `[{{ tag }}`/{{ tag.url }}]
|
+ `[{{ tag }}`:/{{ tag.url }}]
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{% macro translations_for(article) %}
|
{% macro translations_for(article) %}
|
||||||
{% if article.translations %}
|
{% if article.translations %}
|
||||||
{% for translation in article.translations %}
|
{% for translation in article.translations %}
|
||||||
`[{{ translation.lang }}`/{{ translation.url }}]
|
`[{{ translation.lang }}`:/{{ translation.url }}]
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue