working search in a very awkward place

This commit is contained in:
Lorin Werthen 2016-07-20 17:52:56 +02:00
parent bce47ca93b
commit a9374438f9
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
4 changed files with 27 additions and 20 deletions

View file

@ -2,7 +2,8 @@
# A sample Gemfile # A sample Gemfile
source 'https://rubygems.org' 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 'kramdown'
gem 'coffee-script' gem 'coffee-script'
# Needed for relativize_urls # Needed for relativize_urls

View file

@ -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 GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
@ -23,7 +13,7 @@ GEM
cri (2.7.0) cri (2.7.0)
colored (~> 1.2) colored (~> 1.2)
execjs (2.7.0) execjs (2.7.0)
ffi (1.9.10) ffi (1.9.14)
formatador (0.2.5) formatador (0.2.5)
guard (2.14.0) guard (2.14.0)
formatador (>= 0.2.4) formatador (>= 0.2.4)
@ -42,7 +32,7 @@ GEM
hamster (3.0.0) hamster (3.0.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
json (2.0.1) json (2.0.1)
kramdown (1.10.0) kramdown (1.11.1)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
@ -50,6 +40,9 @@ GEM
lumberjack (1.0.10) lumberjack (1.0.10)
method_source (0.8.2) method_source (0.8.2)
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
nanoc (4.2.2)
cri (~> 2.3)
hamster (~> 3.0)
nenv (0.3.0) nenv (0.3.0)
nokogiri (1.6.8) nokogiri (1.6.8)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
@ -58,15 +51,14 @@ GEM
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
pkg-config (1.1.7) pkg-config (1.1.7)
pry (0.10.3) pry (0.10.4)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
slop (~> 3.4) slop (~> 3.4)
rack (1.6.4) rack (2.0.1)
rb-fsevent (0.9.7) rb-fsevent (0.9.7)
rb-inotify (0.9.7) rb-inotify (0.9.7)
ffi (>= 0.5.0) ffi (>= 0.5.0)
ref (2.0.0)
ruby_dep (1.3.1) ruby_dep (1.3.1)
sass (3.4.22) sass (3.4.22)
shellany (0.0.1) shellany (0.0.1)
@ -84,7 +76,7 @@ DEPENDENCIES
coffee-script coffee-script
guard-nanoc guard-nanoc
kramdown kramdown
nanoc! nanoc (= 4.2.2)
nokogiri nokogiri
sass sass
w3c_validators w3c_validators

11
Rules
View file

@ -5,7 +5,7 @@ require 'json'
preprocess do preprocess do
# Tag all posts with 'article' # Tag all posts with 'article'
@items.find_all('/posts/**/*.md').each do |i| @items.find_all('/posts/**/*').each do |i|
i.attributes[:kind] = 'article' i.attributes[:kind] = 'article'
end end
@ -34,7 +34,7 @@ compile '/assets/stylesheets/**/*.scss' do
end end
# Compile all posts # Compile all posts
compile '/posts/**/*.md' do compile '/posts/**/*' do
filter :kramdown filter :kramdown
layout '/eventpost.*' layout '/eventpost.*'
@ -44,6 +44,11 @@ compile '/posts/**/*.md' do
filter :relativize_paths, type: :html filter :relativize_paths, type: :html
end end
compile '/posts/**/*', rep: :text do
filter :kramdown
filter :strip_html
end
route '/index.*' do route '/index.*' do
'/index.html' '/index.html'
end end
@ -69,7 +74,7 @@ postprocess do
{ {
title: e[:title], title: e[:title],
url: url_for(e), url: url_for(e),
text: '', text: e.reps[:text].compiled_content,
tags: '' tags: ''
} }
end end

9
lib/strip_filter.rb Normal file
View file

@ -0,0 +1,9 @@
include Nanoc::Helpers::Text
class StripFilter < Nanoc::Filter
identifier :strip_html
def run(content, _params = {})
strip_html(content)
end
end