Skip to content

Commit

Permalink
feat: manage shortcodes and versions in llms.txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
davlgd committed Jan 6, 2025
1 parent 49b141d commit 431f39b
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions layouts/_default/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ partial "markdown/include_entrypoint.md" .RawContent | htmlUnescape }}

Check failure on line 1 in layouts/_default/list.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/_default/list.md#L1

[Vale.Spelling] Did you really mean 'htmlUnescape'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'htmlUnescape'?", "location": {"path": "layouts/_default/list.md", "range": {"start": {"line": 1, "column": 59}}}, "severity": "ERROR"}
1 change: 1 addition & 0 deletions layouts/_default/single.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ partial "markdown/include_entrypoint.md" .RawContent | htmlUnescape }}

Check failure on line 1 in layouts/_default/single.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/_default/single.md#L1

[Vale.Spelling] Did you really mean 'htmlUnescape'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'htmlUnescape'?", "location": {"path": "layouts/_default/single.md", "range": {"start": {"line": 1, "column": 59}}}, "severity": "ERROR"}
5 changes: 5 additions & 0 deletions layouts/partials/markdown/include_entrypoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- $content := . -}}
{{- $content = partial "markdown/include_shortcode_content.md" $content -}}
{{- $content = partial "markdown/include_runtimes_versions.md" $content -}}
{{- $content = partial "markdown/include_software_versions_shared_dedicated.md" $content -}}
{{ $content }}
32 changes: 32 additions & 0 deletions layouts/partials/markdown/include_runtimes_versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- $content := . -}}
{{- $runtimesPattern := "\\{\\{<\\s*runtimes_versions\\s+([^>]+)\\s*>\\}\\}" -}}

{{- range $runtimeFound := findRE $runtimesPattern $content -}}

Check failure on line 4 in layouts/partials/markdown/include_runtimes_versions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_runtimes_versions.md#L4

[Vale.Spelling] Did you really mean 'runtimeFound'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'runtimeFound'?", "location": {"path": "layouts/partials/markdown/include_runtimes_versions.md", "range": {"start": {"line": 4, "column": 12}}}, "severity": "ERROR"}
{{- $runtime := replaceRE $runtimesPattern "$1" $runtimeFound -}}
{{- $runtime = trim $runtime " " -}}
{{- $versions := index site.Data.runtime_versions $runtime -}}

Check failure on line 7 in layouts/partials/markdown/include_runtimes_versions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_runtimes_versions.md#L7

[Google.Spacing] 'e.D' should have one space.
Raw output
{"message": "[Google.Spacing] 'e.D' should have one space.", "location": {"path": "layouts/partials/markdown/include_runtimes_versions.md", "range": {"start": {"line": 7, "column": 31}}}, "severity": "ERROR"}
{{- $output := "" -}}
{{- with $versions -}}
{{- if .default -}}
{{- $output = printf "%s### Default version\n" $output -}}

Check failure on line 11 in layouts/partials/markdown/include_runtimes_versions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_runtimes_versions.md#L11

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_runtimes_versions.md", "range": {"start": {"line": 11, "column": 27}}}, "severity": "ERROR"}
{{- range .default -}}
{{- $output = printf "%s- %s\n" $output . -}}

Check failure on line 13 in layouts/partials/markdown/include_runtimes_versions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_runtimes_versions.md#L13

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_runtimes_versions.md", "range": {"start": {"line": 13, "column": 31}}}, "severity": "ERROR"}
{{- end -}}
{{- end -}}

{{- if .accepted -}}
{{- $output = printf "%s\n### Accepted version(s)\n" $output -}}
{{- range .accepted -}}
{{- $output = printf "%s- %s\n" $output . -}}
{{- end -}}
{{- end -}}

{{- if .eol_source -}}
{{- $output = printf "%s\nCheck the [end-of-life (EOL)](%s) status of these versions." $output .eol_source -}}
{{- end -}}
{{- end -}}

{{- $content = replace $content $runtimeFound $output -}}

Check failure on line 29 in layouts/partials/markdown/include_runtimes_versions.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_runtimes_versions.md#L29

[Vale.Spelling] Did you really mean 'runtimeFound'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'runtimeFound'?", "location": {"path": "layouts/partials/markdown/include_runtimes_versions.md", "range": {"start": {"line": 29, "column": 38}}}, "severity": "ERROR"}
{{- end -}}

{{- return $content -}}
13 changes: 13 additions & 0 deletions layouts/partials/markdown/include_shortcode_content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- $content := . -}}
{{- $patternSearch := "\\{\\{%\\s*content/([^%}]+)\\s*%\\}\\}" -}}

Check failure on line 2 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L2

[Vale.Spelling] Did you really mean 'patternSearch'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'patternSearch'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 2, "column": 6}}}, "severity": "ERROR"}
{{- $patternClean := "\\{\\{%\\s*content/(.+?)\\s*%\\}\\}" -}}

Check failure on line 3 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L3

[Vale.Spelling] Did you really mean 'patternClean'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'patternClean'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 3, "column": 6}}}, "severity": "ERROR"}

{{- range $shortcodeFound := findRE $patternSearch $content -}}

Check failure on line 5 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L5

[Vale.Spelling] Did you really mean 'patternSearch'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'patternSearch'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 5, "column": 38}}}, "severity": "ERROR"}
{{- $name := replaceRE $patternClean "$1" $shortcodeFound -}}

Check failure on line 6 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L6

[Vale.Spelling] Did you really mean 'patternClean'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'patternClean'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 6, "column": 29}}}, "severity": "ERROR"}
{{- $filepath := printf "layouts/shortcodes/content/%s.md" $name -}}

Check warning on line 7 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L7

[Google.WordList] Use 'path' instead of 'filepath'.
Raw output
{"message": "[Google.WordList] Use 'path' instead of 'filepath'.", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 7, "column": 10}}}, "severity": "WARNING"}

Check failure on line 7 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L7

[Vale.Spelling] Did you really mean 'filepath'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'filepath'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 7, "column": 10}}}, "severity": "ERROR"}

Check failure on line 7 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L7

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 7, "column": 22}}}, "severity": "ERROR"}
{{- with os.ReadFile $filepath -}}

Check failure on line 8 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L8

[Google.Spacing] 's.R' should have one space.
Raw output
{"message": "[Google.Spacing] 's.R' should have one space.", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 8, "column": 15}}}, "severity": "ERROR"}

Check warning on line 8 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L8

[Google.WordList] Use 'path' instead of 'filepath'.
Raw output
{"message": "[Google.WordList] Use 'path' instead of 'filepath'.", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 8, "column": 27}}}, "severity": "WARNING"}

Check failure on line 8 in layouts/partials/markdown/include_shortcode_content.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_shortcode_content.md#L8

[Vale.Spelling] Did you really mean 'filepath'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'filepath'?", "location": {"path": "layouts/partials/markdown/include_shortcode_content.md", "range": {"start": {"line": 8, "column": 27}}}, "severity": "ERROR"}
{{- $content = replace $content $shortcodeFound . -}}
{{- end -}}
{{- end -}}

{{- return $content -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- $content := . -}}
{{- $versionsPattern := "\\{\\{<\\s*software_versions_shared_dedicated\\s+([^>]+)\\s*>\\}\\}" -}}

Check failure on line 2 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L2

[Vale.Spelling] Did you really mean 'versionsPattern'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'versionsPattern'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 2, "column": 6}}}, "severity": "ERROR"}

{{- range $versionFound := findRE $versionsPattern $content -}}

Check failure on line 4 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L4

[Vale.Spelling] Did you really mean 'versionFound'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'versionFound'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 4, "column": 12}}}, "severity": "ERROR"}

Check failure on line 4 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L4

[Vale.Spelling] Did you really mean 'versionsPattern'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'versionsPattern'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 4, "column": 36}}}, "severity": "ERROR"}
{{- $dbname := replaceRE $versionsPattern "$1" $versionFound -}}

Check failure on line 5 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L5

[Vale.Spelling] Did you really mean 'dbname'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'dbname'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 5, "column": 10}}}, "severity": "ERROR"}

Check failure on line 5 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L5

[Vale.Spelling] Did you really mean 'versionsPattern'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'versionsPattern'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 5, "column": 31}}}, "severity": "ERROR"}
{{- $versions := index site.Data.software_versions_shared_dedicated $dbname -}}

Check failure on line 6 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L6

[Google.Spacing] 'e.D' should have one space.
Raw output
{"message": "[Google.Spacing] 'e.D' should have one space.", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 6, "column": 31}}}, "severity": "ERROR"}

Check failure on line 6 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L6

[Vale.Spelling] Did you really mean 'dbname'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'dbname'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 6, "column": 74}}}, "severity": "ERROR"}
{{- $output := "### Regular versions\n" -}}
{{- with $versions.dedicated -}}
{{- range . -}}
{{- $output = printf "%s- %s\n" $output . -}}

Check failure on line 10 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L10

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 10, "column": 27}}}, "severity": "ERROR"}
{{- end -}}
{{- end -}}
{{- if $versions.dev -}}
{{- $output = printf "%s\n### DEV plan\n" $output -}}

Check failure on line 14 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L14

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 14, "column": 23}}}, "severity": "ERROR"}

Check notice on line 14 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L14

[Google.Acronyms] Spell out 'DEV', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'DEV', if it's unfamiliar to the audience.", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 14, "column": 39}}}, "severity": "INFO"}
{{- range $versions.dev -}}
{{- $output = printf "%s- %s\n" $output . -}}

Check failure on line 16 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L16

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 16, "column": 27}}}, "severity": "ERROR"}
{{- end -}}
{{- $output = printf "%s\n%s" $output site.Data.software_versions_shared_dedicated.dev_message -}}

Check failure on line 18 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L18

[Vale.Spelling] Did you really mean 'printf'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'printf'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 18, "column": 23}}}, "severity": "ERROR"}

Check failure on line 18 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L18

[Google.Spacing] 'e.D' should have one space.
Raw output
{"message": "[Google.Spacing] 'e.D' should have one space.", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 18, "column": 50}}}, "severity": "ERROR"}
{{- end -}}
{{- $content = replace $content $versionFound $output -}}

Check failure on line 20 in layouts/partials/markdown/include_software_versions_shared_dedicated.md

View workflow job for this annotation

GitHub Actions / vale

[vale] layouts/partials/markdown/include_software_versions_shared_dedicated.md#L20

[Vale.Spelling] Did you really mean 'versionFound'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'versionFound'?", "location": {"path": "layouts/partials/markdown/include_software_versions_shared_dedicated.md", "range": {"start": {"line": 20, "column": 38}}}, "severity": "ERROR"}
{{- end -}}

{{- return $content -}}

0 comments on commit 431f39b

Please sign in to comment.