ascii_binder 0.2.3 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/asciibinder +3 -3
- data/lib/ascii_binder/engine.rb +42 -10
- data/lib/ascii_binder/helpers.rb +1 -0
- data/lib/ascii_binder/topic_map.rb +2 -1
- data/lib/ascii_binder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f9de41f109228dfa1478976e8d1b8f08a178300d092e3250dcca610e4e70b6
|
4
|
+
data.tar.gz: 4cf902ff6c38a7a9ce622cdfaef927ed3943c750bcf71051a0bf00d430fce603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d978b66122655791fcefc86a04741b94940fdfffab86e2ace9dd2454bef63849bda46b8776b90bad9bf7f9a87a7cce42ca4115bb2650fd0ee7836f23ed5ca7cb
|
7
|
+
data.tar.gz: e8b18ebdb1a1fbc8114645692e91342f6d48b8bb42b63f5c763a18550fbf45d7c3cac73c6ebd164910400448e3a0a2babcf0faa51a5cf06e98def1d66f9bae76
|
data/bin/asciibinder
CHANGED
@@ -31,9 +31,9 @@ def repo_check(docs_basedir)
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
# Either of these must be present
|
34
|
-
unless File.exist?(File.join(docs_basedir, '
|
35
|
-
missing_files = true
|
36
|
-
end
|
34
|
+
# unless File.exist?(File.join("#{docs_basedir}/#{TOPIC_MAP_FOLDER}", '_topic_map.yml'))
|
35
|
+
# missing_files = true
|
36
|
+
# end
|
37
37
|
if missing_files or not in_git_repo(docs_basedir)
|
38
38
|
Trollop::die "The specified docs base directory '#{docs_basedir}' does not appear to be part of an AsciiBinder-compatible repo."
|
39
39
|
end
|
data/lib/ascii_binder/engine.rb
CHANGED
@@ -78,18 +78,50 @@ module AsciiBinder
|
|
78
78
|
|
79
79
|
# Protip: Don't cache these! The topic map needs to be reread every time we change branches.
|
80
80
|
def topic_map_file
|
81
|
+
|
82
|
+
# new stuff 1/Nov/2021
|
83
|
+
# allow users to break up the topic map into multiple topic maps
|
84
|
+
# load topic maps from a single folder called _topic_maps.
|
85
|
+
# we assume that all files in this folder are correctly formatted topic maps. If not, you will get normal asciibinder errors
|
86
|
+
topic_map_folder = TOPIC_MAP_FOLDER
|
81
87
|
topic_file = TOPIC_MAP_FILENAME
|
82
|
-
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
#
|
88
|
-
|
88
|
+
|
89
|
+
if !Dir.exist?(File.join(docs_root_dir, topic_map_folder))
|
90
|
+
# if the _topic_maps directory doesn't exist or is empty, see if we can find the topic map in the root folder to maintain backward compatibility
|
91
|
+
|
92
|
+
if !File.exist?(File.join(docs_root_dir, topic_file))
|
93
|
+
# fall back to looking for a _topic_map in the root directory
|
94
|
+
|
95
|
+
topic_file = BUILD_FILENAME # old folders use build_config.yml
|
96
|
+
|
97
|
+
if !File.exist?(File.join(docs_root_dir, topic_file))
|
98
|
+
# Critical error - no topic map file at all.
|
99
|
+
Trollop::die "Could not find a valid topic map file. There is no #{TOPIC_MAP_FOLDER} folder and the fall back files #{TOPIC_MAP_FILENAME} or #{BUILD_FILENAME} in branch '#{git.branch}' were also not found."
|
100
|
+
else
|
101
|
+
t = File.join(docs_root_dir, topic_file) # found build_config
|
102
|
+
end
|
103
|
+
else
|
104
|
+
t = File.join(docs_root_dir, topic_file) # found topic_map in root
|
105
|
+
end
|
106
|
+
|
107
|
+
else
|
108
|
+
|
109
|
+
# topic map files are in the _topic_maps folder
|
110
|
+
|
111
|
+
# create a combined temp file with all topic maps
|
112
|
+
tf = Tempfile.new("#{TOPIC_MAP_FILENAME}")
|
113
|
+
|
114
|
+
Dir.glob("#{topic_map_folder}/*.yml").each do |filename|
|
115
|
+
lines = IO.read(filename)
|
116
|
+
tf << lines
|
89
117
|
end
|
90
|
-
|
118
|
+
|
119
|
+
t = tf.path
|
91
120
|
end
|
92
|
-
|
121
|
+
|
122
|
+
# returns the path to the final file
|
123
|
+
t
|
124
|
+
|
93
125
|
end
|
94
126
|
|
95
127
|
def topic_map
|
@@ -467,7 +499,7 @@ module AsciiBinder
|
|
467
499
|
|
468
500
|
doc = without_warnings { Asciidoctor.load topic_file, :header_footer => false, :safe => :unsafe, :attributes => page_attrs, :base_dir => "." }
|
469
501
|
article_title = doc.doctitle || topic.name
|
470
|
-
|
502
|
+
|
471
503
|
topic_html = doc.render
|
472
504
|
|
473
505
|
# This is logic bridges newer arbitrary-depth-tolerant code to
|
data/lib/ascii_binder/helpers.rb
CHANGED
@@ -10,12 +10,13 @@ module AsciiBinder
|
|
10
10
|
attr_reader :list
|
11
11
|
|
12
12
|
def initialize(topic_file,distro_keys)
|
13
|
-
@topic_yaml = YAML.load_stream(open(
|
13
|
+
@topic_yaml = YAML.load_stream(open(topic_file))
|
14
14
|
@distro_keys = distro_keys
|
15
15
|
@list = []
|
16
16
|
@topic_yaml.each do |topic_entity|
|
17
17
|
@list << AsciiBinder::TopicEntity.new(topic_entity,distro_keys)
|
18
18
|
end
|
19
|
+
|
19
20
|
end
|
20
21
|
|
21
22
|
def filepaths
|
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: 0
|
4
|
+
version: '1.0'
|
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: 2021-
|
15
|
+
date: 2021-11-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|