From 609eb5d952a0d96791e82a32ff26edef492ec8df Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Fri, 27 Apr 2018 09:41:21 +0200 Subject: Declaring the encoding to be utf-8 is not necessary in Python3 projects, as this is the default encoding. Encoding declarations are only useful in py3 if you want to declare it to be something _other_ than utf-8. This was, however, a very useful convention in py2. (#56) --- pysite/rst/__init__.py | 1 - 1 file changed, 1 deletion(-) (limited to 'pysite/rst/__init__.py') diff --git a/pysite/rst/__init__.py b/pysite/rst/__init__.py index 74f19285..ae79f529 100644 --- a/pysite/rst/__init__.py +++ b/pysite/rst/__init__.py @@ -1,4 +1,3 @@ -# coding=utf-8 import re from docutils.core import publish_parts -- cgit v1.2.3 From 87d3c8b8c87144fb527c0811e36165c329388cea Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Mon, 30 Apr 2018 11:01:22 +0100 Subject: [Wiki] Header icons need a space afterwards --- pysite/rst/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'pysite/rst/__init__.py') 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(" ", "  ") + + 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(" ", "  ") + sub_headers.append({ "id": match.group(1), - "title": match.group(2) + "title": title }) current_header["sub_headers"] = sub_headers -- cgit v1.2.3