H # Include proxy title 1a #define DESCRIPTION "" #define IMAGE #define IMAGE_ALT "" . 1a # 📎 TITLE By Artyom Bologov . # Include/delete the template files (not needing most) $r template/copyright # Mark all the lines with end-of-line separator g/$/s//|||/ # Var substitution: Duplicate var defintion # to before all the var-containing lines g/TITLE/?#define TITLE?t. g/DESCRIPTION/?#define DESCRIPTION?t. g/IMAGE_ALT/?#define IMAGE_ALT?t. g/IMAGE[^_]/?#define IMAGE[^_]?t. # No need for colors here # Substitute all vars into the text 2,$g/#define *[A-Z_]*/-1,.j\ s/\([A-Z_]*\)\(.*\)|||#define \1 \([^|]*\)/\3\2/ # Split lines (no longer necessary) g/|||$/s/// g/|||/s//\ /g # Remove all the #define-s g/#[a-z]\{1,\}/d # Replace all kinds of char macros g/HASH()/s//#/g g/SQUOTE()/s//'/g g/DQUOTE()/s//"/g g/LT()/s///g g/AMP()/s//\&/g g/NUM()/s//#/g # Trivial non-text macros g/HYPERTEXTONLY(.*)/d g/GEMTEXTONLY(.*)/d g/LATEXONLY(.*)/d g/MANONLY(.*)/d g/EXCEPTHYPERTEXT(\(.*\))/s//\1/ g/EXCEPTGEMTEXT(\(.*\))/s//\1/ g/EXCEPTLATEX(\(.*\))/s//\1/ g/EXCEPTMAN(\(.*\))/s//\1/ g/END(DETAILS)/s//)/ g/END(.*)/d g/^P(.*)/d g/FIG()/d g/INPUT(.*)/d # Links g/A(\([^ ]*\), *\([^)]*\(([^)]*)\)*[^)]*)*\))/s//\2 <\1>/ g/AID(\([^ ]*\), *\([^ ]*\), \([^)]*\(([^)]*)\)*[^)]*)*\))/s//\3 <\1#\2>/ g/AHERE(\([^ ]*\), *\([^)]*\(([^)]*)\)*[^)]*)*\))/s//\2 <\1.txt>/ # Media g/IMG(\([^ ]*\), *\(.*\))/s//<\1> (\2)/ g/PIC(\([^ ]*\), *\([^ ]*\), \(.*\))/s//<\1> (\3)/ g/AUDIO(\([^ ]*\), *\(.*\))/s//<\1>/ g/VIDEO(\([^ ]*\), *\(.*\))/s//<\1>/ # Blocks g/FIGCAP(\(.*\))/s//-- \1/ g/PRE(\(.*\))/s//=================================== \1 ===================================/ g/PRECAP(\(.*\))/s//==================== \1 ====================/ g/BQ()/s//> / g/BQCAP(\(.*\))/s//-- \1/ # Lists g/^ *D[DL](\(.*\))/s//\1:/g g/^ *[UO]*LI */s//* /g g/^ *[UO]L(\([^)]*\)) */s//* /g # Minor markup g/CD(\([^)]*\(([^)]*)\)*[^)]*\))/s//`\1`/g g/VAR(\([^)]*\(([^)]*)\)*[^)]*\))/s//`\1`/g g/KBD(\([^)]*\(([^)]*)\)*[^)]*\))/s//<\1>/g g/EM(\([^)]*\(([^)]*)\)*[^)]*\))/s//*\1*/g # Tables g/T[DH](\([^)]*\))/s//\1 |/ g/T[AR][OB](\(.*\))/s//|\1 |/ g/T[AR][OB]2(\([^,]*\), *\(.*\))/s//|\1 |\2 |/ g/T[AR][OB]3(\([^,]*\), *\([^,]*\), *\(.*\))/s//|\1 |\2 |\3 |/ g/T[AR][OB]4(\([^,]*\), *\([^,]*\), *\([^,]*\), *\(.*\))/s//|\1 |\2 |\3 |\4 |/ g/T[AR][OB]5(\([^,]*\), *\([^,]*\), *\([^,]*\), *\([^,]*\), *\(.*\))/s//|\1 |\2 |\3 |\4 |\5 |/ g/TABCAP(\(.*\))/s//-- \1/ # Sections g/SECTION2(\([^,]*\), *\(.*\))/s//## \2 (#\1)/ g/SECTION3(\([^,]*\), *\(.*\))/s//### \2 (#\1)/ g/SECTION4(\([^,]*\), *\(.*\))/s//#### \2 (#\1)/ g/SECTION5(\([^,]*\), *\(.*\))/s//##### \2 (#\1)/ g/SECTION6(\([^,]*\), *\(.*\))/s//###### \2 (#\1)/ g/DETAILS(\(.*\))/s//(\1:/ g/HR()/s//================================================================================/ w Q