Skip to content

Commit ee201b4

Browse files
committed
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
1 parent 4beeeab commit ee201b4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

generator.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
import requests as req, zipfile, io, markdown2 as md, sqlite3, os, shutil, tarfile
4+
import re
45

56
html_tmpl = """<html><!-- Online page at {url} -->
67
<head>
@@ -65,6 +66,7 @@
6566
else:
6667
cur.execute('INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES (?,?,?)', (cmd_name, 'Command', sub_dir+'/'+cmd_name+".html"))
6768
doc = markdowner.convert(archive.read(path))
69+
doc = re.sub(r'{{(.*?)}}', r'<em>\1</em>', doc)
6870
doc = html_tmpl.format(url=online_url+'/'+sub_dir+'/'+cmd_name, content=doc)
6971
with open(os.path.join(doc_path, path[len(doc_pref)+1:].replace(".md", ".html")), "wb") as html:
7072
html.write(doc.encode("utf-8"))

static/style.css

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ body {
77
background: #FEFEFE;
88
color: #151515; }
99

10+
code em {
11+
color: lightseagreen;
12+
font-style: normal; }
13+
1014
#tldr #page {
1115
margin-bottom: 4em;
1216
font-size: 1.25em;}

0 commit comments

Comments
 (0)