Skip to content

Commit

Permalink
Another spellchecker improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
shefulloflight committed Feb 6, 2025
1 parent f446d4f commit 7225e0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .spelling-allowlist
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ iRMC
idmapd
inode
intra-node
io
ipmitool
kB
keyspace
Expand Down
10 changes: 5 additions & 5 deletions spellcheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def preprocess_content(content, filename, allowlist_words)

content
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') # Ignore Markdown links, keeping only the text within square brackets
.gsub(/{%\s*include\s+content-reuse\/[^\n%]+\.md\s*%}/, ' ')
.gsub(/Gävle/, ' ') # Ignore special cases
.gsub(/dæmons/i, ' ')
.gsub(/([[:alnum:]]+(_|-))+[[:alnum:]]+/, ' ') # Ignore underscores and dashes
Expand Down Expand Up @@ -52,22 +53,21 @@ def preprocess_content(content, filename, allowlist_words)
.gsub(/C-\d+[A-Za-z]*\b/, ' ') # Ignore `C-<N>T` patternws
.gsub(/K-\d+[A-Za-z]*\b/, ' ') # Ignore `K-<N>T` patterns
.gsub(/ConnectX-\d+\b/, ' ') # Ignore `ConnectX-<N>` patterns
# .gsub(/\{%\s*capture\s+[\s\S]*?%\}[\s\S]*?\{%\s*endcapture\s*%\}/m, '') # Ignore Liquid capture tags comprised entirely of JSON
.gsub(/{%\s*capture\s+[^%]+%}\s*([\s\S]*?){%\s*endcapture\s*%}/m, ' ')
.gsub(/{%\s*if page\.[^%]+%}\s*([\s\S]*?)(?:{%\s*(?:elsif[^%]+|else)\s*%}\s*([\s\S]*?))?{%\s*endif\s*%}/m, ' ')
.gsub(/{%\s*unless[^%]+%}\s*([\s\S]*?){%\s*endunless\s*%}/m, ' ') # Ignore Liquid unless conditionals
.gsub(/{%\s*include\s+rfc\.html\s+rfc='[^']*'\s*%}/, ' ') # Ignore Liquid RFC links
.gsub(/{%\s*include\s+qq\.html\s+command="[^']*"\s*%}/, ' ') # Ignore Liquid qq CLI links
.gsub(/{%\s*assign\s+\w+\s*=.*?%}/m, ' ') # Ignore Liquid {% assign %} tags
.gsub(/{%\s*comment\s*%}.*?{%\s*endcomment\s*%}/m, ' ') # Ignore Liquid comments
.gsub(/{%\s*include image\.html .*?%}/m, ' ') # Ignore Liquid images
# .gsub(/{%\s*include\s+content-reuse\/[^%]+%}/, ' ')
.gsub(/{%\s*include\s+content-reuse\/[\s\S]+?%}/, ' ')
.gsub(/{%\s*include image\.html .*?%}/m, ' ') # Ignore Liquid images
#.gsub(/{%\s*include shared_image\.html .*?%}/m, ' ') # Ignore Liquid shared images
.gsub(/{%\s*include\s+shared_image\.html[\s\S]+?%}/, ' ')
.gsub(/\{\{.+?\}\}/, ' ') # Ignore Liquid variables
.gsub(/var[[:alpha:]]*/, ' ') # Ignore local variables in YAML
.gsub(/\{%\s*endcapture\s*%\}/, ' ') # Ignore {% endcapture %} Liquid tags
.gsub(/\{%\s*endif\s*%\}/, ' ') # Ignore {% endif %} Liquid tags
.gsub(/\{%\s*endunless\s*%\}/, ' ') # Ignore {% endunless %} Liquid tags
.gsub(/\{%\s*endunless\s*%\}/, ' ') # Ignore {% endunless %} Liquid tags
.gsub(/="[^"]+\.(?:png|jpg|jpeg|webp)"/, '') # Ignore image files
.gsub(/(?:&shy;)/, '') # Ignore `&shy;`
.gsub(/&apos;/, "'") # Replace &apos; with '
Expand Down

0 comments on commit 7225e0b

Please sign in to comment.