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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1888c17a77608476925da51328667da19a2e5583dab3a98cd5db733755becfe
4
- data.tar.gz: 4326f98bccc01cc682f0c5612268416235c2ffa905e5a223466ea7225ab4973a
3
+ metadata.gz: 48d74d9d3dde58b596253dbf779021a392551d1efcfcb6aad84471f262030701
4
+ data.tar.gz: 6753153ad3063cbc7ecd5fea30e9dfc59a9b1809e4c8f77ac3de7cf0c1952bbd
5
5
  SHA512:
6
- metadata.gz: cbe685f7da5af13054f2854ac96723f985aa4c25b96c849be2f2c44836873d9afbec0aa5f25e9214898d720adfa473ad24f17c2b3cef5555aab519ab4dddc647
7
- data.tar.gz: 077c1df82beaa5a9301f78faa9b333c0bb2a7df589c5aead8dff657ade7a84b30eb918dc0cb027dda41a313b2a846af1741635f45b4085c57cf0b068cb3ea978
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, url: [@base_url, File.basename(@filename),
47
- URI.escape(title)].join('/')
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
- Kramdown::Document\
114
- .new(Martile.new(self, ignore_domainlabel: @domain).to_s).to_html
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.0
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 mainintaing many wiki entries within a single document in Markdown
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