}
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]?"</section>":""); }
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 "<section class=\"h1\"" ((blvl > 10)?"":" id=\"" hid "\"") ">" \
- "<h1>" inline( htxt ) \
- ((blvl > 0)?"":"<a class=\"anchor\" href=\"#" hid "\"></a>") \
- "</h1>\n\n";
+ return sec "<section class=\"h" hlvl "\" id=\"" hid "\">" \
+ "<h" hlvl ">" inline( htxt ) \
+ "<a class=\"anchor\" href=\"#" hid "\"></a>" \
+ "</h" hlvl ">\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]?"</section>":""); }
hstack = hlsav; blvl--;
return block sec;