Add parameter to exclude headings from linking.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2017-05-27 14:24:01 +02:00
parent 1e3c716f14
commit 76ef5ce5ef
3 changed files with 13 additions and 6 deletions

View file

@ -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)

View file

@ -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. `<h1>` to `<h9>` elements).
* `target` (Default: `''`)
Add this to the `target` attribute of the `<a>` elements that are
generated by the API, e.g. `<a href="..." target="_blank">`.

View file

@ -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 <a href> ('')
# params[:class] -> CSS class for <a href> ('')
# 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 <a href> ('')
# params[:class] -> CSS class for <a href> ('')
# 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