diff options
Diffstat (limited to 'parse.awk')
-rw-r--r-- | parse.awk | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -38,23 +38,18 @@ function add_category(c){ function get_cur(cur){ - switch (cur["Type"]) { - case "": { - print "empty type -- skipping record"; - return; - } - case "link": { - add_link(cur); - return; - } - case "category":{ - add_category(cur); - return; - } - default: { - printf("invalid type: %s -- skipping\n", cur["Type"]) ; - return; - } + if (cur["Type"] == "") { + print "empty type -- skipping record"; + return; + } else if (cur["Type"] == "link"){ + add_link(cur); + return; + } else if (cur["Type"] == "category"){ + add_category(cur); + return; + } else { + printf("invalid type: %s -- skipping\n", cur["Type"]) ; + return; } } @@ -67,7 +62,7 @@ function get_cur(cur){ last_field=$1 } -/^[[:blank:]]*$/{ ## End of stanza +/^[\ \f\n\r\t\v]*$/{ ## End of stanza if (!is_empty(cur)){ get_cur(cur); delete cur; @@ -75,18 +70,23 @@ function get_cur(cur){ } } -/^[[:blank:]]+[^[:blank:]]+/{## Multi-line value +/^[\ \f\n\r\t\v]+[^\ \f\n\r\t\v]+/{## Multi-line value if (!is_empty(cur) && last_field!=""){ - gsub(/^[[:blank:]]+/, "", $0); + gsub(/^[\ \f\n\r\t\v]+/, "", $0); cur[last_field]=cur[last_field] "\n" $0; } } END{ render_init(); - render_categories(category, cnum); - render_post_categories(category, cnum); - render_links(category, cnum, link, lnum); - render_finalise(category, cnum, link, lnum); - dump_links(category, cnum, link, lnum); + #print "before render_categories" > /dev/stderr + render_categories(); +# print "before render_post_categories" > /dev/stderr + render_post_categories(); +# print "before render_links" > /dev/stderr + render_links(); +# print "before render_finalise" > /dev/stderr + render_finalise(); +# print "before dump_links" > /dev/stderr + dump_links(); } |