From c156f95d4b5e84a93fcaa54346ac3a7dab59cf28 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Wed, 4 Oct 2017 13:47:54 -0600 Subject: [PATCH] Add JavaScript parser plugin --- Gemfile | 6 +++++- _config.yml | 1 + _plugins/convert_javascript.rb | 29 +++++++++++++++++++++++++++++ _posts/2017-10-02-first-drawing.js | 2 ++ _posts/2017-10-02-first-post.md | 11 ----------- 5 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 _plugins/convert_javascript.rb create mode 100644 _posts/2017-10-02-first-drawing.js delete mode 100644 _posts/2017-10-02-first-post.md diff --git a/Gemfile b/Gemfile index 8fc4507..b84b896 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,8 @@ source 'https://rubygems.org' -gem 'github-pages', group: :jekyll_plugins gem "html-proofer" gem "jekyll" +group :jekyll_plugins do + gem "github-pages" + gem "jekyll-seo-tag" + gem "ruby" +end diff --git a/_config.yml b/_config.yml index d26dfe8..cf21d72 100644 --- a/_config.yml +++ b/_config.yml @@ -2,3 +2,4 @@ theme: jekyll-theme-hacker google_analytics: UA-107410166-1 plugins: - jekyll-seo-tag + - ruby diff --git a/_plugins/convert_javascript.rb b/_plugins/convert_javascript.rb new file mode 100644 index 0000000..2029423 --- /dev/null +++ b/_plugins/convert_javascript.rb @@ -0,0 +1,29 @@ +module Jekyll + class ConvertJS < Converter + safe true + priority :low + + def matches(ext) + ext =~ /^\.js$/i + end + + def output_ext(ext) + ".html" + end + + def convert(content) +#--- +#title: "First Drawing" +#date: 2017-10-02 +#categories: update +#--- +# +#My first drawing... +# +#{% include 2017-10-02-first-drawing.js %} +# +#Back... + content + end + end +end diff --git a/_posts/2017-10-02-first-drawing.js b/_posts/2017-10-02-first-drawing.js new file mode 100644 index 0000000..ea09825 --- /dev/null +++ b/_posts/2017-10-02-first-drawing.js @@ -0,0 +1,2 @@ +rect(20, 20, 150, 100); +stroke(); diff --git a/_posts/2017-10-02-first-post.md b/_posts/2017-10-02-first-post.md deleted file mode 100644 index bc8e409..0000000 --- a/_posts/2017-10-02-first-post.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "First Post" -date: 2017-10-02 -categories: update ---- - -My first drawing... - -{% include drawing.html %} - -Back...