+function headline( hlvl, htxt, LOCAL, sec, n, 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 = ""; for ( n = 2; n <= blvl; n++) { hid = hid BL[n] "/"; }
+ hid = hid HL[1]; for ( n = 2; n <= hlvl; n++) { hid = hid "." HL[n] ; }
+ # hid = hid ":" URL(htxt, 1);
+
+ 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=\"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, n ) {
+ hlsav = hstack;
+ hstack = hstack " 0 0 0 0 0 0";
+
+ # Block Level
+ blvl++; BL[blvl]++;
+ for ( n = blvl + 1; n in BL; n++) { delete BL[n]; }
+
+ block = _block( block );
+ 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;
+}
+
+function _block( block, LOCAL, st, len, hlvl, htxt, sec, guard, code, indent, attrib ) {