-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from davidmreed/paperwork
Paperwork rendering + PLT guide
- Loading branch information
Showing
16 changed files
with
801 additions
and
29 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
build-assets/epub-metadata.txt → build-assets/epub-metadata.yaml
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 |
---|---|---|
@@ -1,5 +1,2 @@ | ||
--- | ||
author: Stacktrace / David Reed | ||
rights: Creative Commons Attribution-ShareAlike 4.0 | ||
language: en-US | ||
--- |
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.canonical-link { | ||
display: inline-block !important; | ||
} | ||
|
||
h1, | ||
h2, | ||
h3, summary { | ||
font-family: 'Arial Black'; | ||
font-weight: bold; | ||
text-align: left; | ||
padding: 0; | ||
} | ||
|
||
summary { | ||
padding-top: 2em; | ||
} | ||
|
||
h1 { | ||
font-size: 14pt; | ||
border-bottom: 3pt solid; | ||
border-bottom-color: black; | ||
padding-bottom: 2pt; | ||
} | ||
|
||
h2, summary { | ||
font-size: 13pt; | ||
} | ||
|
||
h3 { | ||
font-size: 12pt; | ||
} | ||
|
||
h4 { | ||
font-size: 11pt; | ||
} | ||
|
||
h5 { | ||
font-size: 10.5pt; | ||
} | ||
|
||
html { | ||
margin: 0; | ||
padding: 0; | ||
font-size: 10pt; | ||
line-height: normal !important; | ||
} | ||
|
||
|
||
dl { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
dl dd { | ||
display: inline; | ||
margin: 0; | ||
padding: 0; | ||
margin-right: 2rem; | ||
} | ||
|
||
dl dt { | ||
display: inline; | ||
font-style: italic; | ||
color: inherit; | ||
margin: 0; | ||
padding: 0; | ||
margin-right: 1rem; | ||
} | ||
|
||
abbr { | ||
font-size: 80%; | ||
text-decoration: none !important; | ||
} | ||
|
||
body { | ||
font-size: 1.15rem; | ||
line-height: 1.3; | ||
font-family: serif; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function Div(el) | ||
-- Discard the internal Div representing the header. | ||
if el.classes[2] == "header" then | ||
return {} | ||
end | ||
|
||
-- Find a Plain with content "Table of Contents" | ||
-- followed by a BulletList, and drop them both if found. | ||
local filteredBlocks = {} | ||
if el.content then | ||
for i, v in ipairs(el.content) do | ||
if v.tag == "BulletList" and i > 1 then | ||
previousTag = el.content[i-1] | ||
if pandoc.utils.stringify(previousTag.content) == "Table of Contents" then | ||
-- Omit the previous tag and this tag | ||
table.remove(filteredBlocks) | ||
else | ||
table.insert(filteredBlocks, v) | ||
end | ||
else | ||
table.insert(filteredBlocks, v) | ||
end | ||
end | ||
|
||
el.content = filteredBlocks | ||
end | ||
|
||
return el | ||
end | ||
|
||
function Pandoc(el) | ||
-- Retain only the Div that has the role `main`. | ||
-- Discard all other top-level elements, which | ||
-- are HTML-only. | ||
|
||
-- Promote this Div's own contents to top-level | ||
-- This prevents Pandoc from getting confused | ||
-- and adding an extra H1 to our doc. | ||
-- See https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Writers/EPUB.hs#L556 | ||
|
||
for i, v in ipairs(el.blocks) do | ||
if v.tag == "Div" and v.attributes["role"] == "main" then | ||
newEl = el:clone() | ||
newEl.blocks = v.content | ||
return newEl | ||
end | ||
end | ||
|
||
return el | ||
end |
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
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
Oops, something went wrong.