X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=docbook2drupal.sh;fp=docbook2drupal.sh;h=10a32d85382e8d91c2fbe41e29677aa9477917fd;hb=ddabda845fded2f97bc0e67fa839c36c4ef29d00;hp=0000000000000000000000000000000000000000;hpb=fe5c6d9840aaab12b06cffd20a3c575b67dfbc13;p=myplc.git diff --git a/docbook2drupal.sh b/docbook2drupal.sh new file mode 100755 index 0000000..10a32d8 --- /dev/null +++ b/docbook2drupal.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# quick and dirty - might break anytime if docbook html output changes +function docbook_html_to_drupal () { + title=$1; shift + html=$1; shift + php=$1; shift + + mkdir -p $(dirname $php) + if [ ! -f $html ] ; then + cat << __header_no_doc__ > $php + +

Build-time error - could not locate documentation $html

+__header_no_doc__ + else + # insert header, makes sure we have a trailing eol + (cat << __header_doc__ ; cat $html ) > $php + +__header_doc__ + # ignore ed return status + set +e + # cuts off around the + # preserves the 4 first lines that we just added as a header + ed -s $php << __ed_script__ +/BODY/ +/>/ +s,><,<, +5,-d +$ +?/BODY? +s,><.*,>, ++ +;d +w +q +__ed_script__ + set -e + fi +} + +docbook_html_to_drupal "$@"