progress on <pre>
This commit is contained in:
parent
383aa09ba0
commit
1c89aaf9a4
32
g2e.awk
32
g2e.awk
|
@ -85,6 +85,11 @@ ARGIND==1 && /^=>/{
|
|||
content = content " <item id=\"" id "\" href=\"" id ".xhtml\" media-type=\"application/xhtml+xml\"/>\n"
|
||||
spinetoc = spinetoc " <itemref idref=\"" id "\" />\n"
|
||||
toc = toc write_template( "toc-navmap.ncx", ch )
|
||||
next
|
||||
}
|
||||
|
||||
ARGIND==1{ # skip other lines of the index
|
||||
next
|
||||
}
|
||||
|
||||
# when finished reading the index:
|
||||
|
@ -106,12 +111,10 @@ function append(line){
|
|||
out = out "\t\t" line "\n"
|
||||
}
|
||||
|
||||
ARGIND>2 && FNR==1{
|
||||
finishfile()
|
||||
}
|
||||
|
||||
# setup the writing for this content file
|
||||
ARGIND>1 && FNR==1 {
|
||||
FNR==1 {
|
||||
if(ARGIND>2) finishfile()
|
||||
|
||||
id=FILENAME
|
||||
match(id,/[^/]+.gmi$/)
|
||||
filenamestart = RSTART
|
||||
|
@ -122,12 +125,25 @@ ARGIND>1 && FNR==1 {
|
|||
sub(/#{1,3}\s+/,"", $0)
|
||||
m["title"] = $0
|
||||
out = write_template("header.xhtml",m)
|
||||
is_pre = 0
|
||||
is_list = 0
|
||||
next
|
||||
}
|
||||
|
||||
ARGIND>1 && match($0,/^#{1,3}+/){
|
||||
sub(/^#{1,3}[[:space:]]+/,"",$0)
|
||||
append( "<h" RLENGTH ">" $0 "</h" RLENGTH ">")
|
||||
/^```/{
|
||||
is_pre = !is_pre
|
||||
if(is_pre) append("<pre>")
|
||||
else append("</pre>")
|
||||
next
|
||||
}
|
||||
|
||||
# headers
|
||||
match($0,/^#{1,3}+/){
|
||||
if(!is_pre){
|
||||
sub(/^#{1,3}[[:space:]]+/,"",$0)
|
||||
append( "<h" RLENGTH ">" $0 "</h" RLENGTH ">")
|
||||
}
|
||||
else append($0)
|
||||
next
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue