module Juli::Wiki
When new file is added:
-
The filename becomes wikiname.
-
scan all of files (includes itself because this also contains the wikiname), convert token to wiki-link if exists and generate HTML.
When a file is deleted:
-
The filename (wikiname) is lost.
-
scan all of files (includes itself because this also contains the wikiname), convert token to wiki-link if exists and generate HTML.
Public Class Methods
build_wikinames()
click to toggle source
# File lib/juli/wiki.rb, line 34 def build_wikinames wikiname = {} Dir.chdir(Juli::Util.juli_repo){ Dir.glob('**/*.txt'){|f| wikiname[encode(Juli::Util.to_wikiname(f))] = 1 } } wikiname.keys.sort_by{|a| -1 * a.length} end
decode(str)
click to toggle source
encode(str)
click to toggle source
wikinames()
click to toggle source
global name to return wikinames data, which is just string array ordered by length in descendant.
# File lib/juli/wiki.rb, line 46 def wikinames $_wikinames ||= build_wikinames end
Private Instance Methods
build_wikinames()
click to toggle source
# File lib/juli/wiki.rb, line 34 def build_wikinames wikiname = {} Dir.chdir(Juli::Util.juli_repo){ Dir.glob('**/*.txt'){|f| wikiname[encode(Juli::Util.to_wikiname(f))] = 1 } } wikiname.keys.sort_by{|a| -1 * a.length} end
decode(str)
click to toggle source
encode(str)
click to toggle source
wikinames()
click to toggle source
global name to return wikinames data, which is just string array ordered by length in descendant.
# File lib/juli/wiki.rb, line 46 def wikinames $_wikinames ||= build_wikinames end