Skip to content

Commit

Permalink
Style curly brackets as colored text
Browse files Browse the repository at this point in the history
- does not handle nested brackets e.g.  `{{a {{b}} c}}`, but did not find any instances of this in tldr pages

close Moddus#4
  • Loading branch information
cvn committed Feb 12, 2018
1 parent 4beeeab commit ee201b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions generator.py
Original file line number Diff line number Diff line change
@@ -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 = """<html><!-- Online page at {url} -->
<head>
Expand Down Expand Up @@ -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'<em>\1</em>', 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"))
Expand Down
4 changes: 4 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand Down

0 comments on commit ee201b4

Please sign in to comment.