aboutsummaryrefslogtreecommitdiff
path: root/_plugins
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-10-10 19:29:58 -0300
committerEuAndreh <eu@euandre.org>2020-10-10 19:30:12 -0300
commitd37970ccd647b89a790c0944611f3e3be1f05eaf (patch)
tree3e19e8b77ddee7a3c3db057bcc75568e212efecb /_plugins
parentFix home page entry listing (diff)
downloadeuandre.org-d37970ccd647b89a790c0944611f3e3be1f05eaf.tar.gz
euandre.org-d37970ccd647b89a790c0944611f3e3be1f05eaf.tar.xz
Use Jekyll to output slides HTML files
Diffstat (limited to '')
-rw-r--r--_plugins/add-anchor-to-code-block-line-numbers.rb2
-rw-r--r--_plugins/add-anchor-to-header-from-header-id.rb2
-rw-r--r--_plugins/add-link-to-plaintext-code-block.rb2
-rw-r--r--_plugins/generate-pastebin-plaintext-alternate.rb14
-rw-r--r--_plugins/noop-converter.rb18
5 files changed, 29 insertions, 9 deletions
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