clwiki 3.2.3 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cl_wiki/format_graphviz_di_graph.rb +19 -0
- data/lib/cl_wiki/{format/format_opml.rb → format_opml.rb} +21 -19
- data/lib/cl_wiki/format_pre_blockquote.rb +19 -0
- data/lib/cl_wiki/format_simple_table.rb +29 -0
- data/lib/cl_wiki/version.rb +1 -1
- metadata +7 -7
- data/lib/cl_wiki/format/format_graphviz_di_graph.rb +0 -17
- data/lib/cl_wiki/format/format_pre_blockquote.rb +0 -17
- data/lib/cl_wiki/format/format_simple_table.rb +0 -27
- /data/lib/cl_wiki/{format/format_blockquote.rb → format_blockquote.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18900683f87266b7a2c5b8b449910761885c1b8560833c2c1552a1dcc06ea422
|
4
|
+
data.tar.gz: 4de460a24cd59205616b0cf3cbe8ce627f0fc4a9af1542593e22a3b6454f3254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56c8759000fdfb0bc0bdfdcdc8996f90f788161d33b95e1289de60c9513504bcd5a739b6defb066a1489ec08df65f9eaf5028ea8f8c5851be0bcb1cc0b592091
|
7
|
+
data.tar.gz: 97ff51ddb7b6840bed6df586f1a92c4137b124a8a0bbc8a8cb894d4b1ed7f65f6b442a5a53006355fe9d17be1fd5e37b0d87a4fea628e4f124e9783c1edd1259
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ClWiki
|
4
|
+
class FormatGraphVizDiGraph < ClWiki::CustomFormatter
|
5
|
+
def self.match_re
|
6
|
+
/digraph.*\}/m
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.format_content(content, page)
|
10
|
+
content.sub!(/digraph.*\}/m,
|
11
|
+
"<a href=\"dot.rb?fn=#{page.file_full_path_and_name}\">
|
12
|
+
<img src=\"dot.rb?fn=#{page.file_full_path_and_name}\">
|
13
|
+
</a>")
|
14
|
+
content
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ClWiki::CustomFormatters.instance.register(ClWiki::FormatGraphVizDiGraph)
|
@@ -5,33 +5,35 @@ if $PROGRAM_NAME == __FILE__
|
|
5
5
|
require 'clwikipage'
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
module ClWiki
|
9
|
+
class FormatOPML < ClWiki::CustomFormatter
|
10
|
+
def self.match_re
|
11
|
+
%r{<opml.*?>.*?</opml>}m
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
def self.format_content(content, page)
|
15
|
+
out = ['<NoWikiLinks>']
|
16
|
+
content.grep(%r{<outline.*?>|</outline>}).each do |ln|
|
17
|
+
title = ln.scan(/title=\"(.*?)\"/).compact
|
18
|
+
html = ln.scan(/htmlUrl=\"(.*?)\"/).compact
|
19
|
+
xml = ln.scan(/xmlUrl=\"(.*?)\"/).compact
|
20
|
+
if html.empty? && xml.empty?
|
21
|
+
if !title.empty?
|
22
|
+
out << "<h4>#{title}</h4>"
|
23
|
+
out << '<blockquote>'
|
24
|
+
else
|
25
|
+
out << '</blockquote>'
|
26
|
+
end
|
23
27
|
else
|
24
|
-
out << '</
|
28
|
+
out << "<a href='#{xml}'>[xml]</a> <a href='#{html}'>#{title}</a>"
|
25
29
|
end
|
26
|
-
else
|
27
|
-
out << "<a href='#{xml}'>[xml]</a> <a href='#{html}'>#{title}</a>"
|
28
30
|
end
|
31
|
+
out.join("\n") + content
|
29
32
|
end
|
30
|
-
out.join("\n") + content
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
|
-
ClWiki::CustomFormatters.instance.register(FormatOPML)
|
36
|
+
ClWiki::CustomFormatters.instance.register(ClWiki::FormatOPML)
|
35
37
|
|
36
38
|
if $PROGRAM_NAME == __FILE__
|
37
39
|
sample_opml = <<-OPMLTEXT
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
module ClWiki
|
6
|
+
class FormatPreBlockquote < ClWiki::CustomFormatter
|
7
|
+
def self.match_re
|
8
|
+
%r{\[p\].*?\[/p\]}mi
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.format_content(content, page)
|
12
|
+
content = CGI.escapeHTML(content)
|
13
|
+
content.gsub!(/\[p\]/i, '<blockquote><pre>')
|
14
|
+
content.gsub!(%r{\[/p\]}i, '</pre></blockquote>')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ClWiki::CustomFormatters.instance.register(ClWiki::FormatPreBlockquote)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ClWiki
|
4
|
+
class FormatSimpleTable < ClWiki::CustomFormatter
|
5
|
+
def self.match_re
|
6
|
+
%r{<simpletable.*?>.*?</simpletable>}m
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.format_content(content, page = nil)
|
10
|
+
table_attr = content.scan(/<simpletable(.*?)>/m).to_s.strip
|
11
|
+
table_attr = 'border="1"' if table_attr.empty?
|
12
|
+
content.gsub!(/<simpletable.*?>/m, '')
|
13
|
+
content.gsub!(%r{</simpletable>}m, '')
|
14
|
+
content.strip!
|
15
|
+
lines = content.split("\n")
|
16
|
+
lines.collect! do |ln|
|
17
|
+
ln.gsub!(/\t/, ' ')
|
18
|
+
'<tr><td>' + ln.gsub(/ +/, '</td><td>') + '</td></tr>'
|
19
|
+
end
|
20
|
+
lines.collect! { |ln| ln.gsub(%r{<td>\s*?</td>}, '<td> </td>') }
|
21
|
+
|
22
|
+
# if you do a .join("\n"), then the \n will be converted to <br>
|
23
|
+
# ... so don't do that
|
24
|
+
"<table #{table_attr}>\n#{lines.join('')}</table>"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
ClWiki::CustomFormatters.instance.register(ClWiki::FormatSimpleTable)
|
data/lib/cl_wiki/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clwiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrismo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|
@@ -92,11 +92,11 @@ files:
|
|
92
92
|
- lib/cl_wiki/file.rb
|
93
93
|
- lib/cl_wiki/file_error.rb
|
94
94
|
- lib/cl_wiki/file_modified_since_read.rb
|
95
|
-
- lib/cl_wiki/
|
96
|
-
- lib/cl_wiki/
|
97
|
-
- lib/cl_wiki/
|
98
|
-
- lib/cl_wiki/
|
99
|
-
- lib/cl_wiki/
|
95
|
+
- lib/cl_wiki/format_blockquote.rb
|
96
|
+
- lib/cl_wiki/format_graphviz_di_graph.rb
|
97
|
+
- lib/cl_wiki/format_opml.rb
|
98
|
+
- lib/cl_wiki/format_pre_blockquote.rb
|
99
|
+
- lib/cl_wiki/format_simple_table.rb
|
100
100
|
- lib/cl_wiki/memory_indexer.rb
|
101
101
|
- lib/cl_wiki/metadata.rb
|
102
102
|
- lib/cl_wiki/page.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class FormatGraphVizDiGraph < ClWiki::CustomFormatter
|
4
|
-
def self.match_re
|
5
|
-
/digraph.*\}/m
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.format_content(content, page)
|
9
|
-
content.sub!(/digraph.*\}/m,
|
10
|
-
"<a href=\"dot.rb?fn=#{page.file_full_path_and_name}\">
|
11
|
-
<img src=\"dot.rb?fn=#{page.file_full_path_and_name}\">
|
12
|
-
</a>")
|
13
|
-
content
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
ClWiki::CustomFormatters.instance.register(FormatGraphVizDiGraph)
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cgi'
|
4
|
-
|
5
|
-
class FormatPreBlockquote < ClWiki::CustomFormatter
|
6
|
-
def self.match_re
|
7
|
-
%r{\[p\].*?\[/p\]}mi
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.format_content(content, page)
|
11
|
-
content = CGI.escapeHTML(content)
|
12
|
-
content.gsub!(/\[p\]/i, '<blockquote><pre>')
|
13
|
-
content.gsub!(%r{\[/p\]}i, '</pre></blockquote>')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
ClWiki::CustomFormatters.instance.register(FormatPreBlockquote)
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class FormatSimpleTable < ClWiki::CustomFormatter
|
4
|
-
def self.match_re
|
5
|
-
%r{<simpletable.*?>.*?</simpletable>}m
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.format_content(content, page = nil)
|
9
|
-
table_attr = content.scan(/<simpletable(.*?)>/m).to_s.strip
|
10
|
-
table_attr = 'border="1"' if table_attr.empty?
|
11
|
-
content.gsub!(/<simpletable.*?>/m, '')
|
12
|
-
content.gsub!(%r{</simpletable>}m, '')
|
13
|
-
content.strip!
|
14
|
-
lines = content.split("\n")
|
15
|
-
lines.collect! do |ln|
|
16
|
-
ln.gsub!(/\t/, ' ')
|
17
|
-
'<tr><td>' + ln.gsub(/ +/, '</td><td>') + '</td></tr>'
|
18
|
-
end
|
19
|
-
lines.collect! { |ln| ln.gsub(%r{<td>\s*?</td>}, '<td> </td>') }
|
20
|
-
|
21
|
-
# if you do a .join("\n"), then the \n will be converted to <br>
|
22
|
-
# ... so don't do that
|
23
|
-
"<table #{table_attr}>\n#{lines.join('')}</table>"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
ClWiki::CustomFormatters.instance.register(FormatSimpleTable)
|
File without changes
|