From 76ef5ce5efaad066b847977e66912ec00bb1ccad Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sat, 27 May 2017 14:24:01 +0200 Subject: [PATCH] Add parameter to exclude headings from linking. Signed-off-by: Thomas Hochstein --- _doc/dejure/CHANGELOG.md | 1 + _doc/dejure/README.md | 4 ++++ lib/filters/dejure.rb | 14 ++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/_doc/dejure/CHANGELOG.md b/_doc/dejure/CHANGELOG.md index 783def8..fa23217 100644 --- a/_doc/dejure/CHANGELOG.md +++ b/_doc/dejure/CHANGELOG.md @@ -4,6 +4,7 @@ ### Version 1.1-beta (unreleased) +* Add option to exclude headings from link generation. * Fix markdown errors in changelog. ### Version 1.0 (2017-05-25) diff --git a/_doc/dejure/README.md b/_doc/dejure/README.md index f3da1bf..8b2bed3 100644 --- a/_doc/dejure/README.md +++ b/_doc/dejure/README.md @@ -41,6 +41,10 @@ This filter accepts the following parameters: *dejure.org* will get a link to the *buzer.de* legal information service, covering all of the German Federal Law. +* `noheadings` (`0` or `1`, Default: `0`) + If set to `true` (`1`) no links will be added to headings + (i.e. `

` to `` elements). + * `target` (Default: `''`) Add this to the `target` attribute of the `` elements that are generated by the API, e.g. ``. diff --git a/lib/filters/dejure.rb b/lib/filters/dejure.rb index dff98bf..7021e78 100644 --- a/lib/filters/dejure.rb +++ b/lib/filters/dejure.rb @@ -27,11 +27,12 @@ # # # params may be set as follows: -# params[:format] -> [weit|schmal] (weit) -# params[:buzer] -> fallback to buzer.de? (1) -# params[:target] -> target for ('') -# params[:class] -> CSS class for ('') -# params[:cache_days] -> cache validity in days (7) +# params[:format] -> [weit|schmal] (weit) +# params[:buzer] -> fallback to buzer.de? (1) +# params[:noheadings] -> exclude headings from linker (0) +# params[:target] -> target for ('') +# params[:class] -> CSS class for ('') +# params[:cache_days] -> cache validity in days (7) require 'net/http' require 'digest' @@ -70,10 +71,11 @@ module Nanoc::Filters if !@config[:base_url].nil? params[:Anbieterkennung] = @config[:base_url] else - params[:Anbieterkennung] = 'http://unknown.nanoc.installation.invalid' + params[:Anbieterkennung] = 'http://unknown.nanoc.installation.invalid' end params[:format] ||= 'weit' params[:buzer] ||= 1 + params[:ohnehtags] = params.delete(:noheadings) return params end