diff options
author | EuAndreh <eu@euandre.org> | 2020-10-10 19:29:58 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-10-10 19:30:12 -0300 |
commit | d37970ccd647b89a790c0944611f3e3be1f05eaf (patch) | |
tree | 3e19e8b77ddee7a3c3db057bcc75568e212efecb | |
parent | Fix home page entry listing (diff) | |
download | euandre.org-d37970ccd647b89a790c0944611f3e3be1f05eaf.tar.gz euandre.org-d37970ccd647b89a790c0944611f3e3be1f05eaf.tar.xz |
Use Jekyll to output slides HTML files
Diffstat (limited to '')
-rw-r--r-- | _config.yml | 1 | ||||
-rw-r--r-- | _data/slides.yml | 0 | ||||
-rw-r--r-- | _layouts/default.html | 4 | ||||
-rw-r--r-- | _layouts/slides.html | 65 | ||||
-rw-r--r-- | _plugins/add-anchor-to-code-block-line-numbers.rb | 2 | ||||
-rw-r--r-- | _plugins/add-anchor-to-header-from-header-id.rb | 2 | ||||
-rw-r--r-- | _plugins/add-link-to-plaintext-code-block.rb | 2 | ||||
-rw-r--r-- | _plugins/generate-pastebin-plaintext-alternate.rb | 14 | ||||
-rw-r--r-- | _plugins/noop-converter.rb | 18 | ||||
-rw-r--r-- | diapositives.md | 2 | ||||
-rw-r--r-- | eslaides.md | 2 | ||||
-rw-r--r-- | feed.slides.en.atom | 2 | ||||
-rw-r--r-- | feed.slides.fr.atom | 2 | ||||
-rw-r--r-- | feed.slides.pt.atom | 2 | ||||
-rw-r--r-- | site.json | 2 | ||||
-rw-r--r-- | slides.css | 3 | ||||
-rw-r--r-- | slides.md | 2 |
17 files changed, 108 insertions, 17 deletions
diff --git a/_config.yml b/_config.yml index 4508ade..b407f4f 100644 --- a/_config.yml +++ b/_config.yml @@ -44,6 +44,7 @@ collections: output: true permalink: /til/:year/:month/:day/:title:output_ext slides: + output: true permalink: /slides/:year/:month/:day/:title:output_ext t: diff --git a/_data/slides.yml b/_data/slides.yml deleted file mode 100644 index e69de29..0000000 --- a/_data/slides.yml +++ /dev/null diff --git a/_layouts/default.html b/_layouts/default.html index ea12a36..5e12682 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -4,8 +4,10 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/styles.css" /> - <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.articles.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.articles.feed.title[page.lang] }}" /> + <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.articles.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.articles.feed.title[page.lang] }}" /> + <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.pastebins.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.pastebins.feed.title[page.lang] }}" /> <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.tils.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.til.feed.title[page.lang] }}" /> + <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.slides.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.slides.feed.title[page.lang] }}" /> <title>{{ page.title }} - EuAndreh</title> <meta property="og:site_name" content="{{ site.title }}" /> diff --git a/_layouts/slides.html b/_layouts/slides.html new file mode 100644 index 0000000..839fe2a --- /dev/null +++ b/_layouts/slides.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<html lang="{{ page.lang }}"> + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> + <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.slides.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.slides.feed.title[page.lang] }}" /> + + <title>{{ page.title }} - EuAndreh</title> + + <meta property="og:site_name" content="{{ site.title }}" /> + <meta name="author" content="{{ site.author.name }}" /> + <meta property="og:locale" content="{{ page.lang }}" /> + <meta property="og:title" content="{{ page.title | xml_escape }}" /> + {% capture raw_description %} + {% if page.description %} + {{ page.description }} + {% else %} + {{ site.t.description[page.lang] }} + {% endif %} + {% endcapture %} + {% assign description = raw_description | strip_html | strip %} + <meta name="description" content="{{ description }}" /> + <meta property="og:description" content="{{ description }}" /> + + <link rel="canonical" href="{{ page.url | absolute_url }}" /> + <meta property="og:url" content="{{ page.url | absolute_url }}" /> + + <meta property="og:type" content="article" /> + <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" /> + + <link rel="stylesheet" href="/vendor/reveal.js/dist/reset.css"> + <link rel="stylesheet" href="/vendor/reveal.js/dist/reveal.css"> + <link rel="stylesheet" href="/vendor/reveal.js/dist/theme/black.css" id="theme"> + <link rel="stylesheet" href="/vendor/reveal.js/plugin/highlight/monokai.css" id="highlight-theme"> + <link rel="stylesheet" href="/slides.css"> + </head> + <body> + <div class="reveal"> + <div class="slides"> + <section data-markdown + data-separator="^---$" + data-separator-notes="^\?\?\?$"> + <textarea data-template> +{{ content }} + </textarea> + </section> + </div> + </div> + + <script src="/vendor/reveal.js/dist/reveal.js"></script> + <script src="/vendor/reveal.js/plugin/notes/notes.js"></script> + <script src="/vendor/reveal.js/plugin/markdown/markdown.js"></script> + <script src="/vendor/reveal.js/plugin/highlight/highlight.js"></script> + <script> + Reveal.initialize({ + hash: true, + controls: false, + slideNumber: "c/t", + transition: "none", + progress: false, + plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ] + }); + </script> + </body> +</html> diff --git a/_plugins/add-anchor-to-code-block-line-numbers.rb b/_plugins/add-anchor-to-code-block-line-numbers.rb index ef9f579..ec6f0a8 100644 --- a/_plugins/add-anchor-to-code-block-line-numbers.rb +++ b/_plugins/add-anchor-to-code-block-line-numbers.rb @@ -1,7 +1,7 @@ PREFIX = '<pre class="lineno">' POSTFIX = '</pre>' Jekyll::Hooks.register [:documents, :pages], :post_render do |doc| - if doc.output_ext == ".html" + if doc.output_ext == ".html" && doc.type != :slides code_block_counter = 1 doc.output = doc.output.gsub(/<pre class="lineno">[\n0-9]+<\/pre>/) do |match| line_numbers = match diff --git a/_plugins/add-anchor-to-header-from-header-id.rb b/_plugins/add-anchor-to-header-from-header-id.rb index d0df4d6..33e3ad7 100644 --- a/_plugins/add-anchor-to-header-from-header-id.rb +++ b/_plugins/add-anchor-to-header-from-header-id.rb @@ -1,5 +1,5 @@ Jekyll::Hooks.register [:documents, :pages], :post_render do |doc| - if doc.output_ext == ".html" + if doc.output_ext == ".html" && doc.type != :slides doc.output = doc.output.gsub( /<h([1-6])(.*?)id="([\w-]+)"(.*?)>(.*?)<\/h[1-6]>/, diff --git a/_plugins/add-link-to-plaintext-code-block.rb b/_plugins/add-link-to-plaintext-code-block.rb index 04fbdea..4c15d33 100644 --- a/_plugins/add-link-to-plaintext-code-block.rb +++ b/_plugins/add-link-to-plaintext-code-block.rb @@ -1,5 +1,5 @@ Jekyll::Hooks.register :documents, :post_render do |doc| - if doc.output_ext == ".html" + if doc.output_ext == ".html" && doc.type != :slides code_block_counter = 1 doc.output = doc.output.gsub(/(<\/code><\/pre><\/div><\/div>)/) do |match| res = match + diff --git a/_plugins/generate-pastebin-plaintext-alternate.rb b/_plugins/generate-pastebin-plaintext-alternate.rb index d85cacf..110a943 100644 --- a/_plugins/generate-pastebin-plaintext-alternate.rb +++ b/_plugins/generate-pastebin-plaintext-alternate.rb @@ -9,12 +9,13 @@ module Jekyll site.collections.each do |collection| _collection_name, collection_documents = collection collection_documents.docs.each do |document| - n = 1 - Renderer - .new(site, document) # create a renderer for the document - .run # generate the HTML string - .scan(CODE_BLOCK) # match all occurrences of regexp - .each do |code_block| # iterate on each match + if document.type != :slides + n = 1 + Renderer + .new(site, document) # create a renderer for the document + .run # generate the HTML string + .scan(CODE_BLOCK) # match all occurrences of regexp + .each do |code_block| # iterate on each match unhighlighted_code = code_block[0] # regexp only defines 1 match (only 1 parens) .gsub(/<span class=".*?">(.*?)<\/span>/m, '\1') content = CGI.unescapeHTML unhighlighted_code @@ -23,6 +24,7 @@ module Jekyll plain.content = content site.pages << plain n += 1 + end end end end diff --git a/_plugins/noop-converter.rb b/_plugins/noop-converter.rb new file mode 100644 index 0000000..118d103 --- /dev/null +++ b/_plugins/noop-converter.rb @@ -0,0 +1,18 @@ +module Jekyll + class NoOpConverter < Converter + safe true + priority :high + + def matches(ext) + ext == '.slides' + end + + def output_ext(ext) + ".html" + end + + def convert(content) + content + end + end +end diff --git a/diapositives.md b/diapositives.md index 4604c75..765cb51 100644 --- a/diapositives.md +++ b/diapositives.md @@ -5,4 +5,4 @@ lang: fr ref: slides --- -{% include link-listing.html entries=site.data.slides kind="slides" %} +{% include link-listing.html entries=site.slides kind="slides" %} diff --git a/eslaides.md b/eslaides.md index 22a65f6..70c24e3 100644 --- a/eslaides.md +++ b/eslaides.md @@ -5,4 +5,4 @@ lang: pt ref: slides --- -{% include link-listing.html entries=site.data.slides kind="slides" %} +{% include link-listing.html entries=site.slides kind="slides" %} diff --git a/feed.slides.en.atom b/feed.slides.en.atom index 96c6155..6874fc1 100644 --- a/feed.slides.en.atom +++ b/feed.slides.en.atom @@ -1,3 +1,3 @@ --- --- -{% include feed.atom entries=site.data.slides kind="slides" lang="en" %} +{% include feed.atom entries=site.slides kind="slides" lang="en" %} diff --git a/feed.slides.fr.atom b/feed.slides.fr.atom index 96c6155..6874fc1 100644 --- a/feed.slides.fr.atom +++ b/feed.slides.fr.atom @@ -1,3 +1,3 @@ --- --- -{% include feed.atom entries=site.data.slides kind="slides" lang="en" %} +{% include feed.atom entries=site.slides kind="slides" lang="en" %} diff --git a/feed.slides.pt.atom b/feed.slides.pt.atom index 96c6155..6874fc1 100644 --- a/feed.slides.pt.atom +++ b/feed.slides.pt.atom @@ -1,3 +1,3 @@ --- --- -{% include feed.atom entries=site.data.slides kind="slides" lang="en" %} +{% include feed.atom entries=site.slides kind="slides" lang="en" %} @@ -79,7 +79,7 @@ ], "slides": [ {% assign filtered_slides = "" | split:"" %} - {% for slide in site.data.slides %} + {% for slide in site.slides %} {% unless slide.plaintext %} {% assign filtered_slides = filtered_slides | push:slide %} {% endunless %} diff --git a/slides.css b/slides.css new file mode 100644 index 0000000..dfca9a9 --- /dev/null +++ b/slides.css @@ -0,0 +1,3 @@ +strong { + color: red; +} @@ -5,4 +5,4 @@ lang: en ref: slides --- -{% include link-listing.html entries=site.data.slides kind="slides" %} +{% include link-listing.html entries=site.slides kind="slides" %} |