juli 2.0.4 → 2.1.0

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
  SHA1:
3
- metadata.gz: 5972beb37ee40ceb1e62692c18a19cb61e4b2542
4
- data.tar.gz: b7309448136bfa5be0682db98825f0e9f4dcf179
3
+ metadata.gz: 0332b51197f16c985e33f0b14f17de94e1e5c7c8
4
+ data.tar.gz: d44577a0524a445c3d8edea6d1319f2517222ff8
5
5
  SHA512:
6
- metadata.gz: eb93aabe4d570290a3fd473dcae7152ea4a8c725af1801b306d2a6a64ea7301f395abf86107c45f5ec6b3bf6fa86de94b45237e15bd6721c33ab4731d4051e52
7
- data.tar.gz: 2ea56626c3d8116a1413ff972f2b8bb25a5a61a8bad71718032e07983cd86742fd9555f4761b3b638b66e090ec4b8861f99f0926771a3567ec35bb34372dc472
6
+ metadata.gz: 04676c102da50e2181a0f9351c06c38a2d0c0e4fc1d1b266a1f8e86f176d58927e2dd07d5b252df5a5505567f8f3eb29b4bbb9ae515bd0642350f061c5e8acf3
7
+ data.tar.gz: ad4a0fa85b3a0d56eae90d6cb92e511fcf3c9efdff0b452a18a1f58c3146d7fa6a5faae11c11be4ebf6e713dbabc53e658426d58fabe9610571a0487026ab61c
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.insert(0, File.join(File.dirname(__FILE__), 'lib'))
5
5
 
6
6
  require 'rake'
7
7
  require 'rake/testtask'
8
- gem 'rdoc', '~> 4.2'
8
+ gem 'rdoc'
9
9
  require 'rdoc/task'
10
10
  require 'juli'
11
11
  require 'racc'
data/juli.gemspec CHANGED
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'simplecov'
30
30
  spec.add_development_dependency "bundler", "~> 1.9"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency 'rdoc'
32
33
  end
data/lib/juli/command.rb CHANGED
@@ -50,6 +50,10 @@ OUTPUT_TOP_COMMENT = <<EOM
50
50
  #
51
51
  #show_indent_toggle_button: true
52
52
 
53
+ # When set to '1st-only' (default), wikiname auto-link is applied at ONLY 1st
54
+ # occurence in a text, otherwise is applied at every occurence:
55
+ #
56
+ #link_wikiname_on: 1st-only
53
57
 
54
58
  # Specify output top directory (default = ../html).
55
59
 
data/lib/juli/util.rb CHANGED
@@ -133,6 +133,7 @@ EOM
133
133
  'output_top' => '../html',
134
134
  'show_indent_toggle_button' => true,
135
135
  'template' => 'default.html',
136
+ 'link_wikiname_on' => '1st-only',
136
137
  }
137
138
 
138
139
  include Singleton
data/lib/juli/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Juli
2
- VERSION = "2.0.4"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -59,8 +59,8 @@ module Juli::Visitor
59
59
  include Juli::Util
60
60
  include TagHelper
61
61
 
62
- def initialize(macros)
63
- @_macros = macros
62
+ def initialize(html_visitor)
63
+ @_html_visitor = html_visitor
64
64
  end
65
65
 
66
66
  def visit_array(n)
@@ -74,8 +74,13 @@ module Juli::Visitor
74
74
  end
75
75
 
76
76
  def visit_wikiname(n)
77
- decoded = Juli::Wiki.decode(n.str)
78
- content_tag(:a, decoded, :class=>'wiki', :href=>decoded + conf['ext'])
77
+ if conf['link_wikiname_on'] == '1st-only' && @_html_visitor.wikiname_visited[n.str]
78
+ n.str
79
+ else
80
+ @_html_visitor.wikiname_visited[n.str] = true
81
+ decoded = Juli::Wiki.decode(n.str)
82
+ content_tag(:a, decoded, :class=>'wiki', :href=>decoded + conf['ext'])
83
+ end
79
84
  end
80
85
 
81
86
  def visit_url(n)
@@ -83,7 +88,7 @@ module Juli::Visitor
83
88
  end
84
89
 
85
90
  def visit_macro(n)
86
- if macro = @_macros[camelize(n.name).to_sym]
91
+ if macro = @_html_visitor.macros[camelize(n.name).to_sym]
87
92
  macro.run(*n.rest.split(' '))
88
93
  else
89
94
  s = "juli ERR: UNKNOWN macro name: '#{n.name}'"
@@ -93,6 +98,8 @@ module Juli::Visitor
93
98
  end
94
99
  end
95
100
 
101
+ attr_accessor :wikiname_visited, :macros
102
+
96
103
  # Html sepecific initialization does:
97
104
  #
98
105
  # 1. create output_top.
@@ -112,7 +119,7 @@ module Juli::Visitor
112
119
 
113
120
  register_helper
114
121
  register_macro
115
- @html_line_visitor = HtmlLine.new(@_macros)
122
+ @html_line_visitor = HtmlLine.new(self)
116
123
 
117
124
  if !File.directory?(conf['output_top'])
118
125
  FileUtils.mkdir_p(conf['output_top'])
@@ -139,7 +146,7 @@ module Juli::Visitor
139
146
  for key, helper in @_helpers do
140
147
  helper.on_root(in_file, root, self)
141
148
  end
142
- for macro_symbol, macro in @_macros do
149
+ for macro_symbol, macro in @macros do
143
150
  macro.on_root(in_file, root, self)
144
151
  end
145
152
 
@@ -150,9 +157,10 @@ module Juli::Visitor
150
157
  javascript = relative_from(in_file, 'juli.js')
151
158
  stylesheet = relative_from(in_file, 'juli.css')
152
159
  sitemap = relative_from(in_file, 'sitemap' + conf['ext'])
160
+ @wikiname_visited = {}
153
161
  body = root.accept(self)
154
162
 
155
- for macro_symbol, macro in @_macros do
163
+ for macro_symbol, macro in @macros do
156
164
  macro.after_root(in_file, root)
157
165
  end
158
166
 
@@ -277,17 +285,17 @@ module Juli::Visitor
277
285
  end
278
286
 
279
287
 
280
- # create Macro object and register it in @_macros hash.
288
+ # create Macro object and register it in @macros hash.
281
289
  #
282
290
  # call set_conf_default() to set conf[key] default value for each macro
283
291
  def register_macro
284
- @_macros = {}
292
+ @macros = {}
285
293
  for macro_symbol in Juli::Macro.constants do
286
294
  next if macro_symbol == :Base
287
295
  macro_class = Juli::Macro.module_eval(macro_symbol.to_s)
288
296
  macro = macro_class.new
289
297
  macro.set_conf_default(conf)
290
- @_macros[macro_symbol] = macro
298
+ @macros[macro_symbol] = macro
291
299
  end
292
300
  end
293
301
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: juli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-12 00:00:00.000000000 Z
11
+ date: 2019-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rdoc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Offline wiki, and outline processor
98
112
  email:
99
113
  - fuminori_ido@yahoo.co.jp
@@ -221,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
235
  version: '0'
222
236
  requirements: []
223
237
  rubyforge_project:
224
- rubygems_version: 2.4.5
238
+ rubygems_version: 2.4.5.5
225
239
  signing_key:
226
240
  specification_version: 4
227
241
  summary: Offline wiki, and outline processor