From 5a1c4f0ae624c71e48b29e19217437fad3a6bbde Mon Sep 17 00:00:00 2001 From: "Kyle J. Davis" Date: Wed, 27 Nov 2024 09:42:48 -0700 Subject: [PATCH 1/2] Removes 'Valkey ' from doc titles Signed-off-by: Kyle J. Davis --- templates/docs-page.html | 2 +- templates/docs.html | 3 ++- templates/macros/docs.html | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/templates/docs-page.html b/templates/docs-page.html index a56ac01..2bd6fc8 100644 --- a/templates/docs-page.html +++ b/templates/docs-page.html @@ -21,7 +21,7 @@ {% block subhead_content %} {% if has_frontmatter and frontmatter_title %} -

Documentation: {{ frontmatter_title }}

+

Documentation: {{ docs::remove_valkey_title(title= frontmatter_title) }}

{% endif %} {% endblock subhead_content %} diff --git a/templates/docs.html b/templates/docs.html index 7c73230..10176c3 100644 --- a/templates/docs.html +++ b/templates/docs.html @@ -33,8 +33,9 @@

Alphabetical Index

{% set frontmatter_data = load_data(literal= frontmatter, format="yaml") %} {% set description = frontmatter_data.description | escape | safe %} {% set description_no_line_breaks = description | regex_replace(pattern=`[\u0000-\u001F]`, rep=` `) %} + {% set title= docs::remove_valkey_title(title= frontmatter_data.title) %} - {% set_global list = list | concat(with= ['{ "title" : "' ~ frontmatter_data.title ~ '", "path" : "' ~ page.path ~ '", "description" : "' ~ description_no_line_breaks ~ '" }']) %} + {% set_global list = list | concat(with= ['{ "title" : "' ~ title ~ '", "path" : "' ~ page.path ~ '", "description" : "' ~ description_no_line_breaks ~ '" }']) %} {% endif %} diff --git a/templates/macros/docs.html b/templates/macros/docs.html index f597381..4cee8df 100644 --- a/templates/macros/docs.html +++ b/templates/macros/docs.html @@ -7,6 +7,21 @@ {%- if markdown_content -%}{{ markdown_content }}{% endif %} {% endmacro load_doc %} +{%- macro remove_valkey_title(title) -%} +{%- if title is starting_with("Valkey") -%} +{%- set noValkey = title | replace(from="Valkey ", to="") -%} +{%- for letter in noValkey -%} + {%- if loop.index == 1 -%} + {{ letter | upper }} + {%- else -%} + {{ letter }} + {%- endif -%} +{%- endfor -%} +{%- else -%} +{{ title }} +{%- endif -%} +{%- endmacro remove_valkey_title -%} + {%- macro extract_frontmatter(content) %} {%- set markdown_split = content | split(pat="---") -%} {%- set markdown_part_count = markdown_split | length() -%} From e152e406c8f110e797836259cb07f5d8aeb2f237 Mon Sep 17 00:00:00 2001 From: "Kyle J. Davis" Date: Wed, 27 Nov 2024 10:09:22 -0700 Subject: [PATCH 2/2] fixes title Signed-off-by: Kyle J. Davis --- templates/docs-page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docs-page.html b/templates/docs-page.html index 2bd6fc8..7cd2db5 100644 --- a/templates/docs-page.html +++ b/templates/docs-page.html @@ -12,7 +12,7 @@ {% set has_frontmatter = true %} {% set page_contents = docs::extract_markdown(content= docs_file_contents) %} {% if frontmatter_data.title %} - {% set frontmatter_title = frontmatter_data.title %} + {% set frontmatter_title = docs::remove_valkey_title(title= frontmatter_data.title) %} {% endif %} {% else %} {% set page_contents = docs_file_contents %}