diff options
[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.awk | 16 |
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) "..." |