-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
html improvements and fixed pandoc version (#312)
Co-authored-by: Marc Lichtman <[email protected]>
- Loading branch information
Showing
4 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ sigmf-spec.log | |
sigmf-spec.aux | ||
svg-inkscape/ | ||
sigmf-spec.html | ||
main.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,12 +70,12 @@ def gen_fields(doc, d): | |
) # \usepackage[, urlcolor=blue, linkcolor=red]{hyperref} | ||
|
||
# Colors | ||
doc.append(NoEscape("\\definecolor{lightgray}{RGB}{240,240,240}")) # for `short code` | ||
doc.append(NoEscape("\\definecolor{mylightgray}{RGB}{240,240,240}")) # for `short code` | ||
doc.append(NoEscape("\\definecolor{lightblue}{RGB}{240,240,255}")) # for table rows | ||
|
||
# Custom commands | ||
doc.append( | ||
NoEscape("\\newcommand{\\code}[1]{\\texttt{\colorbox{lightgray}{#1}}}") | ||
NoEscape("\\newcommand{\\code}[1]{\\texttt{\colorbox{mylightgray}{#1}}}") | ||
) # \\code{} displays using monospace font and light gray background | ||
doc.append(NoEscape("\\newcommand{\\nn}[0]{\\vspace{4mm}\\\\\\noindent}")) # \\nn gives a new line with space and no indent | ||
|
||
|
@@ -179,6 +179,36 @@ def gen_fields(doc, d): | |
except subprocess.CalledProcessError as e: | ||
print(e) # this seems normal to occur | ||
|
||
# Create CSS file | ||
css_string = """ | ||
#TOC { | ||
position: fixed; | ||
width: 20em; | ||
left: -1em; | ||
top: 0; | ||
height: 100%; | ||
background-color: white; | ||
overflow-y: scroll; | ||
padding: 0; | ||
} | ||
#subsec\:TableofContents { | ||
display: none; | ||
} | ||
body { | ||
padding-left: 20em; | ||
} | ||
code { | ||
color: #000; | ||
font-family: monospace; | ||
background: #f4f4f4; | ||
} | ||
tr:nth-of-type(odd) { | ||
background-color:#f0f0ff; | ||
} | ||
""" | ||
with open("main.css", "w") as f: | ||
f.write(css_string) | ||
|
||
# Generate HTML | ||
css_url = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
subprocess.run(f"pandoc sigmf-spec.tex -f latex -t html -s -o sigmf-spec.html --toc --toc-depth=3 -c {css_url}".split()) | ||
subprocess.run(f"pandoc sigmf-spec.tex -f latex -t html -s -o sigmf-spec.html --toc --toc-depth=3 -c {css_url} -c main.css".split()) |