]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
print module config at the end of the file
authorAlan T. DeKok <aland@freeradius.org>
Thu, 22 Aug 2019 17:25:31 +0000 (13:25 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 22 Aug 2019 17:25:31 +0000 (13:25 -0400)
instead of in-line, which can get confusing

The behavior can be toggle via `-t`, which is nice

doc/all.mk
scripts/asciidoc/conf2adoc

index b66366f97aa737c3628c0f331248465516fa0374..70186ba761a0374bfda054b8b7df942c9a09e943 100644 (file)
@@ -188,7 +188,7 @@ doc/raddb/%.adoc: raddb/%
        @echo ADOC $^
        ${Q}mkdir -p $(dir $@)
        ${Q}perl -pi -e 's/^# ([^ \t])/#  $$1/;s/^([ \t]+)# ([^ \t])/$$1#  $$2/;s/[ \t]+$$//' $^
-       ${Q}./scripts/asciidoc/conf2adoc -a ${top_srcdir}/asciidoc -o $@ < $^
+       ${Q}./scripts/asciidoc/conf2adoc -t -a ${top_srcdir}/asciidoc -o $@ < $^
 
 README_MODULES := $(wildcard src/modules/rlm_*/README.md)
 doc/raddb/mods-available/all_modules.adoc: $(README_MODULES)
index a2388a830360c649d4e6064c7a11ddf3cebe58eb..fb203f90803db41c5b59671e20ca52b7ce4cb05a 100755 (executable)
@@ -14,10 +14,13 @@ $raw = 0;
 $blank = 0;
 $print_code = 0;
 
-getopts('a:c:o:');
+getopts('a:c:o:t');
 
 $script_dir = dirname(__FILE__);
 $filename = "$script_dir/links.txt";
+
+$opt_c = 0 if (defined $opt_t) ;
+
 $print_code = $opt_c;
 
 %links = {};
@@ -43,6 +46,7 @@ $links{"mods-available/"} = "$opt_a/mods-available/index.adoc";
 sub process_file {
        my $input = shift;
        my $output_file = shift;
+       my @code = ();
 
        if (!defined $output_file) {
            $output = STDOUT;
@@ -197,7 +201,12 @@ sub process_file {
                        $line =~ s,RFC (\d+),https://tools.ietf.org/html/rfc${1}\[RFC $1\],g;
                }
 
-               next if (!$print_code && $raw && $was_raw);
+               if (!$print_code) {
+                   if ($raw && $was_raw) {
+                       push @code, $line if ($opt_t);
+                       next;
+                   }
+               }
 
                #
                #  And print out the raw text.
@@ -209,6 +218,18 @@ sub process_file {
        #  Terminate any trailing "raw" text.
        #
        print $output "```\n" if ($print_code);
+
+       if ($opt_t) {
+           print $output "== Default Configuration\n\n";
+
+           print $output "```\n";
+
+           foreach $line (@code) {
+               print $output $line;
+           }
+
+           print $output "```\n";
+       }
 }
 
 sub HELP_MESSAGE {