wiki_md 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/wiki_md.rb +31 -6
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48d74d9d3dde58b596253dbf779021a392551d1efcfcb6aad84471f262030701
|
4
|
+
data.tar.gz: 6753153ad3063cbc7ecd5fea30e9dfc59a9b1809e4c8f77ac3de7cf0c1952bbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c71a0c426a8d9f212c68b2024c3520d03d5ad01de48db8209a07dc8d9bba799e39692350aa87c0b133abc912be989134e73374e4a07429813b595d67b369f8e1
|
7
|
+
data.tar.gz: 5930d61119d430948b9820dd45fa8c79a15e7da322963a7292d15bbeb143718c76615b1fa104086f19fbb237ab2af8a60dddb84e9998ddd7e33cd4c122f994c6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/wiki_md.rb
CHANGED
@@ -10,9 +10,11 @@ class WikiMd
|
|
10
10
|
|
11
11
|
attr_reader :active_heading, :filename
|
12
12
|
|
13
|
-
def initialize(wiki=nil, domain: nil, debug: false, base_url: '/'
|
13
|
+
def initialize(wiki=nil, domain: nil, debug: false, base_url: '/',
|
14
|
+
tag_base_url: '/tag')
|
14
15
|
|
15
|
-
@domain, @debug, @base_url = domain, debug, base_url
|
16
|
+
@domain, @debug, @base_url, @tag_base_url = domain, debug, base_url,
|
17
|
+
tag_base_url
|
16
18
|
|
17
19
|
if wiki then
|
18
20
|
|
@@ -43,8 +45,9 @@ class WikiMd
|
|
43
45
|
tag = title.split(/ +/).map(&:capitalize).join
|
44
46
|
|
45
47
|
@dxsx.create(x: s + "\n\n+ " + tag)
|
46
|
-
@dx.create title: title
|
47
|
-
|
48
|
+
@dx.create title: title + ' #' + tag,
|
49
|
+
url: [@base_url, File.basename(@filename),
|
50
|
+
URI.escape(title)].join('/')
|
48
51
|
FileX.write @filename, @dxsx.to_s if @filename
|
49
52
|
end
|
50
53
|
|
@@ -108,10 +111,32 @@ EOF
|
|
108
111
|
|
109
112
|
puts '@domain: ' + @domain.inspect if @debug
|
110
113
|
r.instance_variable_set(:@domain, @domain)
|
114
|
+
r.instance_variable_set(:@tag_url, "%s/%s" % [@tag_base_url,
|
115
|
+
File.basename(@filename)[/.*(?=\.\w+$)/]])
|
111
116
|
|
112
117
|
def r.to_html()
|
113
|
-
|
114
|
-
|
118
|
+
|
119
|
+
lines = self.lines
|
120
|
+
last_line = lines.last
|
121
|
+
|
122
|
+
content, tags = if last_line[0] == '+' then
|
123
|
+
|
124
|
+
raw_tags = last_line[/(?<=\+).*/].chomp.split
|
125
|
+
[lines[0..-2].join, raw_tags\
|
126
|
+
.map {|x| "+ [%s](%s/%s)" % [x, @tag_url, x]}]
|
127
|
+
|
128
|
+
else
|
129
|
+
|
130
|
+
[self, []]
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
pre_html = Martile.new(content, ignore_domainlabel: @domain).to_s
|
135
|
+
tags_html = Kramdown::Document.new(tags.join("\n")).to_html\
|
136
|
+
.sub('<ul>','<ul id="tags">')
|
137
|
+
Kramdown::Document.new(pre_html + "\n\n" + tags_html).to_html
|
138
|
+
|
139
|
+
|
115
140
|
end
|
116
141
|
|
117
142
|
r
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wiki_md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -87,6 +87,6 @@ rubyforge_project:
|
|
87
87
|
rubygems_version: 2.7.6
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
|
-
summary: 'Designed for
|
90
|
+
summary: 'Designed for maintaining many wiki entries within a single document in Markdown
|
91
91
|
format. #nothrills #personalwiki'
|
92
92
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|