From 864a89104bd444fbebb9dcbe3ed853c28f8b21e7 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Tue, 20 Sep 2022 17:34:19 -0700 Subject: Fix index generation when all pages in a section are drafts, closes #93 --- content/overview-abridge.md | 1 + content/overview-code-blocks.md | 1 + content/overview-embedded-vimeo.md | 1 + content/overview-embedded-youtube.md | 1 + content/overview-images/index.md | 1 + content/overview-markdown-and-style.md | 1 + content/overview-math.md | 2 ++ content/overview-rich-content/index.md | 1 + content/pages/about.md | 1 + content/pages/contact.md | 1 + content/pages/privacy.md | 1 + static/stork.st | Bin 299211 -> 270439 bytes static/stork.wasm | Bin 345812 -> 345812 bytes static/tinysearch_engine.d.ts | 8 +++++--- static/tinysearch_engine.js | 7 +++++-- static/tinysearch_engine_bg.wasm | Bin 97453 -> 93153 bytes templates/macros/create_stork_toml.html | 5 +++-- templates/macros/create_tinysearch_json.html | 5 +++-- 18 files changed, 28 insertions(+), 9 deletions(-) diff --git a/content/overview-abridge.md b/content/overview-abridge.md index e1bff37..cd00764 100644 --- a/content/overview-abridge.md +++ b/content/overview-abridge.md @@ -1,6 +1,7 @@ +++ title = "Abridge Zola Theme" date = 2022-05-17 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/overview-code-blocks.md b/content/overview-code-blocks.md index ee524aa..7c09e5b 100644 --- a/content/overview-code-blocks.md +++ b/content/overview-code-blocks.md @@ -2,6 +2,7 @@ title = "Code Blocks and Themes" description = "Sample article showcasing syntax highlighting and formatting for Code Blocks with a custom theme." date = 2022-05-16 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/overview-embedded-vimeo.md b/content/overview-embedded-vimeo.md index 54672c6..ed05ab7 100644 --- a/content/overview-embedded-vimeo.md +++ b/content/overview-embedded-vimeo.md @@ -2,6 +2,7 @@ title = "Embedded Vimeo Videos" description = "Sample article showcasing a custom Zola shortcode for embedding Vimeo Videos into your pages." date = 2021-05-07 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/overview-embedded-youtube.md b/content/overview-embedded-youtube.md index 5a4b22c..d364730 100644 --- a/content/overview-embedded-youtube.md +++ b/content/overview-embedded-youtube.md @@ -2,6 +2,7 @@ title = "Embedded Youtube Videos" description = "Sample article showcasing a custom Zola shortcode for embedding Youtube Videos into your pages." date = 2021-05-08 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/overview-images/index.md b/content/overview-images/index.md index f36060d..3d60a91 100644 --- a/content/overview-images/index.md +++ b/content/overview-images/index.md @@ -2,6 +2,7 @@ title = "Image Shortcodes" description = "Images can be embedded directly using markdown `![Ferris](ferris.svg)`, but using a shortcode prevents CLS by explicitly setting the width and height." date = 2021-05-19 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/overview-markdown-and-style.md b/content/overview-markdown-and-style.md index 8bc21da..befe1ed 100644 --- a/content/overview-markdown-and-style.md +++ b/content/overview-markdown-and-style.md @@ -2,6 +2,7 @@ title = "Markdown and Style Guide" description = "Sample article showcasing basic Markdown syntax and formatting for HTML elements." date = 2022-05-15 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/overview-math.md b/content/overview-math.md index 2e704da..4082c9d 100644 --- a/content/overview-math.md +++ b/content/overview-math.md @@ -3,6 +3,8 @@ title = "Mathematical Notations" description = "Sample article showcasing the display of Mathematical Notations, made possible by the KaTeX library." date = 2021-05-05 updated = 2022-01-01 +draft = false + [taxonomies] categories = ["Features"] tags = ["shortcodes","Mathematics"] diff --git a/content/overview-rich-content/index.md b/content/overview-rich-content/index.md index 39ddbfb..6e5d1b8 100644 --- a/content/overview-rich-content/index.md +++ b/content/overview-rich-content/index.md @@ -2,6 +2,7 @@ title = "Rich Content" description = "A brief description of custom Shortcodes for Zola that implement modern html elements: video, image, gif, audio." date = 2021-05-18 +draft = false [taxonomies] categories = ["Features"] diff --git a/content/pages/about.md b/content/pages/about.md index 9166981..ca00fb6 100644 --- a/content/pages/about.md +++ b/content/pages/about.md @@ -2,6 +2,7 @@ title = "About" path = "about" template = "pages.html" +draft = false +++ This site provides a demo for the [abridge theme](https://github.com/Jieiku/abridge) for [Zola](https://www.getzola.org/) the static site generator. diff --git a/content/pages/contact.md b/content/pages/contact.md index c76247c..306b360 100644 --- a/content/pages/contact.md +++ b/content/pages/contact.md @@ -3,4 +3,5 @@ title = "Contact" description = "To reach us please use the contact form on this page." path = "contact" template = "contact.html" +draft = false +++ \ No newline at end of file diff --git a/content/pages/privacy.md b/content/pages/privacy.md index 460413c..52bfc01 100644 --- a/content/pages/privacy.md +++ b/content/pages/privacy.md @@ -3,6 +3,7 @@ title = "Privacy Policy" description = "This page outlines the Privacy Policy for this site, and the date at which this policy was put into affect." path = "privacy" template = "pages.html" +draft = false +++ ## Privacy diff --git a/static/stork.st b/static/stork.st index ae5e405..0543733 100644 Binary files a/static/stork.st and b/static/stork.st differ diff --git a/static/stork.wasm b/static/stork.wasm index ce550ce..1c7b52d 100644 Binary files a/static/stork.wasm and b/static/stork.wasm differ diff --git a/static/tinysearch_engine.d.ts b/static/tinysearch_engine.d.ts index e1f9bb2..d1b37dd 100644 --- a/static/tinysearch_engine.d.ts +++ b/static/tinysearch_engine.d.ts @@ -16,14 +16,16 @@ export interface InitOutput { readonly __wbindgen_realloc: (a: number, b: number, c: number) => number; } +export type SyncInitInput = BufferSource | WebAssembly.Module; /** -* Synchronously compiles the given `bytes` and instantiates the WebAssembly module. +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. * -* @param {BufferSource} bytes +* @param {SyncInitInput} module * * @returns {InitOutput} */ -export function initSync(bytes: BufferSource): InitOutput; +export function initSync(module: SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and diff --git a/static/tinysearch_engine.js b/static/tinysearch_engine.js index 180d3d9..7fa5084 100644 --- a/static/tinysearch_engine.js +++ b/static/tinysearch_engine.js @@ -168,12 +168,15 @@ function finalizeInit(instance, module) { return wasm; } -function initSync(bytes) { +function initSync(module) { const imports = getImports(); initMemory(imports); - const module = new WebAssembly.Module(bytes); + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + const instance = new WebAssembly.Instance(module, imports); return finalizeInit(instance, module); diff --git a/static/tinysearch_engine_bg.wasm b/static/tinysearch_engine_bg.wasm index 9df2dea..90d2bb5 100644 Binary files a/static/tinysearch_engine_bg.wasm and b/static/tinysearch_engine_bg.wasm differ diff --git a/templates/macros/create_stork_toml.html b/templates/macros/create_stork_toml.html index 642b3f9..f754e2e 100644 --- a/templates/macros/create_stork_toml.html +++ b/templates/macros/create_stork_toml.html @@ -2,13 +2,14 @@ {%- set section = get_section(path=section) -%} {%- for post in section.pages -%} {%- if not post.draft %} {path = {{ '.' ~ post.path ~ 'index.html' | json_encode | safe }}, url = {{ post.permalink | json_encode | safe }}, title = {{ post.title | striptags | json_encode | safe }}} +{%- set found = true -%} {%- if not loop.last -%}, {% endif -%} {%- endif -%} {%- endfor -%} -{%- if section.subsections -%}, +{%- if found -%}{%- if section.subsections -%}, {% for subsection in section.subsections -%} {{ self::from_section(section=subsection) }} {%- endfor -%} -{%- endif -%} +{%- endif -%}{%- endif -%} {%- endmacro from_section -%} \ No newline at end of file diff --git a/templates/macros/create_tinysearch_json.html b/templates/macros/create_tinysearch_json.html index f45ed42..a28d9dc 100644 --- a/templates/macros/create_tinysearch_json.html +++ b/templates/macros/create_tinysearch_json.html @@ -2,6 +2,7 @@ {%- set section = get_section(path=section) -%} {%- for post in section.pages -%} {%- if not post.draft -%} +{%- set found = true -%} { "title": {{ post.title | striptags | json_encode | safe }}, "url": {{ post.permalink | json_encode | safe }}, @@ -17,10 +18,10 @@ {%- if not loop.last -%},{%- endif %} {%- endif -%} {%- endfor -%} -{%- if section.subsections -%} +{%- if found -%}{%- if section.subsections -%} , {%- for subsection in section.subsections -%} {{ self::from_section(section=subsection) }} {%- endfor -%} -{%- endif -%} +{%- endif -%}{%- endif -%} {%- endmacro from_section -%} \ No newline at end of file -- cgit v1.3.1