From c0b46180d7fb80e02ede355e25b1335df8a39347 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 29 Sep 2022 15:07:07 +0300 Subject: [hooks] Updated and reformatted documentation for everything in hooks, including README --- generate-hooks/create-description.awk | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'generate-hooks/create-description.awk') 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("’", "'", l) ; gsub(/[^a-zA-Z0-9 '.]/, "", l) - # Trims leading and trailing spaces and tabs (if any) + gsub(/<[^>]*>/, "", l) ; gsub("’", "'", 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) "..." -- cgit v1.3.1-26-gb76a