From 0ccf90ec56864e4a4272a1640d0223718974ea79 Mon Sep 17 00:00:00 2001 From: umbreon Date: Sat, 3 Jul 2021 21:52:32 +0100 Subject: [PATCH] Improvements --- src/chrome.html | 72 ++++++++++++++++++++++--------------------------- src/convert.py | 66 ++++++++++++++++++++------------------------- 2 files changed, 61 insertions(+), 77 deletions(-) diff --git a/src/chrome.html b/src/chrome.html index de7a932..7f05cfe 100644 --- a/src/chrome.html +++ b/src/chrome.html @@ -3,14 +3,17 @@ - - Google Chrome — Spyware Watchdog - + + Google Chrome — Spyware Watchdog +
- + +
Google Chrome's Logo

Google Chrome

@@ -48,43 +51,32 @@
diff --git a/src/convert.py b/src/convert.py index 6338abd..1fe9c42 100644 --- a/src/convert.py +++ b/src/convert.py @@ -7,14 +7,17 @@ MAIN_HTML = """ - - {title} — Spyware Watchdog - + + {title} — Spyware Watchdog +
- + +
{title}'s Logo

{title}

@@ -26,16 +29,9 @@ MAIN_HTML = """
@@ -63,43 +59,39 @@ def convertMarkdown(inputStr, fileName): footer = "" # Futher reading - furtherFooter = """
+ footer += """
-

Further Reading:

- {content} -
""".format(content = md.convert(further)) - - footer += furtherFooter +

Further Reading:

+ {further} +
+""".format(further = md.convert(further).replace("\n","\n\t")).replace("\n", "\n\t\t\t") # Sources - sourceFooter = """
-
-

Sources:

-
    """ + a = "" for i in sources.split("\n"): if i != "": result = re.match(r"(\d+)\. (.+)", i) - sourceFooter += """
  1. - {content} -
  2. """.format( + a += """\n
  3. {content}
  4. """.format( number = result.group(1), content = md.convert(result.group(2)) - ) - sourceFooter += """
-
""" - footer += sourceFooter + ).replace("\n", "\n\t\t") + + footer += f"""
+
+

Sources:

+
    {a} +
+
+""".replace("\n", "\n\t\t\t") # dates - footer += """
+ footer += f"""
This article was created on {created}
This article was last modified on {modified}
-This article is made for version {version} of the software""".format( - created = created, - modified = modified, - version = version -) +This article is made for version {version} of the software""".replace("\n", "\n\t\t\t") # The .replace is used below to make sure indentation is consistent + # This is not required but makes debugging a little easier. return MAIN_HTML.format( title = title, fileName = fileName,