From 3552c3e6cb666ac3f063652862e3b287cd30c904 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 23 Oct 2023 15:34:14 +0300 Subject: [generate] Reworked to use csg, updated awk scripts with csg in mind and updated info in _header --- awk-edits/File-type.awk | 1 + awk-edits/Flags.awk | 1 + awk-edits/Group-contents.awk | 1 + awk-edits/Header-description.awk | 52 --------------------------------------- awk-edits/Header-title.awk | 28 --------------------- awk-edits/Heading-anchors.awk | 1 + awk-edits/Pagenav.awk | 31 +++++------------------ awk-edits/Presentation.awk | 9 +++---- awk-edits/Svg-height-attrib.awk | 1 + awk-edits/Syntax-highlighting.awk | 1 + 10 files changed, 16 insertions(+), 110 deletions(-) delete mode 100644 awk-edits/Header-description.awk delete mode 100644 awk-edits/Header-title.awk (limited to 'awk-edits') diff --git a/awk-edits/File-type.awk b/awk-edits/File-type.awk index f283fa0..32e22b9 100644 --- a/awk-edits/File-type.awk +++ b/awk-edits/File-type.awk @@ -1,3 +1,4 @@ +# .*(misc|preserved).*html # # == About == # diff --git a/awk-edits/Flags.awk b/awk-edits/Flags.awk index 719d82c..aad1343 100644 --- a/awk-edits/Flags.awk +++ b/awk-edits/Flags.awk @@ -1,3 +1,4 @@ +# .*html # # == About == # diff --git a/awk-edits/Group-contents.awk b/awk-edits/Group-contents.awk index 7f930b6..43fa460 100644 --- a/awk-edits/Group-contents.awk +++ b/awk-edits/Group-contents.awk @@ -1,3 +1,4 @@ +# .*(blog|slides|teaching|tutorials|misc)/.*/.*html # # == About == # diff --git a/awk-edits/Header-description.awk b/awk-edits/Header-description.awk deleted file mode 100644 index f7c6ff4..0000000 --- a/awk-edits/Header-description.awk +++ /dev/null @@ -1,52 +0,0 @@ -# -# == About == -# -# Every page has a description and og:description meta tags. These descriptions are -# generated from the text inside paragraphs of the current page. -# The value for those meta tags is "[DESCRIPTION]" and it gets replaced with -# either all of the text on the page, or only the first 200 characters. - -function appToDesc(l) { - l = substr(l, parstar, length(l) - parstar + 1 - parend); - gsub("<[^>]*>", "", l); gsub("’", "'", l); gsub(/&[^;]*;/, "", l); - - if (desc == "") desc = l; - else desc = desc " " l; - - if (length(desc) >= 200) { - desc = substr(desc, 1, 197) "..."; - return 1; - } - return 0; -} - -BEGIN { - parcont = 0; # continue, we have found a

but not a

- parstar = 1; # we found a

- parends = 0; # we found a

- - # Loop over the whole file, extract all text in first couple of paragraphs, - # store it in desc (but no more than 200 characters will be saved) - while(getline < ARGV[1]) { - start = index($0, "")) - parstar = 4; - if (index($0, "

")) - parends = 3; - - if (parcont || parstar == 4) { - if (appToDesc($0)) break; - parcont = parends == 0; - parstar = 1; - parends = 0; - } - } - close(ARGV[1]); # FILENAME isn't set during BEGIN -} - -/\[DESCRIPTION\]/ { - sub(/\[DESCRIPTION\]/, desc); -} diff --git a/awk-edits/Header-title.awk b/awk-edits/Header-title.awk deleted file mode 100644 index 42fafa7..0000000 --- a/awk-edits/Header-title.awk +++ /dev/null @@ -1,28 +0,0 @@ -# -# == About == -# -# Every page has a og:title meta tag, which has to be generated from the page -# itself. The title tag is automatically filled in by ssg. -# The value for the meta tag is "[TITLE]" and it gets replaced with all text -# inside first h1 header tag. - -BEGIN { - h1Index = 0; - - # When this loop finishes, $0 will have the first line containing an h1 header - # tag, and h1Index will have it's starting position - while (h1Index == 0 && getline < ARGV[1]) - h1Index = index($0, "]*>/, ""); - # Remove all HTML character codes, since they're in the form "&...;" and the & - # will be treated as the character for replacement in gsub - gsub(/&[^;]*;/, ""); - title = substr($0, h1Index, index($0, " 0) { - if ($1 == fileCheck) { - dateCreate = $2; - dateEdited = $3; - break; - } - } - FS = " " # gawk only? - - start = index(fileCheck, "website") + 8; - elem = ORS \ +nopagenav == 0 && /

" ORS \ -" Created: " dateCreate " || Edited: " dateEdited "" ORS \ -" || GitLab source" ORS \ +" Created: " created " || Edited: " edited "" ORS \ +" || GitLab source" ORS \ "" - } -} -/

/ { +// { presInsideCode = 1 } -nopresentation == 0 && /<\/code>/ { +/<\/code>/ { presInsideCode = 0 } -nopresentation == 0 && presInsideCode == 0 && /^[ \t]*(

)?&&/ { +presInsideCode == 0 && /^[ \t]*(

)?&&/ { for (i = 1; i <= nameslength; i++) { if (index($0, names[i]) != 0) presentationSubstitute(i) diff --git a/awk-edits/Svg-height-attrib.awk b/awk-edits/Svg-height-attrib.awk index e6dc07f..9e49769 100644 --- a/awk-edits/Svg-height-attrib.awk +++ b/awk-edits/Svg-height-attrib.awk @@ -1,3 +1,4 @@ +# .*html # # == About # diff --git a/awk-edits/Syntax-highlighting.awk b/awk-edits/Syntax-highlighting.awk index 08589cf..577ecb3 100644 --- a/awk-edits/Syntax-highlighting.awk +++ b/awk-edits/Syntax-highlighting.awk @@ -1,3 +1,4 @@ +# .*(blog|slides|teaching|tutorials|misc)/.*/.*html # # == About == # -- cgit v1.3.1-26-gb76a