diff --git a/Gemfile b/Gemfile index 6a290ee..d704cfe 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,8 @@ # A sample Gemfile source 'https://rubygems.org' -gem 'nanoc', git: 'https://github.com/werthen/nanoc.git', branch: 'add-resources-to-ilinks-check' +# gem 'nanoc', git: 'https://github.com/werthen/nanoc.git', branch: 'add-resources-to-ilinks-check' +gem 'nanoc', '4.2.2' gem 'kramdown' gem 'coffee-script' # Needed for relativize_urls diff --git a/Gemfile.lock b/Gemfile.lock index ce37b08..defa644 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,3 @@ -GIT - remote: https://github.com/werthen/nanoc.git - revision: bd3235d8dbae71c5bf0328ba4630070c53a5d3f4 - branch: add-resources-to-ilinks-check - specs: - nanoc (4.2.3) - cri (~> 2.3) - hamster (~> 3.0) - ref (~> 2.0) - GEM remote: https://rubygems.org/ specs: @@ -23,7 +13,7 @@ GEM cri (2.7.0) colored (~> 1.2) execjs (2.7.0) - ffi (1.9.10) + ffi (1.9.14) formatador (0.2.5) guard (2.14.0) formatador (>= 0.2.4) @@ -42,7 +32,7 @@ GEM hamster (3.0.0) concurrent-ruby (~> 1.0) json (2.0.1) - kramdown (1.10.0) + kramdown (1.11.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -50,6 +40,9 @@ GEM lumberjack (1.0.10) method_source (0.8.2) mini_portile2 (2.1.0) + nanoc (4.2.2) + cri (~> 2.3) + hamster (~> 3.0) nenv (0.3.0) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) @@ -58,15 +51,14 @@ GEM nenv (~> 0.1) shellany (~> 0.0) pkg-config (1.1.7) - pry (0.10.3) + pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - rack (1.6.4) + rack (2.0.1) rb-fsevent (0.9.7) rb-inotify (0.9.7) ffi (>= 0.5.0) - ref (2.0.0) ruby_dep (1.3.1) sass (3.4.22) shellany (0.0.1) @@ -84,7 +76,7 @@ DEPENDENCIES coffee-script guard-nanoc kramdown - nanoc! + nanoc (= 4.2.2) nokogiri sass w3c_validators diff --git a/Rules b/Rules index 50ba791..69eb3ba 100644 --- a/Rules +++ b/Rules @@ -5,7 +5,7 @@ require 'json' preprocess do # Tag all posts with 'article' - @items.find_all('/posts/**/*.md').each do |i| + @items.find_all('/posts/**/*').each do |i| i.attributes[:kind] = 'article' end @@ -34,7 +34,7 @@ compile '/assets/stylesheets/**/*.scss' do end # Compile all posts -compile '/posts/**/*.md' do +compile '/posts/**/*' do filter :kramdown layout '/eventpost.*' @@ -44,6 +44,11 @@ compile '/posts/**/*.md' do filter :relativize_paths, type: :html end +compile '/posts/**/*', rep: :text do + filter :kramdown + filter :strip_html +end + route '/index.*' do '/index.html' end @@ -69,7 +74,7 @@ postprocess do { title: e[:title], url: url_for(e), - text: '', + text: e.reps[:text].compiled_content, tags: '' } end diff --git a/lib/strip_filter.rb b/lib/strip_filter.rb new file mode 100644 index 0000000..21252a9 --- /dev/null +++ b/lib/strip_filter.rb @@ -0,0 +1,9 @@ +include Nanoc::Helpers::Text + +class StripFilter < Nanoc::Filter + identifier :strip_html + + def run(content, _params = {}) + strip_html(content) + end +end