From 6770c67c1e0adce85c9daacdd10f34dcc9acfb65 Mon Sep 17 00:00:00 2001 From: "Kyle J. Davis" Date: Fri, 24 May 2024 14:12:10 -0600 Subject: [PATCH 1/3] fixes an issue with markdown link regex, adds alias for commands Signed-off-by: Kyle J. Davis --- config.toml | 1 + content/commands/_index.md | 3 +++ templates/macros/docs.html | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/config.toml b/config.toml index c1d8557..6181a34 100644 --- a/config.toml +++ b/config.toml @@ -13,4 +13,5 @@ command_json_path = "../build-command-json/" doc_topic_path = "../build-topics/" review_list = [ + "/docs/topics/admin/" ] diff --git a/content/commands/_index.md b/content/commands/_index.md index 2870f1c..873b371 100644 --- a/content/commands/_index.md +++ b/content/commands/_index.md @@ -2,4 +2,7 @@ title = "Commands" template = "commands.html" page_template = "command-page.html" +aliases= [ + "/docs/topics/commands/" +] +++ \ No newline at end of file diff --git a/templates/macros/docs.html b/templates/macros/docs.html index 85909ab..0ad5fa4 100644 --- a/templates/macros/docs.html +++ b/templates/macros/docs.html @@ -21,10 +21,11 @@ {%- macro fix_links(content) -%} {{ content - | regex_replace(pattern=`\]\((?P.*?).png\)`, rep=`](/docs/topics/$fname.png)`) - | regex_replace(pattern=`\]\(\.\./commands/(?P.*?).md\)`, rep=`](/commands/$fname)`) - | regex_replace(pattern=`\]\(\.\./commands/#(?P.*?)\)`, rep=`](/commands/#$hash)`) - | regex_replace(pattern=`\]\((?P.*?).md\)`, rep=`](/docs/topics/$fname)`) - | regex_replace(pattern=`\]\((?P.*?).md#(?P.*?)\)`, rep=`](docs/topics/$fname#$hash)`) + | regex_replace(pattern=`\]\((?P.*?)\w.png\)`, rep=`](/docs/topics/$fname.png)`) + | regex_replace(pattern=`\]\(\.\./commands/(?P\w.*?)(.md)?\)`, rep=`](/commands/$fname)`) + | regex_replace(pattern=`\]\(\.\./commands/#(?P\w.*?)\)`, rep=`](/commands/#$hash)`) + | regex_replace(pattern=`\]\((?P\w.*?)(.md)?#(?P.*?)\)`, rep=`](/docs/topics/$fname#$hash)`) + | regex_replace(pattern=`\]\((?P\w.*?)(.md)?\)`, rep=`](/docs/topics/$fname)`) + | regex_replace(pattern=`\]\(\/docs\/topics/http\:`, rep=`](http:`) }} {%- endmacro fix_links -%} From 6a95e30be5c882dfa77a78822bb6bf6f30f786ba Mon Sep 17 00:00:00 2001 From: "Kyle J. Davis" Date: Fri, 24 May 2024 14:13:15 -0600 Subject: [PATCH 2/3] remove accidental review_list entry Signed-off-by: Kyle J. Davis --- config.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/config.toml b/config.toml index 6181a34..c1d8557 100644 --- a/config.toml +++ b/config.toml @@ -13,5 +13,4 @@ command_json_path = "../build-command-json/" doc_topic_path = "../build-topics/" review_list = [ - "/docs/topics/admin/" ] From 37372b19a4c639efe61c3eb14f55430071af6d9c Mon Sep 17 00:00:00 2001 From: "Kyle J. Davis" Date: Fri, 31 May 2024 13:58:45 -0600 Subject: [PATCH 3/3] fixes URL rewriter, adds page surpressor, adds gif support Signed-off-by: Kyle J. Davis --- build/init-topics.sh | 2 +- config.toml | 40 ++++++++++++++++++++++++++++++++++++++ templates/docs-page.html | 6 +++++- templates/macros/docs.html | 16 +++++++++++---- 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/build/init-topics.sh b/build/init-topics.sh index 9e98c16..05c3c21 100755 --- a/build/init-topics.sh +++ b/build/init-topics.sh @@ -33,7 +33,7 @@ done echo "Topic stub files created." -for fname in $(find $1 -maxdepth 1 -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg") +for fname in $(find $1 -maxdepth 1 -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.gif") do base=${fname##*/} cp ${fname} ./content/docs/topics/${base} diff --git a/config.toml b/config.toml index c1d8557..261232b 100644 --- a/config.toml +++ b/config.toml @@ -7,10 +7,50 @@ build_search_index = true [markdown] highlight_code = true +# This is included to override any differences slugs and documentation source filenames +[extra.slug_source_exceptions] +"valkey-conf" = "valkey.conf" + [extra] command_description_path = "../build-command-docs/" command_json_path = "../build-command-json/" doc_topic_path = "../build-topics/" review_list = [ + "/docs/topics/license/", + "/docs/topics/admin/", + "/docs/topics/distlock/", + "/docs/topics/eval-intro/", + "/docs/topics/faq/", + "/docs/topics/functions-intro/", + "/docs/topics/hashes/", + "/docs/topics/internals-eventlib/", + "/docs/topics/internals-vm/", + "/docs/topics/internals/", + "/docs/topics/latency/", + "/docs/topics/lua-api/", + "/docs/topics/modules-blocking-ops/", + "/docs/topics/modules-intro/", + "/docs/topics/pipelining/", + "/docs/topics/programmability/", + "/docs/topics/protocol/", + "/docs/topics/pubsub/", + "/docs/topics/rdd/", + "/docs/topics/replication/", + "/docs/topics/security/", + "/docs/topics/sentinel-clients/", + "/docs/topics/sentinel/", + "/docs/topics/transactions/", + "/docs/topics/cluster-spec/", + "/docs/topics/history/" ] + +publish_hold = [ + "/docs/topics/protocol/", + "/docs/topics/license/", + "/docs/topics/internals-eventlib/", + "/docs/topics/internals-vm/", + "/docs/topics/internals/", + "/docs/topics/protocol/", + "/docs/topics/rdd/" +] \ No newline at end of file diff --git a/templates/docs-page.html b/templates/docs-page.html index 02ee222..e19c999 100644 --- a/templates/docs-page.html +++ b/templates/docs-page.html @@ -33,5 +33,9 @@

{{ frontmatter_title }}


{% endif %} {%- set content_with_fixed_links = docs::fix_links(content= page_contents) -%} -{{ content_with_fixed_links | markdown | safe }} +{% if config.extra.publish_hold is containing(page.path) %} +

{{ page.path }} may be available after revisions.

+{% else %} + {{ content_with_fixed_links | markdown | safe }} +{% endif %} {% endblock main_content %} \ No newline at end of file diff --git a/templates/macros/docs.html b/templates/macros/docs.html index 0ad5fa4..0ee54ab 100644 --- a/templates/macros/docs.html +++ b/templates/macros/docs.html @@ -1,5 +1,8 @@ {%- macro load(slug) -%} {%- set topic_path = config.extra.doc_topic_path -%} +{%- if slug in config.extra.slug_source_exceptions -%} + {%- set slug = config.extra.slug_source_exceptions[slug] -%} +{%- endif -%} {%- set markdown_content = load_data(path= topic_path ~ "/" ~ slug ~ ".md", required= false) -%} {%- if markdown_content -%}{{ markdown_content }}{% endif %} {% endmacro load_doc %} @@ -21,11 +24,16 @@ {%- macro fix_links(content) -%} {{ content - | regex_replace(pattern=`\]\((?P.*?)\w.png\)`, rep=`](/docs/topics/$fname.png)`) - | regex_replace(pattern=`\]\(\.\./commands/(?P\w.*?)(.md)?\)`, rep=`](/commands/$fname)`) + | regex_replace(pattern=`\]\(#(?P.*?\))`, rep=`](--$hash`) + | regex_replace(pattern=`\]\((?Phttpsd?:\/\/.*?\))`, rep=`](-$url`) + | regex_replace(pattern=`\]\(\.\./commands/(?P\w.*?)(.md)?#(?P.*?)\)`, rep=`](/commands/$fname#$hash)`) + | regex_replace(pattern=`\]\(\.\./commands/(?P\w.*?)(.md)?\)`, rep=`](/commands/$fname)`) | regex_replace(pattern=`\]\(\.\./commands/#(?P\w.*?)\)`, rep=`](/commands/#$hash)`) | regex_replace(pattern=`\]\((?P\w.*?)(.md)?#(?P.*?)\)`, rep=`](/docs/topics/$fname#$hash)`) + | regex_replace(pattern=`\]\((?P.*?).png\)`, rep=`](/docs/topics/$fname.png)`) + | regex_replace(pattern=`\]\((?P.*?).gif\)`, rep=`](/docs/topics/$fname.gif)`) | regex_replace(pattern=`\]\((?P\w.*?)(.md)?\)`, rep=`](/docs/topics/$fname)`) - | regex_replace(pattern=`\]\(\/docs\/topics/http\:`, rep=`](http:`) - }} + | regex_replace(pattern=`\]\(\-(?Phttps?:\/\/.*?\))`, rep=`]($url`) + | regex_replace(pattern=`\]\(\--(?P.*?\))`, rep=`](#$hash`) +}} {%- endmacro fix_links -%}