From: Paul Hänsch Date: Sun, 2 Jul 2023 10:54:52 +0000 (+0200) Subject: nesting of
in block elements X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=516bc32df2437bc45005b1ea1a5d452503bd1669;p=cgilite nesting of
in block elements --- diff --git a/markdown.awk b/markdown.awk index a2bb989..71c91fd 100755 --- a/markdown.awk +++ b/markdown.awk @@ -308,31 +308,32 @@ function inline( line, LOCAL, len, code, href, guard ) { } function headline( hlvl, htxt, LOCAL, sec, n, HL) { - split( gensub( /^(.* )?(([0-9]+ ){5}[0-9]+)$/, "\\2" ,"1", hstack), HL); + split( gensub( /^(.* )?([0-9]+( [0-9]+){5})$/, "\\2" ,"1", hstack), HL); for ( n = hlvl; n <= 6; n++ ) { sec = sec (HL[n]?"
":""); } HL[hlvl]++; for ( n = hlvl + 1; n <= 6; n++) { HL[n] = 0;} hid = HL[1]; for ( n = 2; n <= hlvl; n++) { hid = hid "." HL[n] ; } # hid = hid ":" URL(htxt, 1); - hstack = HL[1] " " HL[2] " " HL[3] " " HL[4] " " HL[5] " " HL[6]; + hstack = gensub( /^(.* )?([0-9]+( [0-9]+){5})$/, "\\1" ,"1", hstack) \ + HL[1] " " HL[2] " " HL[3] " " HL[4] " " HL[5] " " HL[6]; - return sec "
10)?"":" id=\"" hid "\"") ">" \ - "

" inline( htxt ) \ - ((blvl > 0)?"":"") \ - "

\n\n"; + return sec "
" \ + "" inline( htxt ) \ + "" \ + "\n\n"; } # Nested Block, resets heading counters function _nblock( block, LOCAL, hlsav, sec ) { hlsav = hstack; - hstack = "0 0 0 0 0 0"; + hstack = hstack " 0 0 0 0 0 0"; # Block Level blvl++; block = _block( block ); - split( gensub( /^(.* )?(([0-9]+ ){5}[0-9]+)$/, "\2" ,"1", hstack), HL); + split( gensub( /^(.* )?([0-9]+( [0-9]+){5})$/, "\\2" ,"1", hstack), HL); sec = ""; for ( n = 1; n <= 6; n++ ) { sec = sec (HL[n]?"
":""); } hstack = hlsav; blvl--; return block sec;