jekyll-zettel 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/jekyll/zettel/citedown.rb +46 -11
- data/lib/jekyll/zettel/tags.rb +32 -7
- data/lib/jekyll/zettel/version.rb +1 -1
- data/lib/jekyll/zettel.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dc8ae8e1d8e9f8b35d24f2a711c77e1cac2bf42a8a7b3dd33d363a23fee5518
|
4
|
+
data.tar.gz: 79ef605ddec8abf5b96258b743f5c15772ffcf4c029d32d67dd45c654442fe1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49dfaef4d13597586bd7c198440e2bf81de9beecf9820b75321925fac61b2dd2390546f4e62510e94de8831eff84402c352e347e14fdf58f742b9ec83b36af9a
|
7
|
+
data.tar.gz: 41b2e42ac0ab78a5f8b28f3261aaa502e3d2fd42ddbd22e1b7fdbe0a80ef04600f6ffa022e0fb274d7af8725b6ef65b545277915d59ed80559156606429dae8c
|
data/CHANGELOG.md
CHANGED
@@ -10,3 +10,10 @@
|
|
10
10
|
|
11
11
|
- Changed inline citation regex to be compatible with pandoc [@<key>…]
|
12
12
|
- Emit warning when no reference for given _cite-key_ is found
|
13
|
+
|
14
|
+
### 0.7.2
|
15
|
+
|
16
|
+
- Objektkatalog aliases.json mit Mapping von Tag Klarnamen und Alternativen wird jetzt generiert
|
17
|
+
- Log-Level beim Serialisieren der Objektkataloge auf debug gestellt
|
18
|
+
- Jetzt werden auch Links auf Keywords erkannt und automatisch mit der jeweiligen Glosse verlinkt
|
19
|
+
-
|
@@ -5,10 +5,17 @@ module Kramdown
|
|
5
5
|
|
6
6
|
def initialize(source, options)
|
7
7
|
super
|
8
|
-
|
9
|
-
|
10
|
-
@
|
11
|
-
@
|
8
|
+
site = Jekyll.sites[0]
|
9
|
+
|
10
|
+
@citeproc = site.config['citeproc']
|
11
|
+
@references = site.data['references']
|
12
|
+
@keywords = site.data['aliases']
|
13
|
+
@zettel = site.data['zettelkasten']
|
14
|
+
|
15
|
+
@span_parsers.unshift(:citation, :keyword)
|
16
|
+
|
17
|
+
# So geht’s mit <i>, <b>, <em> und <strong> weiter
|
18
|
+
# @span_parsers.delete(:emphasis)
|
12
19
|
end
|
13
20
|
|
14
21
|
CITATION = /\[@([\w,:]+)(;\s*(.*))?\]/.freeze
|
@@ -23,7 +30,7 @@ module Kramdown
|
|
23
30
|
if @references.key?(cite_key)
|
24
31
|
add_citation(cite_key, note, start_line_number)
|
25
32
|
else
|
26
|
-
|
33
|
+
log_warning('cite-key', cite_key)
|
27
34
|
end
|
28
35
|
end
|
29
36
|
|
@@ -31,8 +38,8 @@ module Kramdown
|
|
31
38
|
citation = @citeproc.render :citation, id: cite_key, locator: note, label: :note
|
32
39
|
attributes = {
|
33
40
|
'href' => "/zettel/#{@references[cite_key]['id']}/",
|
34
|
-
'title' => @zettel[@references[cite_key]['id']]['
|
35
|
-
'
|
41
|
+
'title' => @zettel[@references[cite_key]['id']]['title'],
|
42
|
+
'class' => 'citation'
|
36
43
|
}
|
37
44
|
link = Element.new(:a, nil, attributes, location: start_line_number)
|
38
45
|
|
@@ -40,12 +47,40 @@ module Kramdown
|
|
40
47
|
@tree.children << link
|
41
48
|
end
|
42
49
|
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
define_parser(:citation, CITATION, '\[@')
|
51
|
+
|
52
|
+
KEYWORD = /\[#([\w]+)\]/.freeze
|
53
|
+
|
54
|
+
def parse_keyword
|
55
|
+
start_line_number = @src.current_line_number
|
56
|
+
@src.pos += @src.matched_size
|
57
|
+
|
58
|
+
keyword = @src[1]
|
59
|
+
if @keywords.key?(keyword)
|
60
|
+
add_keyword(keyword, start_line_number)
|
61
|
+
else
|
62
|
+
log_warning('keyword', keyword)
|
63
|
+
end
|
46
64
|
end
|
47
65
|
|
48
|
-
|
66
|
+
def add_keyword(keyword, start_line_number)
|
67
|
+
attributes = {
|
68
|
+
'href' => "/glosse/#{@keywords[keyword]['slug']}/",
|
69
|
+
'title' => @keywords[keyword]['tag'],
|
70
|
+
'class' => 'keyword'
|
71
|
+
}
|
72
|
+
link = Element.new(:a, nil, attributes, location: start_line_number)
|
73
|
+
|
74
|
+
link.children << Element.new(:raw, keyword)
|
75
|
+
@tree.children << link
|
76
|
+
end
|
77
|
+
|
78
|
+
define_parser(:keyword, KEYWORD, '\[#')
|
79
|
+
|
80
|
+
def log_warning(catalog, entry)
|
81
|
+
Jekyll.logger.warn 'Zettel:', "Missing entry for #{catalog} `#{entry}`"
|
82
|
+
@tree.children << Element.new(:raw, "<span class=\"error\">Missing entry for #{catalog} `#{entry}`</span>")
|
83
|
+
end
|
49
84
|
|
50
85
|
end
|
51
86
|
end
|
data/lib/jekyll/zettel/tags.rb
CHANGED
@@ -10,17 +10,26 @@ module Jekyll
|
|
10
10
|
|
11
11
|
def generate(site)
|
12
12
|
@site = site
|
13
|
+
|
14
|
+
@site.data['aliases'] = {}
|
13
15
|
@site.data['tags'] = {}
|
14
16
|
@site.data['tag2glosse'] = {}
|
15
17
|
|
16
|
-
|
18
|
+
register
|
19
|
+
|
20
|
+
write_catalog 'aliases'
|
21
|
+
write_catalog 'tags'
|
22
|
+
write_catalog 'tag2glosse'
|
23
|
+
end
|
24
|
+
|
25
|
+
def register
|
26
|
+
@site.pages.each do |page|
|
17
27
|
next unless SLUG_FORMAT.match?(page.path.to_s)
|
18
28
|
|
19
29
|
register_tag(page)
|
30
|
+
register_tags(page)
|
31
|
+
register_aliases(page)
|
20
32
|
end
|
21
|
-
|
22
|
-
write_catalog 'tags'
|
23
|
-
write_catalog 'tag2glosse'
|
24
33
|
end
|
25
34
|
|
26
35
|
def register_tag(doc)
|
@@ -33,17 +42,33 @@ module Jekyll
|
|
33
42
|
'tags' => doc.data['tags']
|
34
43
|
}
|
35
44
|
doc.data['slug'] = parts[:slug]
|
36
|
-
|
45
|
+
end
|
46
|
+
|
47
|
+
def register_aliases(doc)
|
48
|
+
@site.data['aliases'][doc.data['tag']] = {
|
49
|
+
'slug' => doc.data['slug'],
|
50
|
+
'tag' => doc.data['tag'],
|
51
|
+
'description' => doc.data['description']
|
52
|
+
}
|
53
|
+
return unless doc.data.key?('aliases')
|
54
|
+
|
55
|
+
doc.data['aliases'].each do |item|
|
56
|
+
@site.data['aliases'][item] = {
|
57
|
+
'slug' => doc.data['slug'],
|
58
|
+
'tag' => doc.data['tag'],
|
59
|
+
'description' => doc.data['description']
|
60
|
+
}
|
61
|
+
end
|
37
62
|
end
|
38
63
|
|
39
64
|
def register_tags(doc)
|
40
65
|
return unless doc.data.key?('tags')
|
41
66
|
|
42
|
-
doc.data['tags'].each
|
67
|
+
doc.data['tags'].each do |tag|
|
43
68
|
@site.data['tag2glosse'][tag] = [] unless @site.data['tag2glosse'].key?(tag)
|
44
69
|
|
45
70
|
@site.data['tag2glosse'][tag] << doc.data['slug']
|
46
|
-
|
71
|
+
end
|
47
72
|
end
|
48
73
|
end
|
49
74
|
end
|
data/lib/jekyll/zettel.rb
CHANGED
@@ -16,7 +16,7 @@ module Jekyll
|
|
16
16
|
class Error < StandardError; end
|
17
17
|
|
18
18
|
def write_catalog(object)
|
19
|
-
Jekyll.logger.
|
19
|
+
Jekyll.logger.debug LOG_KEY, "Created references in `#{@site.in_dest_dir('.objects', "#{object}.json")}`"
|
20
20
|
|
21
21
|
page = Jekyll::PageWithoutAFile.new(@site, @site.source, '.objects', "#{object}.json").tap do |file|
|
22
22
|
file.content = JSON.pretty_generate(@site.data[object.to_s])
|
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.7.
|
4
|
+
version: 0.7.2
|
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-
|
11
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citeproc-ruby
|