]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
let lists be formatted correctly
authorAlan T. DeKok <aland@freeradius.org>
Sun, 10 Jun 2018 16:51:54 +0000 (12:51 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 10 Jun 2018 16:51:54 +0000 (12:51 -0400)
scripts/conf2adoc

index e8e771ed8d9262da791ebb105261a70da979a09a..0a65c4cb8b89f3d9a21e596f932f14a4c2d5f4aa 100755 (executable)
@@ -8,6 +8,8 @@
 
 $raw = 0;
 
+$firstcol = 1;
+
 while (<>) {
     #
     #  Skip editor commands
@@ -16,6 +18,10 @@ while (<>) {
        next;
     }
 
+    if (/\$Id: /) {
+       next;
+    }
+
     # Skip ###### banners
     if (/^##+$/) {
        next;
@@ -25,12 +31,23 @@ while (<>) {
        next;
     }
 
+    $oldcol = $firstcol;
+    if (/^#/) {
+       $firstcol = 1;
+    } else {
+       $firstcol = 0;
+    }
+
+    if (($firstcol == 1) && ($oldcol == 0)) {
+       s/^#//;
+    }
+
     #
     #  Comments in the configuration files get converted to plain
     #  text.
     #
     if (/^\s*#/) {
-       s/^\s*#[\t ]*//;
+       s/^\s*#[\t ]{0,2}//;
 
        #
        #  If we WERE printing blocks of raw output, end that, and
@@ -41,6 +58,13 @@ while (<>) {
            $raw = 0;
        }
 
+       #
+       #  Ensure that lists get formatted correctly
+       #
+       if (/^\s*\*/) {
+           print "  ";
+       }
+
        print;
        next;
     }