origen_doc_helpers 0.8.1 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/application.rb +1 -1
- data/config/version.rb +1 -1
- data/lib/origen_doc_helpers/flow_page_generator.rb +3 -3
- data/lib/origen_doc_helpers/guide_index.rb +1 -1
- data/lib/origen_doc_helpers/helpers.rb +15 -3
- data/lib/origen_doc_helpers/model_page_generator.rb +13 -4
- data/lib/origen_doc_helpers/pdf.rb +10 -2
- data/templates/model_index.md.erb +1 -1
- data/templates/model_page.md.erb +1 -1
- data/templates/web/helpers.md.erb +1 -1
- data/templates/web/helpers/model.md.erb +5 -2
- data/templates/web/helpers/register.md.erb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7cf65e39b57505c76fd5c6b1dfc2fa0a8584393a9908969bec3f5f591031a9
|
4
|
+
data.tar.gz: a8047c6ecb51906db3c9ff4ebfeb226f0a4cb737fb8d1cabd96e8933c2699576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddae3f5bdd04539284603a0b6cfb479b8bc5d5babf4a2ebdc14a130090b01e0c06a6a0bb93dca4a16b4d913460436b73f9fb99f28435a992abff7b83775d4394
|
7
|
+
data.tar.gz: 3d7d6b437954b67a8b2eaa14b620af2f2b089b94e389f7ef2b1c0e21171efc732a3b2490a091c7e42b8f951a7388149da74ea0999221fd2aa5045647e6af87a4
|
data/config/application.rb
CHANGED
@@ -8,7 +8,7 @@ class OrigenDocHelpersApplication < Origen::Application
|
|
8
8
|
# To enable deployment of your documentation to a web server (via the 'origen web'
|
9
9
|
# command) fill in these attributes.
|
10
10
|
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/doc_helpers"
|
11
|
-
config.web_domain = "
|
11
|
+
config.web_domain = "https://origen-sdk.org/doc_helpers"
|
12
12
|
config.disqus_shortname = "origen-sdk"
|
13
13
|
|
14
14
|
config.semantically_version = true
|
data/config/version.rb
CHANGED
@@ -43,7 +43,7 @@ module OrigenDocHelpers
|
|
43
43
|
File.write(f, t)
|
44
44
|
end
|
45
45
|
|
46
|
-
def index_page_template
|
46
|
+
def index_page_template # index page template is in doc helpers, which isn't using app/ dir
|
47
47
|
@index_page_template ||= "#{Origen.root!}/templates/flow_index.md.erb"
|
48
48
|
end
|
49
49
|
end
|
@@ -99,11 +99,11 @@ module OrigenDocHelpers
|
|
99
99
|
d
|
100
100
|
end
|
101
101
|
|
102
|
-
def flow_page_template
|
102
|
+
def flow_page_template # flow page template is in doc helpers, which isn't using app/ dir
|
103
103
|
@flow_page_template ||= "#{Origen.root!}/templates/flow_page.md.erb"
|
104
104
|
end
|
105
105
|
|
106
|
-
def flow_template
|
106
|
+
def flow_template # flow template is in doc helpers, which isn't using app/ dir
|
107
107
|
@flow_template ||= "#{Origen.root!}/templates/shared/test/_flow.md.erb"
|
108
108
|
end
|
109
109
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module OrigenDocHelpers
|
2
2
|
# Provides an API to programatically construct an index hash as used
|
3
3
|
# by the Searchable Documents helper -
|
4
|
-
#
|
4
|
+
# https://origen-sdk.org/doc_helpers/helpers/searchable/intro/#The_Document_Index
|
5
5
|
class GuideIndex
|
6
6
|
def initialize
|
7
7
|
@index = {}
|
@@ -257,7 +257,11 @@ END
|
|
257
257
|
@_doc_root_dirs ||= {}
|
258
258
|
return @_doc_root_dirs[f] if @_doc_root_dirs[f]
|
259
259
|
unless File.exist?(f)
|
260
|
-
|
260
|
+
if File.exist?("#{Origen.root}/app/")
|
261
|
+
f = Pathname.new("#{Origen.root}/app/templates/web/#{f}")
|
262
|
+
else
|
263
|
+
f = Pathname.new("#{Origen.root}/templates/web/#{f}")
|
264
|
+
end
|
261
265
|
unless f.exist?
|
262
266
|
fail "#{options[:root]} does not exist!"
|
263
267
|
end
|
@@ -272,7 +276,11 @@ END
|
|
272
276
|
if options[:tab]
|
273
277
|
options[:tab]
|
274
278
|
else
|
275
|
-
rel =
|
279
|
+
rel = begin
|
280
|
+
options[:top_level_file].relative_path_from(_doc_root_dir(options)).sub_ext('').sub_ext('').to_s
|
281
|
+
rescue
|
282
|
+
'..'
|
283
|
+
end
|
276
284
|
# If the file lives outside of the current app (e.g. it comes from a plugin), then the above approach
|
277
285
|
# doesn't work, so let's just take the last dirname and the filename
|
278
286
|
if rel =~ /\.\./
|
@@ -285,7 +293,11 @@ END
|
|
285
293
|
end
|
286
294
|
|
287
295
|
def _root_path(options)
|
288
|
-
|
296
|
+
if File.exist?("#{Origen.root}/app/templates/web")
|
297
|
+
root = Pathname.new("#{Origen.root}/app/templates/web")
|
298
|
+
else
|
299
|
+
root = Pathname.new("#{Origen.root}/templates/web")
|
300
|
+
end
|
289
301
|
_doc_root_dir(options).relative_path_from(root)
|
290
302
|
end
|
291
303
|
end
|
@@ -4,6 +4,7 @@ module OrigenDocHelpers
|
|
4
4
|
attr_accessor :layout_options
|
5
5
|
attr_accessor :layout
|
6
6
|
attr_reader :pages
|
7
|
+
attr_accessor :target_as_id
|
7
8
|
|
8
9
|
def run(options)
|
9
10
|
@pages = {}
|
@@ -42,7 +43,7 @@ module OrigenDocHelpers
|
|
42
43
|
File.write(f, t)
|
43
44
|
end
|
44
45
|
|
45
|
-
def index_page_template
|
46
|
+
def index_page_template # index page template is in doc helpers, which isn't using app/ dir
|
46
47
|
@index_page_template ||= "#{Origen.root!}/templates/model_index.md.erb"
|
47
48
|
end
|
48
49
|
end
|
@@ -144,18 +145,26 @@ module OrigenDocHelpers
|
|
144
145
|
end
|
145
146
|
|
146
147
|
def id
|
147
|
-
|
148
|
+
if :target_as_id
|
149
|
+
@id ||= "#{Origen.target.name.downcase}" # _#{model.class.to_s.symbolize.to_s.gsub('::', '_')}"
|
150
|
+
else
|
151
|
+
@id ||= model.class.to_s.symbolize.to_s.gsub('::', '_')
|
152
|
+
end
|
148
153
|
end
|
149
154
|
|
150
155
|
def heading
|
151
|
-
|
156
|
+
if :target_as_id
|
157
|
+
@id.upcase
|
158
|
+
else
|
159
|
+
model.class.to_s
|
160
|
+
end
|
152
161
|
end
|
153
162
|
|
154
163
|
def output_path
|
155
164
|
"models/#{id}"
|
156
165
|
end
|
157
166
|
|
158
|
-
def model_page_template
|
167
|
+
def model_page_template # model page template is in doc helpers, which isn't using app/ dir
|
159
168
|
@model_page_template ||= "#{Origen.root!}/templates/model_page.md.erb"
|
160
169
|
end
|
161
170
|
end
|
@@ -25,7 +25,11 @@ module OrigenDocHelpers
|
|
25
25
|
@index = options[:index]
|
26
26
|
@root = Pathname.new(options[:root])
|
27
27
|
if @root.absolute?
|
28
|
-
|
28
|
+
if File.exist?("#{Origen.root}/app/")
|
29
|
+
@root = @root.relative_path_from(Pathname.new("#{Origen.root}/app/templates/web"))
|
30
|
+
else
|
31
|
+
@root = @root.relative_path_from(Pathname.new("#{Origen.root}/templates/web"))
|
32
|
+
end
|
29
33
|
end
|
30
34
|
require 'nokogiri'
|
31
35
|
end
|
@@ -116,7 +120,11 @@ module OrigenDocHelpers
|
|
116
120
|
end
|
117
121
|
|
118
122
|
def topic_wrapper_string
|
119
|
-
|
123
|
+
if File.exist?("#{Origen.root}/app/")
|
124
|
+
@topic_wrapper_string ||= File.read("#{Origen.root!}/app/templates/pdf/topic_wrapper.html")
|
125
|
+
else
|
126
|
+
@topic_wrapper_string ||= File.read("#{Origen.root!}/templates/pdf/topic_wrapper.html")
|
127
|
+
end
|
120
128
|
end
|
121
129
|
end
|
122
130
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
<div class="row" style="margin-top: 10px; margin-bottom: 15px;">
|
5
5
|
<div class="col-md-9">
|
6
|
-
<img src="
|
6
|
+
<img src="https://origen-sdk.org/img/origen-device.png" style="float: left; height:50px; width: 50px; margin-top: 14px;">
|
7
7
|
<h1 style="float: left; margin-left: 10px;">Models</h1>
|
8
8
|
</div>
|
9
9
|
</div>
|
data/templates/model_page.md.erb
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
<div class="row" style="margin-top: 10px; margin-bottom: 15px;">
|
22
22
|
<div class="col-md-9">
|
23
|
-
<img src="
|
23
|
+
<img src="https://origen-sdk.org/img/origen-device.png" style="float: left; height:50px; width: 50px; margin-top: 14px;">
|
24
24
|
<h1 style="float: left; margin-left: 10px;"><%= opts[:heading] %></h1>
|
25
25
|
</div>
|
26
26
|
% if opts[:search_box]
|
@@ -16,7 +16,7 @@ These helpers will generate complete web pages for you.
|
|
16
16
|
|
17
17
|
The following are components that you can embed within your own web pages.
|
18
18
|
|
19
|
-
| [Searchable Documents](<%= path "/helpers/searchable/intro" %>) | Provides a layout for a guides section of your website, complete with search box (the [Origen Guides](
|
19
|
+
| [Searchable Documents](<%= path "/helpers/searchable/intro" %>) | Provides a layout for a guides section of your website, complete with search box (the [Origen Guides](https://origen-sdk.org/guides) uses this)
|
20
20
|
| [Register Descriptions](<%= path "/helpers/register" %>) | Create a tabular register view, similar to that used in device reference manuals
|
21
21
|
| [Yammer Comments](<%= path "/helpers/yammer" %>) | Embed a comments section at the bottom of your page using Yammer
|
22
22
|
| [Disqus Comments](<%= path "/helpers/disqus" %>) | Embed a comments section at the bottom of your page using Disqus
|
@@ -5,9 +5,9 @@
|
|
5
5
|
This helper will build a collection of web pages that document a model's attributes,
|
6
6
|
currently this includes its sub-blocks and registers.
|
7
7
|
|
8
|
-
[Here is an example](
|
8
|
+
[Here is an example](https://origen-sdk.org/link_demo/models/linkdemo_toplevel/).
|
9
9
|
|
10
|
-
Multiple models can be supplied and an [index page like this](
|
10
|
+
Multiple models can be supplied and an [index page like this](https://origen-sdk.org/link_demo/models)
|
11
11
|
is generated to help locate the documentation for a given model.
|
12
12
|
|
13
13
|
The collection of pages associated with a particular model is also fully searchable via
|
@@ -79,6 +79,9 @@ end
|
|
79
79
|
|
80
80
|
* <code>:model</code> - **Required**, supply an instance of the model
|
81
81
|
* <code>:group</code> - Optional, a heading to group similar models under on the index page, e.g. "Production", "In Development"
|
82
|
+
* <code>:target_as_id</code> - Optional, causes the target name to be used for model page headings instead of the top-level model class name,
|
83
|
+
e.g. "Eagle" instead of "MyApp::ModelA". This is particularly useful if multiple targets instantiate the same top-level model with different
|
84
|
+
options or attributes that lead to differentiation.
|
82
85
|
|
83
86
|
## Website Integration
|
84
87
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Register Helpers
|
4
4
|
|
5
|
-
Use the [Origen register API](
|
5
|
+
Use the [Origen register API](https://origen-sdk.org/origen/guides/models/registers)
|
6
6
|
to define registers in the normal way,
|
7
7
|
all of the examples are here are based on this register definition:
|
8
8
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen_doc_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -76,7 +76,7 @@ files:
|
|
76
76
|
- templates/web/layouts/_helpers.html.erb
|
77
77
|
- templates/web/partials/_navbar.html.erb
|
78
78
|
- templates/web/release_notes.md.erb
|
79
|
-
homepage:
|
79
|
+
homepage: https://origen-sdk.org/doc_helpers
|
80
80
|
licenses:
|
81
81
|
- MIT
|
82
82
|
metadata: {}
|
@@ -95,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.8.11
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.7.7
|
98
|
+
rubygems_version: 3.1.4
|
100
99
|
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: Snippets and helpers for creating Origen web documents
|