From ee201b454a2a70f9f0d58aefa447cb3d1fdada0d Mon Sep 17 00:00:00 2001 From: Chad von Nau Date: Mon, 12 Feb 2018 14:18:51 -0800 Subject: [PATCH] Style curly brackets as colored text - does not handle nested brackets e.g. `{{a {{b}} c}}`, but did not find any instances of this in tldr pages close #4 --- generator.py | 2 ++ static/style.css | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/generator.py b/generator.py index c565210..3e38030 100755 --- a/generator.py +++ b/generator.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import requests as req, zipfile, io, markdown2 as md, sqlite3, os, shutil, tarfile +import re html_tmpl = """ @@ -65,6 +66,7 @@ else: cur.execute('INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES (?,?,?)', (cmd_name, 'Command', sub_dir+'/'+cmd_name+".html")) doc = markdowner.convert(archive.read(path)) + doc = re.sub(r'{{(.*?)}}', r'\1', doc) doc = html_tmpl.format(url=online_url+'/'+sub_dir+'/'+cmd_name, content=doc) with open(os.path.join(doc_path, path[len(doc_pref)+1:].replace(".md", ".html")), "wb") as html: html.write(doc.encode("utf-8")) diff --git a/static/style.css b/static/style.css index ebe1d1b..72943c4 100644 --- a/static/style.css +++ b/static/style.css @@ -7,6 +7,10 @@ body { background: #FEFEFE; color: #151515; } +code em { + color: lightseagreen; + font-style: normal; } + #tldr #page { margin-bottom: 4em; font-size: 1.25em;}