comparison doc/format_config.awk @ 8416:370689471a08 issue2550923_computed_property

merge from default branch accumulated changes since Nov 2023
author John Rouillard <rouilj@ieee.org>
date Sun, 17 Aug 2025 16:12:25 -0400
parents 20943bf4f1b7
children
comparison
equal deleted inserted replaced
7693:78585199552a 8416:370689471a08
1 #! /bin/awk
2 BEGIN {SECRET_KEY = "DWmbKgVUy6fF5D2Y5TD5Az+dnHhMYKCCpJzIY3H8nsU="}
3
4 # delete first 8 lines
5 NR < 9 {next}
6
7 # To prevent new file generation from causing the secret_key to
8 # change, we replace the secret key with a fixed value.
9 /^# Default: [0-9A-z+=/]{44}/ {sub(/[0-9A-z+=/]{44}/, SECRET_KEY)}
10 /^secret_key = [0-9A-z+=/]{44}/ {sub(/[0-9A-Za-z+=/]{44}/, SECRET_KEY)}
11
12 # When we see a section [label]:
13 # emit section index marker,
14 # emit section anchor
15 # set up for code formating
16 # emit any comments/blank line that are accumulated before the
17 # section marker
18 # print the indented section marker
19 #
20 # zero the accumulator and the variable that prevents large blocks
21 # of empty lines.
22 /^\[([a-z]*)\]/ { match($0, /^\[([a-z]*)\].*/, section_match);
23 section = section_match[1];
24 print("\n\n.. index:: config.ini; sections " section);
25 print(".. _`config-ini-section-" section "`:");
26 print(".. code:: ini\n");
27 if (accumulate) {
28 print(" " accumulate "\n");
29 }
30 print(" " $0);
31 accumulate = "";
32 prev_line_is_blank = 0;
33 }
34
35 # if the line is a setting line (even if commented out)
36 # print the accumulated comments/blank lines and the setting line
37 # zero the accumulator and the variable that prevents blocks of blank lines
38 # get the next input line
39 /^#?[a-z0-9_-]* =/ { print accumulate "\n " $0;
40 accumulate = "";
41 prev_line_is_blank = 0;
42 next;
43 }
44
45 # accumulate comment lines and indent them
46 /^#/ { accumulate = accumulate "\n " $0; prev_line_is_blank = 0;}
47
48 # accumulate a blank line only if the previous line was not blank.
49 /^$/ { if (! prev_line_is_blank) {accumulate = accumulate $0};
50 prev_line_is_blank = 1;
51 }
52

Roundup Issue Tracker: http://roundup-tracker.org/