diff options
| author | John J. Camilleri <john@digitalgrammars.com> | 2019-05-06 08:45:07 +0200 |
|---|---|---|
| committer | John J. Camilleri <john@digitalgrammars.com> | 2019-05-06 08:45:07 +0200 |
| commit | af62a99bf535dc45d44d8546faab938485e49c84 (patch) | |
| tree | 2237310293f5dbd1456905b0af8d0abd705e295c /bin | |
| parent | ac1f304722f77dbe5a0a439c9c5269dc098c9028 (diff) | |
update_html rewrites anchors which Pandoc 1.16 doesn't process
See #43
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/update_html | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/update_html b/bin/update_html index 587ed6179..912ff1fa0 100755 --- a/bin/update_html +++ b/bin/update_html @@ -87,7 +87,7 @@ function render_t2t_html { # Render markdown into html file # Arguments: # 1. markdown source file, e.g. download/index.md -# 2. html target filen, e.g. download/index.html +# 2. html target file, e.g. download/index.html function render_md_html { md="$1" html="$2" @@ -113,11 +113,17 @@ function render_md_html { # Final post-processing if [ -f "$html" ] ; then - sed -i.bak "s/<table/<table class=\"table\"/" "$html" && rm "$html.bak" + # add "table" class to tables + sed -i.bak "s/<table/<table class=\"table\"/" "$html" + # rewrite anchors that Pandoc 1.16 ignores: [content]{#anchor} -> <span id="anchor">content</span> + sed -i.bak -E "s/\[(.*)\]\{#(.+)\}/<span id=\"\2\">\1<\/span>/" "$html" + rm -f "$html.bak" echo "$html" fi } +# Main entry point +# Script can be run in one of two modes: if [ $# -gt 0 ] ; then # Render specific file(s) from args, ignoring dates for file in "$@" ; do |
