From: Alan T. DeKok Date: Sat, 9 Jun 2018 15:09:55 +0000 (-0400) Subject: start of "convert conf files to humanly readable" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=810ca10d956de024e34f340ca47d286421725d29;p=thirdparty%2Ffreeradius-server.git start of "convert conf files to humanly readable" --- diff --git a/scripts/conf2adoc b/scripts/conf2adoc new file mode 100755 index 00000000000..be96a0693af --- /dev/null +++ b/scripts/conf2adoc @@ -0,0 +1,58 @@ +#!/usr/bin/env perl +# +# $Id$ +# +# Convert conf files to Asciidoc +# +# + +$raw = 0; + +while (<>) { + + # Skip ###### banners + if (/^##+$/) { + next; + } + + if (/^\s*$/) { + next; + } + + # + # Comments in the configuration files get converted to plain + # text. + # + if (/^\s*#/) { + s/^\s*#[\t ]*//; + + # + # If we WERE printing blocks of raw output, end that, and + # reset the "raw" flag. + # + if ($raw == 1) { + print "```\n"; + $raw = 0; + } + + print; + next; + } + + # + # No comment at the start of the line. It must be configuration. + # Convert that to raw text. + # + # If we were printing normal text, print out the "raw" header. + # + if ($raw == 0) { + print "```\n"; + $raw = 1; + } + + # + # And print out the raw text. + # + print; +} +