diff options
author | 2018-04-30 11:01:22 +0100 | |
---|---|---|
committer | 2018-04-30 11:01:22 +0100 | |
commit | 87d3c8b8c87144fb527c0811e36165c329388cea (patch) | |
tree | cbc0a143b0727d9b20d28e3750d86c8f281e7bcf /pysite | |
parent | [Wiki] Small template fixes (diff) |
[Wiki] Header icons need a space afterwards
Diffstat (limited to 'pysite')
-rw-r--r-- | pysite/rst/__init__.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pysite/rst/__init__.py b/pysite/rst/__init__.py index ae79f529..97a77f40 100644 --- a/pysite/rst/__init__.py +++ b/pysite/rst/__init__.py @@ -67,12 +67,23 @@ def render(rst: str): if depth == 1: # Top-level header, so just store it in the current header current_header["id"] = match.group(1) - current_header["title"] = match.group(2) + + title = match.group(2) + + if title.startswith("<i"): # We've found an icon, which needs to have a space after it + title = title.replace("</i> ", "</i> ") + + current_header["title"] = title else: # Second-level (or deeper) header, should be stored in a list of sub-headers under the current sub_headers = current_header.get("sub_headers", []) + title = match.group(2) + + if title.startswith("<i"): # We've found an icon, which needs to have a space after it + title = title.replace("</i> ", "</i> ") + sub_headers.append({ "id": match.group(1), - "title": match.group(2) + "title": title }) current_header["sub_headers"] = sub_headers |