diff options
author | EuAndreh <eu@euandre.org> | 2020-08-17 13:31:54 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-17 13:31:54 -0300 |
commit | 79fee601401393772d3285e88fca903c78adc65a (patch) | |
tree | 0ec2e61834f3afe6eb177ef03f2f05136a377760 | |
parent | Generate plaintext links to raw code blocks (diff) | |
download | euandre.org-79fee601401393772d3285e88fca903c78adc65a.tar.gz euandre.org-79fee601401393772d3285e88fca903c78adc65a.tar.xz |
Filter generated plaintext files from site.json listing
-rw-r--r-- | _plugins/generate-pastebin-plaintext-alternate.rb | 4 | ||||
-rw-r--r-- | site.json | 25 |
2 files changed, 28 insertions, 1 deletions
diff --git a/_plugins/generate-pastebin-plaintext-alternate.rb b/_plugins/generate-pastebin-plaintext-alternate.rb index bf97f44..d85cacf 100644 --- a/_plugins/generate-pastebin-plaintext-alternate.rb +++ b/_plugins/generate-pastebin-plaintext-alternate.rb @@ -33,7 +33,9 @@ module Jekyll # https://github.com/jekyll/jekyll-feed/blob/c552b8ef7bd7a4babcfb5aec2b22283a5bc354dd/lib/jekyll-feed/page-without-a-file.rb#L4 class PageWithoutAFile < Jekyll::Page def read_yaml(*) - @data ||= {} + @data ||= { + "plaintext" => "true" + } end end end @@ -2,7 +2,13 @@ --- { "posts": [ + {% assign filtered_posts = "" | split:"" %} {% for post in site.posts %} + {% unless post.plaintext %} + {% assign filtered_posts = filtered_posts | push:post %} + {% endunless %} + {% endfor %} + {% for post in filtered_posts %} { "title": "{{ post.title | smartify }}", "date": "{{ post.date }}", @@ -15,19 +21,32 @@ {% endfor %} ], "pages": [ + {% assign filtered_pages = "" | split:"" %} {% for page in site.pages %} + {% unless page.plaintext %} + {% assign filtered_pages = filtered_pages | push:page %} + {% endunless %} + {% endfor %} + {% for page in filtered_pages %} { "title": "{{ page.title | smartify }}", "url": "{{ page.url }}", "lang": "{{ page.lang }}", "ref": "{{ page.ref }}", + "plaintext": "{{ page.plaintext }}", "layout": "page", "content": {{ page.content | strip_html | jsonify }} }{% unless forloop.last %},{% endunless %} {% endfor %} ], "pastebins": [ + {% assign filtered_pastebins = "" | split:"" %} {% for pastebin in site.pastebins %} + {% unless pastebin.plaintext %} + {% assign filtered_pastebins = filtered_pastebins | push:pastebin %} + {% endunless %} + {% endfor %} + {% for pastebin in filtered_pastebins %} { "title": "{{ pastebin.title | smartify }}", "date": "{{ pastebin.date }}", @@ -40,6 +59,12 @@ {% endfor %} ], "tils": [ + {% assign filtered_tils = "" | split:"" %} + {% for til in site.tils %} + {% unless til.plaintext %} + {% assign filtered_tils = filtered_tils | push:til %} + {% endunless %} + {% endfor %} {% for til in site.tils %} { "title": "{{ til.title | smartify }}", |