Compare commits
4 Commits
fd1ae2cc3a
...
084b06d2aa
Author | SHA1 | Date |
---|---|---|
sejo | 084b06d2aa | |
sejo | 7c6198b51b | |
sejo | 8bf1a82941 | |
sejo | 9aba0013cc |
20
g2e.awk
20
g2e.awk
|
@ -113,10 +113,10 @@ ARGIND==2 && FNR==1{
|
|||
|
||||
# finalize metadata files
|
||||
content = content " </manifest>\n\n" spinetoc " </spine>\n\n</package>"
|
||||
printf content > epubodir "content.opf"
|
||||
print content > epubodir "content.opf"
|
||||
|
||||
toc = toc " </navMap>\n</ncx>"
|
||||
printf toc > epubodir "toc.ncx"
|
||||
print toc > epubodir "toc.ncx"
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,8 +126,8 @@ ARGIND==2 && FNR==1{
|
|||
|
||||
function finishfile(){
|
||||
# finish writing the previous content file
|
||||
out = out " </body>\n</html>"
|
||||
printf out > nameout
|
||||
out = out "\t</main>\n </body>\n</html>"
|
||||
print out > nameout
|
||||
}
|
||||
function append(line){
|
||||
out = out "\t" line "\n"
|
||||
|
@ -153,6 +153,12 @@ FNR==1 {
|
|||
next
|
||||
}
|
||||
|
||||
function sanitize(){
|
||||
gsub("&","\\&")
|
||||
gsub("<","\\<")
|
||||
gsub(">","\\>")
|
||||
}
|
||||
|
||||
# --------------------------
|
||||
# gemtext to html conversion
|
||||
# --------------------------
|
||||
|
@ -165,7 +171,9 @@ FNR==1 {
|
|||
next
|
||||
}
|
||||
|
||||
|
||||
is_pre{
|
||||
sanitize()
|
||||
append($0)
|
||||
next
|
||||
}
|
||||
|
@ -179,6 +187,7 @@ is_pre{
|
|||
# lists
|
||||
sub(/^\*[[:space:]]*/,""){
|
||||
if(!is_list){ append("<ul>"); is_list = 1 }
|
||||
sanitize()
|
||||
append("<li>" $0 "</li>")
|
||||
next
|
||||
}
|
||||
|
@ -186,12 +195,14 @@ sub(/^\*[[:space:]]*/,""){
|
|||
# headers
|
||||
match($0,/^#{1,3}+/){
|
||||
sub(/^#{1,3}[[:space:]]+/,"",$0)
|
||||
sanitize()
|
||||
append( "<h" RLENGTH ">" $0 "</h" RLENGTH ">")
|
||||
next
|
||||
}
|
||||
|
||||
# blockquote
|
||||
sub(/^>[[:space:]]*/,""){
|
||||
sanitize()
|
||||
append("<blockquote>" $0 "</blockquote>")
|
||||
next
|
||||
}
|
||||
|
@ -222,6 +233,7 @@ sub(/^\+[[:space:]]*/,""){
|
|||
|
||||
# paragraphs
|
||||
{
|
||||
sanitize()
|
||||
append("<p>" $0 "</p>")
|
||||
}
|
||||
|
||||
|
|
|
@ -7,4 +7,7 @@
|
|||
<link rel="stylesheet" href="../style.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>{title}</h1>
|
||||
</header>
|
||||
<main>
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
body{
|
||||
body {
|
||||
padding: 1em;
|
||||
font-family:sans-serif;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
pre{
|
||||
background-color: #fee;
|
||||
padding:1em;
|
||||
background-color: #eee;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
blockquote{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
header h1{
|
||||
font-size:3em;
|
||||
}
|
||||
th,td{
|
||||
border-style:ridge;
|
||||
padding:5px;
|
||||
|
|
Loading…
Reference in New Issue