ascii_binder 1.0 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26f9de41f109228dfa1478976e8d1b8f08a178300d092e3250dcca610e4e70b6
4
- data.tar.gz: 4cf902ff6c38a7a9ce622cdfaef927ed3943c750bcf71051a0bf00d430fce603
3
+ metadata.gz: 2cf225b54975612036fdb2243443ae80fcb72edb2d214e60790b0419c58bdfa0
4
+ data.tar.gz: eb4175c2ef3164a9e6042c1de20efe92673e79c3533eeb2be56b91271dfca5c7
5
5
  SHA512:
6
- metadata.gz: d978b66122655791fcefc86a04741b94940fdfffab86e2ace9dd2454bef63849bda46b8776b90bad9bf7f9a87a7cce42ca4115bb2650fd0ee7836f23ed5ca7cb
7
- data.tar.gz: e8b18ebdb1a1fbc8114645692e91342f6d48b8bb42b63f5c763a18550fbf45d7c3cac73c6ebd164910400448e3a0a2babcf0faa51a5cf06e98def1d66f9bae76
6
+ metadata.gz: 6ee0f8b3a9f79fb640da73c9c7c708cf247662ba661254eb28c7c919bac3e3cec39073d2cf7bc3f793ffc782c416814e863af0fb842cedfff7c5304ac68dad53
7
+ data.tar.gz: e3e5ed0a821629a531ee4e84812bacb309dad4c502036606fdd89610cb2d2f3bdd4374c973d68d0dc037a186d18fc1a8a70aa714bcb29d6c5048acdb6e8c219c
data/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
- FROM centos/ruby-22-centos7
1
+ FROM centos/ruby-23-centos7
2
2
 
3
- RUN scl enable rh-ruby22 -- gem install listen -v 3.0.8
4
- RUN scl enable rh-ruby22 -- gem install ascii_binder
3
+ RUN scl enable rh-ruby23 -- gem install listen -v 3.0.8
4
+ RUN scl enable rh-ruby23 -- gem install ascii_binder
5
5
  USER root
6
6
  RUN yum install -y java-1.7.0-openjdk && \
7
7
  yum clean all
data/ascii_binder.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency 'json'
35
35
  spec.add_dependency 'sitemap_generator', '~> 6.0.1'
36
36
  spec.add_dependency 'trollop', '~> 2.1.2'
37
- spec.add_dependency 'yajl-ruby', '~> 1.3.0'
37
+ spec.add_dependency "yajl-ruby", ">= 1.4.2"
38
38
  spec.add_dependency 'tilt'
39
39
 
40
40
  end
@@ -111,11 +111,13 @@ module AsciiBinder
111
111
  # create a combined temp file with all topic maps
112
112
  tf = Tempfile.new("#{TOPIC_MAP_FILENAME}")
113
113
 
114
- Dir.glob("#{topic_map_folder}/*.yml").each do |filename|
114
+ Dir.glob("#{topic_map_folder}/*.yml").sort.each do |filename|
115
115
  lines = IO.read(filename)
116
116
  tf << lines
117
+ tf.write "\n"
117
118
  end
118
119
 
120
+ tf.rewind
119
121
  t = tf.path
120
122
  end
121
123
 
@@ -217,13 +219,18 @@ module AsciiBinder
217
219
  def page(args)
218
220
  # TODO: This process of rebuilding the entire nav for every page will not scale well.
219
221
  # As the doc set increases, we will need to think about refactoring this.
220
- args[:breadcrumb_root], args[:breadcrumb_group], args[:breadcrumb_subgroup], args[:breadcrumb_topic] = extract_breadcrumbs(args)
222
+ args[:breadcrumb_root], args[:breadcrumb_group], args[:breadcrumb_subgroup], args[:breadcrumb_subsubgroup], args[:breadcrumb_topic] = extract_breadcrumbs(args)
221
223
 
222
224
  args[:breadcrumb_subgroup_block] = ''
223
225
  if args[:breadcrumb_subgroup]
224
226
  args[:breadcrumb_subgroup_block] = "<li class=\"hidden-xs active\">#{args[:breadcrumb_subgroup]}</li>"
225
227
  end
226
228
 
229
+ args[:breadcrumb_subsubgroup_block] = ''
230
+ if args[:breadcrumb_subsubgroup]
231
+ args[:breadcrumb_subsubgroup_block] = "<li class=\"hidden-xs active\">#{args[:breadcrumb_subsubgroup]}</li>"
232
+ end
233
+
227
234
  args[:subtopic_shim] = '../' * (args[:topic_id].split('::').length - 2)
228
235
  args[:subtopic_shim] = '' if args[:subtopic_shim].nil?
229
236
 
@@ -233,38 +240,63 @@ module AsciiBinder
233
240
 
234
241
  def extract_breadcrumbs(args)
235
242
  breadcrumb_root = breadcrumb_group = breadcrumb_subgroup = breadcrumb_topic = nil
243
+ selected_subgroup = selected_subsubgroup = nil
236
244
 
237
245
  root_group = args[:navigation].first
238
246
  selected_group = args[:navigation].detect { |group| group[:id] == args[:group_id] }
239
247
  selected_subgroup = selected_group[:topics].detect { |subgroup| subgroup[:id] == args[:subgroup_id] }
240
- current_is_subtopic = selected_subgroup ? true : false
248
+ if selected_subgroup
249
+ selected_subsubgroup = selected_subgroup[:topics].detect { |subsubgroup| subsubgroup[:id] == args[:subsubgroup_id] }
250
+ end
251
+
252
+ offset = 0;
253
+ if selected_subgroup
254
+ offset = 1
255
+ end
256
+ if selected_subsubgroup
257
+ offset = 2
258
+ end
241
259
 
242
260
  if root_group
243
261
  root_topic = root_group[:topics].first
244
- breadcrumb_root = linkify_breadcrumb(root_topic[:path], "#{args[:distro]} #{args[:version]}", current_is_subtopic) if root_topic
262
+ breadcrumb_root = linkify_breadcrumb(root_topic[:path], "#{args[:distro]} #{args[:version]}", offset) if root_topic
245
263
  end
246
264
 
247
265
  if selected_group
248
266
  group_topic = selected_group[:topics].first
249
- breadcrumb_group = linkify_breadcrumb(group_topic[:path], selected_group[:name], current_is_subtopic) if group_topic
267
+ breadcrumb_group = linkify_breadcrumb(group_topic[:path], selected_group[:name], offset) if group_topic
268
+ selected_topic = selected_group[:topics].detect { |topic| topic[:id] == args[:topic_id] }
269
+ breadcrumb_topic = linkify_breadcrumb(nil, selected_topic[:name], offset) if selected_topic
270
+ end
250
271
 
251
- if selected_subgroup
252
- subgroup_topic = selected_subgroup[:topics].first
253
- breadcrumb_subgroup = linkify_breadcrumb(subgroup_topic[:path], selected_subgroup[:name], current_is_subtopic) if subgroup_topic
272
+ if selected_subgroup
273
+ subgroup_topic = selected_subgroup[:topics].first
274
+ breadcrumb_subgroup = linkify_breadcrumb(subgroup_topic[:path], selected_subgroup[:name], offset) if subgroup_topic
254
275
 
255
- selected_topic = selected_subgroup[:topics].detect { |topic| topic[:id] == args[:topic_id] }
256
- breadcrumb_topic = linkify_breadcrumb(nil, selected_topic[:name], current_is_subtopic) if selected_topic
257
- else
258
- selected_topic = selected_group[:topics].detect { |topic| topic[:id] == args[:topic_id] }
259
- breadcrumb_topic = linkify_breadcrumb(nil, selected_topic[:name], current_is_subtopic) if selected_topic
260
- end
276
+ selected_topic = selected_subgroup[:topics].detect { |topic| topic[:id] == args[:topic_id] }
277
+ breadcrumb_topic = linkify_breadcrumb(nil, selected_topic[:name], offset) if selected_topic
261
278
  end
262
279
 
263
- return breadcrumb_root, breadcrumb_group, breadcrumb_subgroup, breadcrumb_topic
280
+ if selected_subsubgroup
281
+ subsubgroup_topic = selected_subsubgroup[:topics].first
282
+ breadcrumb_subsubgroup = linkify_breadcrumb(subsubgroup_topic[:path], selected_subsubgroup[:name], offset) if subsubgroup_topic
283
+
284
+ selected_topic = selected_subsubgroup[:topics].detect { |topic| topic[:id] == args[:topic_id] }
285
+ breadcrumb_topic = linkify_breadcrumb(nil, selected_topic[:name], offset) if selected_topic
286
+ end
287
+
288
+
289
+ return breadcrumb_root, breadcrumb_group, breadcrumb_subgroup, breadcrumb_subsubgroup, breadcrumb_topic
264
290
  end
265
291
 
266
- def linkify_breadcrumb(href, text, extra_level)
267
- addl_level = extra_level ? '../' : ''
292
+ def linkify_breadcrumb(href, text, offset)
293
+ addl_level = ''
294
+ if offset == 1
295
+ addl_level = '../'
296
+ end
297
+ if offset == 2
298
+ addl_level = '../../'
299
+ end
268
300
  href ? "<a href=\"#{addl_level}#{href}\">#{text}</a>" : text
269
301
  end
270
302
 
@@ -512,10 +544,24 @@ module AsciiBinder
512
544
  topic_id = breadcrumb[-1][:id]
513
545
  subgroup_title = nil
514
546
  subgroup_id = nil
547
+ subsubgroup_title = nil
548
+ subsubgroup_id = nil
515
549
  if breadcrumb.length == 3
516
550
  subgroup_title = breadcrumb[1][:name]
517
551
  subgroup_id = breadcrumb[1][:id]
518
552
  end
553
+
554
+ if breadcrumb.length == 4
555
+ topic_title = breadcrumb[-1][:name]
556
+ topic_id = breadcrumb[-1][:id]
557
+ subsubgroup_title = breadcrumb[-2][:name]
558
+ subsubgroup_id = breadcrumb[-2][:id]
559
+ subgroup_title = breadcrumb[-3][:name]
560
+ subgroup_id = breadcrumb[-3][:id]
561
+ group_title = breadcrumb[-4][:name]
562
+ group_id = breadcrumb[-4][:id]
563
+ end
564
+
519
565
  dir_depth = '../' * topic.breadcrumb[-1][:id].split('::').length
520
566
  dir_depth = '' if dir_depth.nil?
521
567
 
@@ -533,12 +579,14 @@ module AsciiBinder
533
579
  :version => branch_config.name,
534
580
  :group_title => group_title,
535
581
  :subgroup_title => subgroup_title,
582
+ :subsubgroup_title => subsubgroup_title,
536
583
  :topic_title => topic_title,
537
584
  :article_title => article_title,
538
585
  :content => topic_html,
539
586
  :navigation => navigation,
540
587
  :group_id => group_id,
541
588
  :subgroup_id => subgroup_id,
589
+ :subsubgroup_id => subsubgroup_id,
542
590
  :topic_id => topic_id,
543
591
  :css_path => "#{dir_depth}#{branch_config.dir}/#{STYLESHEET_DIRNAME}/",
544
592
  :javascripts_path => "#{dir_depth}#{branch_config.dir}/#{JAVASCRIPT_DIRNAME}/",
@@ -153,7 +153,7 @@ module AsciiBinder
153
153
  return false unless distro_keys.include?(distro_key)
154
154
 
155
155
  # If we're building a single page, check if we're on the right track.
156
- if single_page_path.length > 0
156
+ if single_page_path.length > 0 and not single_page_path[depth].nil?
157
157
  if is_group?
158
158
  return false unless single_page_path[depth] == dir
159
159
  elsif is_topic?
@@ -1,3 +1,3 @@
1
1
  module AsciiBinder
2
- VERSION = "1.0"
2
+ VERSION = "1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ascii_binder
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - N. Harrison Ripps
@@ -9,10 +9,10 @@ authors:
9
9
  - Carlos Munoz
10
10
  - Brian Exelbierd
11
11
  - Vikram Goyal
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2021-11-23 00:00:00.000000000 Z
15
+ date: 2023-01-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -228,16 +228,16 @@ dependencies:
228
228
  name: yajl-ruby
229
229
  requirement: !ruby/object:Gem::Requirement
230
230
  requirements:
231
- - - "~>"
231
+ - - ">="
232
232
  - !ruby/object:Gem::Version
233
- version: 1.3.0
233
+ version: 1.4.2
234
234
  type: :runtime
235
235
  prerelease: false
236
236
  version_requirements: !ruby/object:Gem::Requirement
237
237
  requirements:
238
- - - "~>"
238
+ - - ">="
239
239
  - !ruby/object:Gem::Version
240
- version: 1.3.0
240
+ version: 1.4.2
241
241
  - !ruby/object:Gem::Dependency
242
242
  name: tilt
243
243
  requirement: !ruby/object:Gem::Requirement
@@ -351,7 +351,7 @@ homepage: https://github.com/redhataccess/ascii_binder
351
351
  licenses:
352
352
  - MIT
353
353
  metadata: {}
354
- post_install_message:
354
+ post_install_message:
355
355
  rdoc_options: []
356
356
  require_paths:
357
357
  - lib
@@ -366,8 +366,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
366
366
  - !ruby/object:Gem::Version
367
367
  version: '0'
368
368
  requirements: []
369
- rubygems_version: 3.2.3
370
- signing_key:
369
+ rubygems_version: 3.0.3.1
370
+ signing_key:
371
371
  specification_version: 4
372
372
  summary: AsciiBinder is an AsciiDoc-based system for authoring and publishing closely
373
373
  related documentation sets from a single source.