ascii_binder 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: c8277b3de518379c42ba1414fd6545c4ef9b94dfd5fed3cba80e88c8599b99db
4
- data.tar.gz: bb0553741bff434ace3430fd0c801d702a88fe9b2f1ab33caa360904e4b8c40f
3
+ metadata.gz: 5c935f5c56bc709a5a8029622f7ffce6afb66018806e02c1b08e683c65d90849
4
+ data.tar.gz: 115f035401017e838117d4fa446d3715bb6913aacf9276894c1bebf6cbe59278
5
5
  SHA512:
6
- metadata.gz: 3683d10f5da8d844d460ea2bf329787cb609f1a1c9d6aedf5646d909bc3662cb1dfb5b24eff5acb0aa1e1a08d9e574d55f5c2023e5a69374f7407d40ccaa0906
7
- data.tar.gz: ad4c2810975dc716571b3f83cf945eb5f3670391a43a1405e392306b3ee2fcb8b926dc4da2eb722dadf7c42dd4438bfaa184746bc38bbc562313503882d8cf96
6
+ metadata.gz: ca4f6bb99b3db8d89d093797f78e0a53b57cfb3c6ec23451f868391360f758079f2bfeb20560f0347ab2ddf9b75d9ebe2efc42c208c4c60b0e3a34b6251a933a
7
+ data.tar.gz: 8b788a889bad12e435cb08f7b3bd6e771e1a0fd5d1866ac2c5f0cfa2d6f82ff9deadf4741cae18e01f2c411581015a0d9eb4a73aaa186c0850682f3261edc61b
@@ -451,7 +451,7 @@ module AsciiBinder
451
451
 
452
452
  def configure_and_generate_page(topic,branch_config,navigation)
453
453
  distro = branch_config.distro
454
- topic_adoc = File.open(topic.source_path,'r').read
454
+ # topic_adoc = File.open(topic.source_path,'r').read
455
455
 
456
456
  page_attrs = asciidoctor_page_attrs([
457
457
  "imagesdir=#{File.join(topic.parent.source_path,'images')}",
@@ -463,58 +463,67 @@ module AsciiBinder
463
463
  "allow-uri-read="
464
464
  ])
465
465
 
466
- doc = without_warnings { Asciidoctor.load topic_adoc, :header_footer => false, :safe => :unsafe, :attributes => page_attrs }
467
- article_title = doc.doctitle || topic.name
468
-
469
- topic_html = doc.render
470
-
471
- # This is logic bridges newer arbitrary-depth-tolerant code to
472
- # older depth-limited code. Truly removing depth limitations will
473
- # require changes to page templates in user docs repos.
474
- breadcrumb = topic.breadcrumb
475
- group_title = breadcrumb[0][:name]
476
- group_id = breadcrumb[0][:id]
477
- topic_title = breadcrumb[-1][:name]
478
- topic_id = breadcrumb[-1][:id]
479
- subgroup_title = nil
480
- subgroup_id = nil
481
- if breadcrumb.length == 3
482
- subgroup_title = breadcrumb[1][:name]
483
- subgroup_id = breadcrumb[1][:id]
484
- end
485
- dir_depth = '../' * topic.breadcrumb[-1][:id].split('::').length
486
- dir_depth = '' if dir_depth.nil?
466
+ File.open topic.source_path, 'r' do |topic_file|
467
+
468
+ doc = without_warnings { Asciidoctor.load topic_file, :header_footer => false, :safe => :unsafe, :attributes => page_attrs, :base_dir => "." }
469
+ article_title = doc.doctitle || topic.name
470
+
471
+ topic_html = doc.render
472
+
473
+ # This is logic bridges newer arbitrary-depth-tolerant code to
474
+ # older depth-limited code. Truly removing depth limitations will
475
+ # require changes to page templates in user docs repos.
476
+ breadcrumb = topic.breadcrumb
477
+ group_title = breadcrumb[0][:name]
478
+ group_id = breadcrumb[0][:id]
479
+ topic_title = breadcrumb[-1][:name]
480
+ topic_id = breadcrumb[-1][:id]
481
+ subgroup_title = nil
482
+ subgroup_id = nil
483
+ if breadcrumb.length == 3
484
+ subgroup_title = breadcrumb[1][:name]
485
+ subgroup_id = breadcrumb[1][:id]
486
+ end
487
+ dir_depth = '../' * topic.breadcrumb[-1][:id].split('::').length
488
+ dir_depth = '' if dir_depth.nil?
489
+
490
+ preview_path = topic.preview_path(distro.id,branch_config.dir)
491
+ topic_publish_url = topic.topic_publish_url(distro.site.url,branch_config.dir)
492
+
493
+ page_args = {
494
+ :distro_key => distro.id,
495
+ :distro => branch_config.distro_name,
496
+ :branch => branch_config.id,
497
+ :site_name => distro.site.name,
498
+ :site_url => distro.site.url,
499
+ :topic_url => preview_path,
500
+ :topic_publish_url => topic_publish_url,
501
+ :version => branch_config.name,
502
+ :group_title => group_title,
503
+ :subgroup_title => subgroup_title,
504
+ :topic_title => topic_title,
505
+ :article_title => article_title,
506
+ :content => topic_html,
507
+ :navigation => navigation,
508
+ :group_id => group_id,
509
+ :subgroup_id => subgroup_id,
510
+ :topic_id => topic_id,
511
+ :css_path => "#{dir_depth}#{branch_config.dir}/#{STYLESHEET_DIRNAME}/",
512
+ :javascripts_path => "#{dir_depth}#{branch_config.dir}/#{JAVASCRIPT_DIRNAME}/",
513
+ :images_path => "#{dir_depth}#{branch_config.dir}/#{IMAGE_DIRNAME}/",
514
+ :site_home_path => "#{dir_depth}index.html",
515
+ :template_path => template_dir,
516
+ :repo_path => topic.repo_path,
517
+ }
518
+ full_file_text = page(page_args)
519
+
520
+
521
+ File.open(preview_path, 'w') { |file| file.write(full_file_text) }
522
+
523
+
524
+ # File.write(preview_path,full_file_text)
487
525
 
488
- preview_path = topic.preview_path(distro.id,branch_config.dir)
489
- topic_publish_url = topic.topic_publish_url(distro.site.url,branch_config.dir)
490
-
491
- page_args = {
492
- :distro_key => distro.id,
493
- :distro => branch_config.distro_name,
494
- :branch => branch_config.id,
495
- :site_name => distro.site.name,
496
- :site_url => distro.site.url,
497
- :topic_url => preview_path,
498
- :topic_publish_url => topic_publish_url,
499
- :version => branch_config.name,
500
- :group_title => group_title,
501
- :subgroup_title => subgroup_title,
502
- :topic_title => topic_title,
503
- :article_title => article_title,
504
- :content => topic_html,
505
- :navigation => navigation,
506
- :group_id => group_id,
507
- :subgroup_id => subgroup_id,
508
- :topic_id => topic_id,
509
- :css_path => "#{dir_depth}#{branch_config.dir}/#{STYLESHEET_DIRNAME}/",
510
- :javascripts_path => "#{dir_depth}#{branch_config.dir}/#{JAVASCRIPT_DIRNAME}/",
511
- :images_path => "#{dir_depth}#{branch_config.dir}/#{IMAGE_DIRNAME}/",
512
- :site_home_path => "#{dir_depth}index.html",
513
- :template_path => template_dir,
514
- :repo_path => topic.repo_path,
515
- }
516
- full_file_text = page(page_args)
517
- File.write(preview_path,full_file_text)
526
+ end
518
527
  end
519
528
 
520
529
  # package_docs
@@ -1,3 +1,3 @@
1
1
  module AsciiBinder
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.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: 0.2.1
4
+ version: 0.2.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: 2020-09-02 00:00:00.000000000 Z
15
+ date: 2021-04-13 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -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.0.3
370
- signing_key:
369
+ rubygems_version: 3.2.3
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.