Change link scheme to HTTPS.

Bump version number.
Also use symbol instead of string for 'Originaltext'.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2017-05-27 15:11:02 +02:00
parent 91bd9d7f55
commit f5aabcf276
2 changed files with 8 additions and 3 deletions

View file

@ -2,6 +2,10 @@
## 1.x branch ## 1.x branch
### Version 1.2 (unreleased)
* Create links with `https` protocol.
### Version 1.1 (2017-05-27) ### Version 1.1 (2017-05-27)
* Add option to exclude headings from link generation. * Add option to exclude headings from link generation.

View file

@ -42,7 +42,7 @@ module Nanoc::Filters
identifier :dejure identifier :dejure
type :text type :text
VERSION = '1.1' VERSION = '1.2-beta'
CACHEDIR = 'tmp/dejure-org' CACHEDIR = 'tmp/dejure-org'
CACHEDAYS = 7 CACHEDAYS = 7
@ -76,6 +76,7 @@ module Nanoc::Filters
params[:format] ||= 'weit' params[:format] ||= 'weit'
params[:buzer] ||= 1 params[:buzer] ||= 1
params[:ohnehtags] = params.delete(:noheadings) params[:ohnehtags] = params.delete(:noheadings)
params[:Schema] = 'https'
return params return params
end end
@ -91,7 +92,7 @@ module Nanoc::Filters
request['Content-Type'] = 'application/x-www-form-urlencoded' request['Content-Type'] = 'application/x-www-form-urlencoded'
formdata = params formdata = params
formdata['Originaltext'] = input formdata[:Originaltext] = input
request.set_form_data(formdata) request.set_form_data(formdata)
response = http.request(request) response = http.request(request)
@ -170,7 +171,7 @@ module Nanoc::Filters
def integrity_check (input,output) def integrity_check (input,output)
# compare input and output text after removing all added links - texts should match! # compare input and output text after removing all added links - texts should match!
regexp = /<a href="http:\/\/dejure.org\/[^>]*>([^<]*)<\/a>/i regexp = /<a href="https?:\/\/dejure.org\/[^>]*>([^<]*)<\/a>/i
if input.strip.gsub(regexp, '\\1') == output.strip.gsub(regexp, '\\1') if input.strip.gsub(regexp, '\\1') == output.strip.gsub(regexp, '\\1')
return output return output
else else