Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra valkey in title #169

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/docs-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -21,7 +21,7 @@

{% block subhead_content %}
{% if has_frontmatter and frontmatter_title %}
<h1 class="page-title">Documentation: {{ frontmatter_title }}</h1>
<h1 class="page-title">Documentation: {{ docs::remove_valkey_title(title= frontmatter_title) }}</h1>
{% endif %}
{% endblock subhead_content %}

Expand Down
3 changes: 2 additions & 1 deletion templates/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ <h2>Alphabetical Index</h2>
{% 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 %}


Expand Down
15 changes: 15 additions & 0 deletions templates/macros/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -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() -%}
Expand Down