ascii_binder 1.0.1 → 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 +4 -4
- data/lib/ascii_binder/engine.rb +66 -18
- data/lib/ascii_binder/topic_entity.rb +1 -1
- data/lib/ascii_binder/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2cf225b54975612036fdb2243443ae80fcb72edb2d214e60790b0419c58bdfa0
         | 
| 4 | 
            +
              data.tar.gz: eb4175c2ef3164a9e6042c1de20efe92673e79c3533eeb2be56b91271dfca5c7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6ee0f8b3a9f79fb640da73c9c7c708cf247662ba661254eb28c7c919bac3e3cec39073d2cf7bc3f793ffc782c416814e863af0fb842cedfff7c5304ac68dad53
         | 
| 7 | 
            +
              data.tar.gz: e3e5ed0a821629a531ee4e84812bacb309dad4c502036606fdd89610cb2d2f3bdd4374c973d68d0dc037a186d18fc1a8a70aa714bcb29d6c5048acdb6e8c219c
         | 
    
        data/lib/ascii_binder/engine.rb
    CHANGED
    
    | @@ -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 | 
            -
                   | 
| 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]}",  | 
| 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],  | 
| 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 | 
            -
             | 
| 252 | 
            -
             | 
| 253 | 
            -
             | 
| 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 | 
            -
             | 
| 256 | 
            -
             | 
| 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 | 
            -
                   | 
| 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,  | 
| 267 | 
            -
                  addl_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 |  | 
| @@ -302,7 +334,7 @@ module AsciiBinder | |
| 302 334 | 
             
                      log_unknown("Building only the #{distro_map.get_distro(build_distro).name} distribution.")
         | 
| 303 335 | 
             
                    end
         | 
| 304 336 | 
             
                  elsif single_page.nil?
         | 
| 305 | 
            -
                    log_unknown("Building  | 
| 337 | 
            +
                    log_unknown("Building all distributions.")
         | 
| 306 338 | 
             
                  end
         | 
| 307 339 |  | 
| 308 340 | 
             
                  # Notify the user of missing local branches
         | 
| @@ -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?
         | 
    
        data/lib/ascii_binder/version.rb
    CHANGED
    
    
    
        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. | 
| 4 | 
            +
              version: '1.2'
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - N. Harrison Ripps
         | 
| @@ -12,7 +12,7 @@ authors: | |
| 12 12 | 
             
            autorequire: 
         | 
| 13 13 | 
             
            bindir: bin
         | 
| 14 14 | 
             
            cert_chain: []
         | 
| 15 | 
            -
            date:  | 
| 15 | 
            +
            date: 2023-01-23 00:00:00.000000000 Z
         | 
| 16 16 | 
             
            dependencies:
         | 
| 17 17 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 18 18 | 
             
              name: bundler
         | 
| @@ -366,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 366 366 | 
             
                - !ruby/object:Gem::Version
         | 
| 367 367 | 
             
                  version: '0'
         | 
| 368 368 | 
             
            requirements: []
         | 
| 369 | 
            -
            rubygems_version: 3.0.3
         | 
| 369 | 
            +
            rubygems_version: 3.0.3.1
         | 
| 370 370 | 
             
            signing_key: 
         | 
| 371 371 | 
             
            specification_version: 4
         | 
| 372 372 | 
             
            summary: AsciiBinder is an AsciiDoc-based system for authoring and publishing closely
         |