1010# awk [-v option=value] -f makefile-doc.awk [Makefile ...]
1111#
1212# Options (possible values are given in {...}, (.) is the default):
13+ # + OUTPUT_FORMAT: {(ANSI), HTML}
1314# + DEBUG: {(0), 1} output debug info (in an org-mode format)
1415# + DEBUG_FILE: debug info file
1516# + SUB: see below
3334# * ##@ section (displayed in COLOR_SECTION)
3435#
3536# Color codes (https://en.wikipedia.org/wiki/ANSI_escape_code):
36- # + COLOR_ENCODING: {(ANSI), HTML}
3737# * COLOR_DEFAULT: (34) blue
3838# * COLOR_ATTENTION: (31) red
3939# * COLOR_DEPRECATED: (33) yellow
4242# * COLOR_BACKTICKS: (0) disabled -- used for text in backticks in docs
4343#
4444# Colors are specified using the parameter in ANSI escape codes, e.g., the parameter
45- # for blue is the 34 in `\033[34m`. When the COLOR_ENCODING is HTML, colors are
45+ # for blue is the 34 in `\033[34m`. When the OUTPUT_FORMAT is HTML, colors are
4646# controlled using the class attribute e.g., the value for blue is "ansi34" etc.
4747#
4848# SUB:
@@ -583,9 +583,9 @@ function strip_start_end_spaces(string) {
583583}
584584
585585function define_color (parameter ) {
586- if (COLOR_ENCODING == " ANSI" ) {
586+ if (OUTPUT_FORMAT == " ANSI" ) {
587587 return " \033 [" parameter " m"
588- } else if (COLOR_ENCODING == " HTML" ) {
588+ } else if (OUTPUT_FORMAT == " HTML" ) {
589589 if (parameter) {
590590 return " <span class=\" ansi" parameter " \" >"
591591 } else {
@@ -596,10 +596,10 @@ function define_color(parameter) {
596596
597597# Updates global variables: COLOR_*, HTML_*
598598function initialize_colors () {
599- COLOR_ENCODING = COLOR_ENCODING == " " ? " ANSI" : toupper (COLOR_ENCODING )
600- if (COLOR_ENCODING != " ANSI" && COLOR_ENCODING != " HTML" ) {
601- print (" Ignorring invalid COLOR_ENCODING : " COLOR_ENCODING " (using ANSI instead)." )
602- COLOR_ENCODING = " ANSI"
599+ OUTPUT_FORMAT = OUTPUT_FORMAT == " " ? " ANSI" : toupper (OUTPUT_FORMAT )
600+ if (OUTPUT_FORMAT != " ANSI" && OUTPUT_FORMAT != " HTML" ) {
601+ print (" Ignorring invalid OUTPUT_FORMAT : " OUTPUT_FORMAT " (using ANSI instead)." )
602+ OUTPUT_FORMAT = " ANSI"
603603 }
604604 COLOR_DEFAULT_CODE = define_color(COLOR_DEFAULT == " " ? 34 : COLOR_DEFAULT)
605605 COLOR_ATTENTION_CODE = define_color(COLOR_ATTENTION == " " ? 31 : COLOR_ATTENTION)
@@ -612,7 +612,7 @@ function initialize_colors() {
612612
613613 COLOR_RESET_CODE = define_color(0 )
614614
615- if (COLOR_ENCODING == " HTML" ) {
615+ if (OUTPUT_FORMAT == " HTML" ) {
616616 HTML_CLOSE_PRE = " </pre>"
617617 HTML_STYLE_AND_OPEN_PRE = " <head>\n <style type=\" text/css\" >\n .ansi31 { color: #d70000; }\n .ansi32 { color: #5f8700; }\n .ansi33 { color: #af8700; }\n .ansi34 { color: #0087ff; }\n .ansi35 { color: #af005f; }\n </style>\n </head>\n <pre>"
618618 }
@@ -640,7 +640,7 @@ function print_help() {
640640 printf " DEPRECATED ([bool] show deprecated anchors): %s\n " , DEPRECATED
641641 printf " OFFSET (offset of docs from anchors): %s\n " , OFFSET
642642 printf " CONNECTED (ignore docs followed by an empty line): %s\n " , CONNECTED
643- printf " COLOR_ENCODING : %s\n " , COLOR_ENCODING
643+ printf " OUTPUT_FORMAT : %s\n " , OUTPUT_FORMAT
644644 printf " COLOR_: "
645645 printf " %sDEFAULT%s, " , COLOR_DEFAULT_CODE, COLOR_RESET_CODE
646646 printf " %sATTENTION%s, " , COLOR_ATTENTION_CODE, COLOR_RESET_CODE
@@ -1058,7 +1058,7 @@ END {
10581058 debug(DEBUG_INDENT_STACK " extracted_sub_params" )
10591059 debug_indent_down()
10601060
1061- if (COLOR_ENCODING == " HTML" ) {
1061+ if (OUTPUT_FORMAT == " HTML" ) {
10621062 print (HTML_STYLE_AND_OPEN_PRE)
10631063 }
10641064
@@ -1101,7 +1101,7 @@ END {
11011101 }
11021102 }
11031103
1104- if (COLOR_ENCODING == " HTML" ) {
1104+ if (OUTPUT_FORMAT == " HTML" ) {
11051105 print (HTML_CLOSE_PRE)
11061106 }
11071107
0 commit comments