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

Add the ability to pull in docs from valkey-doc #22

Merged
merged 2 commits into from
Apr 10, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/deply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
mkdir _data/commands _includes/commands
ln -s $(pwd)/_submodules/valkey/src/commands $(pwd)/_data/commands/latest
ln -s $(pwd)/_submodules/valkey-doc/commands $(pwd)/_includes/commands/latest
ln -s $(pwd)/_submodules/valkey-doc/docs $(pwd)/_includes/docs
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ _site
vendor
.DS_Store
/_data/commands/
/_includes/commands/
/_includes/commands/
/_includes/docs/
1 change: 1 addition & 0 deletions _includes/docs
29 changes: 29 additions & 0 deletions _layouts/doc-import.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
layout: default
---
{%- assign primary_title = page.primary_title -%}
{%- comment -%}
This template pulls in the file from `source` in the front matter.

It detects if the script starts with front matter (delimited by `---`) by splitting and looking for the delimiter at the start of the file.
If the delimter is detected at the top of the file, it skips the the 3rd (zero based: 2) element and iterates over the remain sections.
If there delmiter is not detected (no front matter) it swallows the the whole file and markdownify's it.

{%- endcomment -%}
{%- capture md -%}{% include {{ page.source }} %}{%- endcapture -%}
{%- assign stripped_front_matter = md | split: "---" -%}
{%- include page_title.html -%}
<div class="width-limiter">
<main class="container">
{%- if stripped_front_matter[0].size == 0 -%}
{%- for item in stripped_front_matter offset:2 -%}
{{ item | markdownify }}
{%- if forloop.last == false -%}
<hr />
{%- endif -%}
{%- endfor -%}
{%- else -%}
{{ md | markdownify }}
{%- endif -%}
</main>
</div>
5 changes: 5 additions & 0 deletions docs/management/persistence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
layout: doc-import
primary_title: Persistence
source: "/docs/management/persistence.md"
---