jekyll-zettel 0.6.10 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jekyll-zettel.gemspec +1 -0
- data/lib/jekyll/zettel/citedown.rb +76 -0
- data/lib/jekyll/zettel/reference.rb +3 -2
- data/lib/jekyll/zettel/references.rb +21 -5
- data/lib/jekyll/zettel/version.rb +1 -1
- data/lib/jekyll/zettel.rb +3 -0
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f0c367a83de5435188cfa3d9026af115d290c8fa703ae79bbe40bd6cb8d55d3
|
4
|
+
data.tar.gz: e33a27216b92a70a8c686ef5c95d3ca199862c76a02c3c294c268817bfd8e820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c00dabfae55a10731da1b0cb95c69a93fde42f89056c35299b4e5f0862a490cebc522a486755ed6517f2cf89b62bdc91da535fc7c82e919b0683d64426658a9
|
7
|
+
data.tar.gz: dd6329b7912aabfa2cf0d70d4f976dfce1ad7e887c8f60ccb23620ad62640b9dd92a50430dae52f4746e52d2c51f1c2bdf2e91630aa4c5ff083291cfc0b7a64a
|
data/jekyll-zettel.gemspec
CHANGED
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency 'csl-styles', '>= 2.0', '< 3.0'
|
32
32
|
spec.add_runtime_dependency 'fileutils', '>= 1.4', '< 2.0'
|
33
33
|
spec.add_runtime_dependency 'jekyll', '>= 3.8', '< 5.0'
|
34
|
+
spec.add_runtime_dependency 'kramdown', '>=2.0', '< 3.0'
|
34
35
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Kramdown
|
2
|
+
module Parser
|
3
|
+
# Kramdown Parser mit inline Zitationen
|
4
|
+
class Citedown < Kramdown
|
5
|
+
|
6
|
+
def initialize(source, options)
|
7
|
+
super
|
8
|
+
@citeproc = Jekyll.sites[0].config['citeproc']
|
9
|
+
@references = Jekyll.sites[0].data['references']
|
10
|
+
@zettel = Jekyll.sites[0].data['zettelkasten']
|
11
|
+
@span_parsers.unshift(:citation)
|
12
|
+
end
|
13
|
+
|
14
|
+
CITATION = /\(@([\w,:]+)(;\s*(.*))?\)/.freeze
|
15
|
+
|
16
|
+
def parse_citation
|
17
|
+
start_line_number = @src.current_line_number
|
18
|
+
@src.pos += @src.matched_size
|
19
|
+
|
20
|
+
cite_key = @src[1]
|
21
|
+
note = @src[3]
|
22
|
+
citation = @citeproc.render :citation, id: cite_key, locator: note, label: :note
|
23
|
+
attributes = {
|
24
|
+
'href' => "/zettel/#{@references[cite_key]['id']}/",
|
25
|
+
'title' => @zettel[@references[cite_key]['id']]['description'],
|
26
|
+
'style' => 'box-shadow: initial; border: none;'
|
27
|
+
}
|
28
|
+
link = Element.new(:a, nil, attributes, location: start_line_number)
|
29
|
+
|
30
|
+
link.children << Element.new(:raw, "<sup>#{citation}</sup>")
|
31
|
+
@tree.children << link
|
32
|
+
end
|
33
|
+
|
34
|
+
define_parser(:citation, CITATION, '\(@')
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
# options => {
|
40
|
+
# :template => "",
|
41
|
+
# :auto_ids => true,
|
42
|
+
# :auto_id_stripping => false,
|
43
|
+
# :auto_id_prefix => "",
|
44
|
+
# :transliterated_header_ids => false,
|
45
|
+
# :parse_block_html => true,
|
46
|
+
# :parse_span_html => true,
|
47
|
+
# :html_to_native => false,
|
48
|
+
# :link_defs => {},
|
49
|
+
# :footnote_nr => 1,
|
50
|
+
# :entity_output => :as_char,
|
51
|
+
# :toc_levels => [1, 2, 3, 4, 5, 6],
|
52
|
+
# :line_width => 72,
|
53
|
+
# :latex_headers => ["section", "subsection", "subsubsection", "paragraph", "subparagraph", "subparagraph"],
|
54
|
+
# :smart_quotes => ["lsquo", "rsquo", "ldquo", "rdquo"],
|
55
|
+
# :typographic_symbols => {},
|
56
|
+
# :remove_block_html_tags => true,
|
57
|
+
# :remove_span_html_tags => false,
|
58
|
+
# :header_offset => 0,
|
59
|
+
# :syntax_highlighter => :rouge,
|
60
|
+
# :syntax_highlighter_opts => {
|
61
|
+
# :default_lang => "plaintext",
|
62
|
+
# :guess_lang => true
|
63
|
+
# },
|
64
|
+
# :math_engine => :mathjax,
|
65
|
+
# :math_engine_opts => {},
|
66
|
+
# :footnote_backlink => "▲",
|
67
|
+
# :footnote_backlink_inline => false,
|
68
|
+
# :footnote_prefix => "",
|
69
|
+
# :remove_line_breaks_for_cjk => false,
|
70
|
+
# :forbidden_inline_options => [:template],
|
71
|
+
# :input => "Citedown",
|
72
|
+
# :hard_wrap => false,
|
73
|
+
# :guess_lang => true,
|
74
|
+
# :show_warnings => false,
|
75
|
+
# :coderay => {}
|
76
|
+
# }
|
@@ -4,9 +4,10 @@ module Jekyll
|
|
4
4
|
class Reference < Liquid::Tag
|
5
5
|
|
6
6
|
def render(context)
|
7
|
-
|
7
|
+
doc = context.registers[:page]
|
8
|
+
return unless doc.key?('reference') && doc['reference'].key?('citation-key')
|
8
9
|
|
9
|
-
context.registers[:site].config['citeproc'].render :bibliography, id:
|
10
|
+
context.registers[:site].config['citeproc'].render :bibliography, id: doc['reference']['citation-key']
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -42,13 +42,29 @@ module Jekyll
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def register_reference(doc, file)
|
45
|
-
if doc.data['reference'].include?('id')
|
46
|
-
|
45
|
+
if doc.data['reference'].include?('citation-key') && doc.data['reference'].include?('id')
|
46
|
+
#
|
47
|
+
# Citeproc erwartet sich eine id, die dem citation-key entspricht,
|
48
|
+
# in den References (references.json) brauche ich jedoch die id des
|
49
|
+
# Zettels, um in diversen Anwendungen darauf referenzieren zu können.
|
50
|
+
# Also wird die id des Zettels zwischengespeichert und für die
|
51
|
+
# Registrierung bei Citeproc durch den citation-key ersetzt.
|
52
|
+
#
|
53
|
+
# ACHTUNG!
|
54
|
+
# Beim Übernehmen einer Reference aus Citavi muss die id manuell auf
|
55
|
+
# die id des Zettels gesetzt werden!
|
56
|
+
#
|
57
|
+
# store
|
58
|
+
id = doc.data['reference']['id']
|
59
|
+
@site.data['references'][doc.data['reference']['citation-key']] = doc.data['reference']
|
60
|
+
# set id for Citeproc and register Item
|
61
|
+
doc.data['reference']['id'] = doc.data['reference']['citation-key']
|
47
62
|
@site.config['citeproc'].register doc.data['reference']
|
48
|
-
|
63
|
+
# restore
|
64
|
+
doc.data['reference']['id'] = id
|
49
65
|
else
|
50
|
-
Jekyll.logger.warn LOG_KEY, 'missing property @
|
51
|
-
Jekyll.logger.warn '',
|
66
|
+
Jekyll.logger.warn LOG_KEY, 'missing property @citation-key'
|
67
|
+
Jekyll.logger.warn '', file
|
52
68
|
end
|
53
69
|
end
|
54
70
|
|
data/lib/jekyll/zettel.rb
CHANGED
@@ -3,6 +3,7 @@ require 'securerandom'
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'citeproc'
|
5
5
|
require 'csl/styles'
|
6
|
+
require 'kramdown/parser/kramdown'
|
6
7
|
|
7
8
|
module Jekyll
|
8
9
|
# Jekyll zettel to your service
|
@@ -89,6 +90,7 @@ end
|
|
89
90
|
require 'jekyll/commands/scaffold'
|
90
91
|
require 'jekyll/zettel/akteur'
|
91
92
|
require 'jekyll/zettel/blatt'
|
93
|
+
require 'jekyll/zettel/citedown'
|
92
94
|
require 'jekyll/zettel/globals'
|
93
95
|
require 'jekyll/zettel/glosse'
|
94
96
|
require 'jekyll/zettel/reference'
|
@@ -98,3 +100,4 @@ require 'jekyll/zettel/timeline'
|
|
98
100
|
require 'jekyll/zettel/zeitleiste'
|
99
101
|
require 'jekyll/zettel/zettel'
|
100
102
|
require 'jekyll/zettel/zettelkasten'
|
103
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-zettel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Gerzabek
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citeproc-ruby
|
@@ -90,6 +90,26 @@ dependencies:
|
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '5.0'
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: kramdown
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '2.0'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '3.0'
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.0'
|
110
|
+
- - "<"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '3.0'
|
93
113
|
description: Coming soon…
|
94
114
|
email:
|
95
115
|
- michael.gerzabek@gmail.com
|
@@ -115,6 +135,7 @@ files:
|
|
115
135
|
- lib/jekyll/zettel.rb
|
116
136
|
- lib/jekyll/zettel/akteur.rb
|
117
137
|
- lib/jekyll/zettel/blatt.rb
|
138
|
+
- lib/jekyll/zettel/citedown.rb
|
118
139
|
- lib/jekyll/zettel/globals.rb
|
119
140
|
- lib/jekyll/zettel/glosse.rb
|
120
141
|
- lib/jekyll/zettel/reference.rb
|