Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-description.awk
diff options
context:
space:
mode:
Commitc0b46180d7fb80e02ede355e25b1335df8a39347 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-09-29 15:07:07 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-09-29 17:40:10 +0300
Filesd3006c5e167a08d92504916032241aa9ff050fa6 /generate-hooks/create-description.awk
syndamia.com-c0b46180d7fb80e02ede355e25b1335df8a39347.tar
syndamia.com-c0b46180d7fb80e02ede355e25b1335df8a39347.tar.gz
syndamia.com-c0b46180d7fb80e02ede355e25b1335df8a39347.zip
Parente16a00653ea1d7fcd588cfafe540f98c905839dd (diff)
[hooks] Updated and reformatted documentation for everything in hooks, including README
1 files changed, 9 insertions, 7 deletions
-rw-r--r--generate-hooks/create-description.awk16
diff --git a/generate-hooks/create-description.awk b/generate-hooks/create-description.awk
index ec0bace..8c0d753 100644
--- a/generate-hooks/create-description.awk
+++ b/generate-hooks/create-description.awk
@@ -1,14 +1,16 @@
-# For every page, the description meta tag is "[DESCRIPTION]", with this we
-# generate it. At most, the first 200 characters from all paragraphs are taken.
+#
+# == About ==
+#
+# Every page has a description and og:description meta tags. These descriptions
+# are generated from the paragraphs, inside the given 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) {
- # Removes tags and bad characters
- gsub(/<[^>]*>/, "", l) ; gsub("&#8217;", "'", l) ; gsub(/[^a-zA-Z0-9 '.]/, "", l)
- # Trims leading and trailing spaces and tabs (if any)
+ gsub(/<[^>]*>/, "", l) ; gsub("&#8217;", "'", l)
+ gsub(/[^a-zA-Z0-9 '.]/, "", l)
gsub(/^[ \t]*/, "", l) ; gsub(/[ \t]*$/, "", l)
- # Concatenates the current record to variable and shortens it,
- # when it gets too long
desc = desc l
if (length(desc) >= 200) {
desc = substr(desc, 1, 197) "..."