jekyll_aspec 1.0.1 → 1.0.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.
@@ -1,18 +1,18 @@
1
- # A simple helper method handles the status of the target text.
2
- # This is used to display whether a GitHub issue or a Jira ticket
1
+ # A simple helper method handles the status of the target text.
2
+ # This is used to display whether a GitHub issue or a Jira ticket
3
3
  # is open or closed etc.
4
4
  module Labels
5
5
  # @param attrs [Array] attributes passed by the inline macro
6
6
  # @return [String] the status and/or label to be displayed
7
7
  def self.getstatus(attrs)
8
- status = attrs["status"]
9
- if status == ("done" || "closed")
10
- label = "success"
11
- elsif status == "open"
12
- label = "warning"
8
+ status = attrs['status']
9
+ if status == ('done' || 'closed')
10
+ label = 'success'
11
+ elsif status == 'open'
12
+ label = 'warning'
13
13
  else
14
- status = "unknown"
15
- label = "default"
14
+ status = 'unknown'
15
+ label = 'default'
16
16
  end
17
17
  end
18
18
  end
data/lib/jekyll_aspec.rb CHANGED
@@ -1,20 +1,11 @@
1
- require_relative "extensions/html_postprocessor"
2
- require_relative "extensions/autoxrefs"
3
- require_relative "extensions/inline_callout_macro"
4
- require_relative "extensions/inline_cwiki_macro"
5
- require_relative "extensions/inline_repo_macro"
6
- require_relative "extensions/inline_task_macro"
7
- require_relative "extensions/req_preprocessor"
8
- require_relative "extensions/req_refs"
9
- require_relative "extensions/requirement_block"
10
- require_relative "extensions/requirement_block_macro"
11
- require_relative "extensions/todo_block"
12
-
13
- require "jekyll_aspec/version"
14
-
15
- # Load Asciidoctor extensions
16
- Extensions.register do
17
- block TodoBlock
18
- block RequirementBlock
19
- block_macro RequirementBlockMacro
20
- end
1
+ require_relative 'extensions/html_postprocessor'
2
+ require_relative 'extensions/autoxrefs'
3
+ require_relative 'extensions/inline_callout_macro'
4
+ require_relative 'extensions/inline_cwiki_macro'
5
+ require_relative 'extensions/inline_repo_macro'
6
+ require_relative 'extensions/inline_task_macro'
7
+ require_relative 'extensions/req_refs'
8
+ require_relative 'extensions/requirement_block'
9
+ require_relative 'extensions/requirement_appendix'
10
+ require_relative 'extensions/todo_block'
11
+ require_relative 'jekyll_aspec/version'
@@ -1,6 +1,6 @@
1
1
  # Use this to set global versioning for the RubyGem
2
2
  module JekyllAspec
3
- # After updating the version, publishing can be done by running
3
+ # After updating the version, publishing can be done by running
4
4
  # rake release in the project root
5
- VERSION = "1.0.1"
5
+ VERSION = '1.0.2'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_aspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bsmith-n4
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,11 +66,11 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.5.0
69
- description: "This plugin is a group of Asciidoctor extensions that perform directory
70
- walking, \n resolving the location of titles and anchors
71
- in all adoc files so that inter-document\n cross-references
72
- in a Jekyll project are resolved automatically. Also included are some \n custom
73
- macros and blocks that are useful for techinical writing."
69
+ description: |-
70
+ This plugin is a group of Asciidoctor extensions that perform directory walking,
71
+ resolving the location of titles and anchors in all adoc files so that inter-document
72
+ cross-references in a Jekyll project are resolved automatically. Also included are some
73
+ custom macros and blocks that are useful for techinical writing.
74
74
  email:
75
75
  - brian.smith@numberfour.eu
76
76
  executables: []
@@ -78,6 +78,7 @@ extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
80
  - ".gitignore"
81
+ - ".rubocop.yml"
81
82
  - ".travis.yml"
82
83
  - Gemfile
83
84
  - Gemfile.lock
@@ -86,9 +87,6 @@ files:
86
87
  - Rakefile
87
88
  - bin/console
88
89
  - bin/setup
89
- - docs/inline-task.adoc
90
- - docs/requirement-block.adoc
91
- - docs/todo-block.adoc
92
90
  - jekyll_aspec.gemspec
93
91
  - lib/extensions/autoxrefs.rb
94
92
  - lib/extensions/html_postprocessor.rb
@@ -97,15 +95,12 @@ files:
97
95
  - lib/extensions/inline_repo_macro.rb
98
96
  - lib/extensions/inline_task_macro.rb
99
97
  - lib/extensions/replace_regex.rb
100
- - lib/extensions/req_preprocessor.rb
101
98
  - lib/extensions/req_refs.rb
99
+ - lib/extensions/requirement_appendix.rb
102
100
  - lib/extensions/requirement_block.rb
103
- - lib/extensions/requirement_block_macro.rb
104
101
  - lib/extensions/todo_block.rb
105
102
  - lib/extensions/utils/block.rb
106
103
  - lib/extensions/utils/labels.rb
107
- - lib/extensions/utils/req_macro_walker.rb
108
- - lib/extensions/utils/xref_helper.rb
109
104
  - lib/jekyll_aspec.rb
110
105
  - lib/jekyll_aspec/version.rb
111
106
  homepage: https://github.com/bsmith-n4/jekyll_aspec
@@ -1,34 +0,0 @@
1
- = Inline Task Macro
2
- :toc:
3
-
4
- Usage::
5
- [source,asciidoc]
6
- task:target[title]
7
-
8
- The `inline task macro` creates hyperlinks to Jira task management and GitHub issue-tracking systems.
9
- Optionally, it will render the links differently to reflect the status of the tasks if a task info file is provided.
10
-
11
- Note that in case two colons are given instead of only one after `task`, the task link will be moved to the sidebar.
12
-
13
- Attributes::
14
- * *target:* The project prefix followed by a hyphen and the task number or ID (e.g. `23`).
15
- * *title:* (optional) The text that will be displayed as an anchor in the generated hyperlink.
16
-
17
- == Configuration
18
-
19
- The target pattern needs to be specified in a document attribute:
20
-
21
- `:task-pattern: http://www.myorg.github.com/myrepo/issues/`
22
-
23
- For a Jekyll build, this can be added in the Jekyll `pass:[_config.yml]` to be passed to all documents:
24
-
25
- ```yaml
26
- asciidoctor:
27
- attributes:
28
- task-pattern: http://www.myorg.github.com/myrepo/issues/
29
- ```
30
-
31
- == Examples
32
-
33
- A bug has already ``+++task:35[]+++`` been filed...
34
-
@@ -1,56 +0,0 @@
1
- = Requirements Block
2
-
3
- Usage::
4
-
5
- .title
6
- [req,id=RSL-3,version=1]
7
- --
8
- Contents of the requirement
9
- --
10
-
11
-
12
- Attributes::
13
- * *title* (required): An anchor is derived from the requirement title and embedded at the beginning of the rendered output.
14
- * *ID:* (required) The ID in the form *<Prefix>-<Number>*, used to generate an anchor
15
- * *version*: (required) value is a non-negative integer.
16
-
17
- NOTE: Omitting any of the above attributes will print an error to the console and insert a warning text in the generated document.
18
- * *delimiter*: Lines containing only two hyphens `--` delimit the block. This is required if the block contains empty lines or nested formatting.
19
-
20
- == ID Pattern
21
-
22
- The purpose of the `<Prefix>-<Number>` ID is to ensure that Requirements are both unique and easily referenceable.
23
- Currently, the ID may be any string, but should conform to the following conventions:
24
-
25
- *<Prefix>*: :: `R` (requirement) followed by the project prefix (i.e. `SL` for `stdlib`)
26
- *<Number>*: :: The requirement number, currently not validated.
27
- A validation stage for requirement IDs (detecting duplicates, for instance) is planned.
28
-
29
- Example::
30
-
31
- The following example demonstrates how to document Requirement pass:[#]3 for stdlib Version 1;
32
-
33
- .This is the title
34
- [req,id=RSL-3,version=1]
35
- --
36
- My Super Requirement
37
- --
38
-
39
-
40
- *Req. RSL-3: <<This_is_the_title,This is the title>> (ver. 1)* +
41
- My Super Requirement
42
-
43
-
44
- == Xrefs
45
-
46
- Cross-referencing requirements is done using the syntax `\<<Req-ID,Optional Link Text>>`, e.g. for the following requirement:
47
-
48
- [req,id=ROPR-14603,version=1]
49
- --
50
- ...
51
- --
52
-
53
-
54
- can be cross-referenced using the following syntax
55
-
56
- See <<Req-ROPR-14603>>, or see also <<Req-ROPR-14603,confirm the booking>>.
data/docs/todo-block.adoc DELETED
@@ -1,48 +0,0 @@
1
- = TODO Block
2
-
3
- == Usage
4
-
5
- [source,asciidoc]
6
- ----
7
- // Simple use
8
-
9
- [TODO]
10
- Don't forget
11
- ----
12
-
13
- === Delimiters
14
-
15
- Delimiters are required if the block contains empty lines or nested blocks. +
16
- The following delimiters may be used:
17
-
18
- [source,subs=macros]
19
- ----
20
- ====
21
- --
22
- pass:[++++]
23
- ****
24
- pass:[----]
25
- ----
26
-
27
- Examples::
28
- [source,asciidoc]
29
- ----
30
- .Block Title (optional)
31
- [TODO]
32
- --
33
- Don't Forget!
34
-
35
- . Resolve an issue
36
- .. Don't break anything
37
- --
38
-
39
- // or
40
-
41
- [TODO]
42
- ++++
43
- Don't divide by zero.
44
-
45
- * Add 1 to infinity.
46
- ++++
47
-
48
- ----
@@ -1,23 +0,0 @@
1
- require 'asciidoctor/extensions'
2
-
3
- include ::Asciidoctor
4
-
5
- # Preprocessor that strips the << tags
6
- # @todo may break conversion if line ends with >>
7
-
8
- req = '<<req-'
9
- brackets = /<<|>>/
10
- repl = ''
11
-
12
- Extensions.register do
13
- preprocessor do
14
- process do |_document, reader|
15
- return reader if reader.eof?
16
- replacement_lines = reader.read_lines.map do |line|
17
- (line.include? req) ? (line.grepl brackets, repl) : line
18
- end
19
- reader.unshift_lines replacement_lines
20
- reader
21
- end
22
- end
23
- end
@@ -1,28 +0,0 @@
1
- require 'asciidoctor'
2
- require 'asciidoctor/extensions'
3
- require_relative 'utils/req_macro_walker'
4
-
5
- include ::Asciidoctor
6
-
7
- # @example Requirement Block Macro Use
8
- # requirements::[]
9
- class RequirementBlockMacro < Extensions::BlockMacroProcessor
10
- use_dsl
11
- named :requirements
12
-
13
- # Read the parent attributes and create a list of requirements in an appendix style
14
- def process(parent, target, attrs)
15
- rows = Reqs.list_reqs
16
- content = %(<h2 id="requirements"><a class="anchor" href="#requirements"></a><a class="link" href="#requirements">Requirements</a></h2>
17
- <div class="panel panel-default"> <div class="panel-heading"><h4>Requirements</h4></div>
18
- <table class="table"> <thead> <tr>
19
- <th>#</th> <th>ID</th><th>Version</th> <th>Title</th> <th>Document</th>
20
- </tr> </thead>
21
- <tbody>
22
- #{rows.join}
23
- </tbody>
24
- </table> </div>)
25
-
26
- create_pass_block parent, content, {}
27
- end
28
- end
@@ -1,110 +0,0 @@
1
- # Special handling for linking to Requirements.
2
- # These are mainly used by the Requirement Appendix (requirement_block_macro)
3
- #
4
- module Reqs
5
- # Recursively globs all files with the .adoc extension and matches cross-references
6
- # to Requirements. The special handling here is that we detect if the target
7
- # requirement is commented, in a source block or included.
8
- #
9
- # @return [Array] An array of the IDs and paths to requirements in generated HTML files
10
- def self.list_reqs
11
- # @todo This should be configurable, or at least not hardcoded
12
- exts = "(\.adoc|\.md|\.html)"
13
- docsdir = '_docs'
14
-
15
- title = nil
16
- chapter = nil
17
- doctitle = nil
18
-
19
- reqs = []
20
- rows = []
21
- # For commented requirements
22
- coms = []
23
- # For includes
24
- inc_reqs = []
25
- incs = []
26
-
27
- commentblockrx = '/^\/{4,}$/'
28
- commentlinerx = '/^//(?=[^/]|$)/'
29
-
30
- # @todo Already defined in Xref util?
31
- def trim(s)
32
- s.gsub!(/_docs\//, '')
33
- s.gsub!(/(\.adoc|\.md|\.html)/, '')
34
- end
35
-
36
- # @todo Dont do this? Find a better way of handling all source adoc files.
37
- adoc_files = Dir.glob('**/*.adoc')
38
-
39
- adoc_files.each do |f|
40
- inc = false
41
- commented = false
42
-
43
- File.read(f).each_line do |li|
44
- incommentblock ^= true if li[commentblockrx]
45
- commented = true if li[commentlinerx]
46
- inc = true if li[/published: false/]
47
-
48
- doctitle = /(?<=title:\s).+/.match(li) if li[/^title:\s+\w.+/]
49
- chapter = /(?<=chapter:\s).+/.match(li) if li[/^chapter:\s+\w.+/]
50
-
51
- if li[/^\[\s*req\s*,\s*id\s*=\s*\w+-?[0-9]+\s*,.*/]
52
- title.sub!(/^\./, '')
53
- req = [li.chop, f, title, chapter, doctitle]
54
-
55
- if commented || incommentblock
56
- coms.push(req)
57
- elsif inc
58
- inc_reqs.push(req)
59
- else
60
- reqs.push(req)
61
- end
62
-
63
- # Collect all includes
64
- elsif li[/^include::.+.adoc\[\]/]
65
-
66
- inc_file = li.chop.match(/(?<=^include::).+.adoc(?=\[\])/i).to_s
67
- path = inc_file.sub(/^#{docsdir}\//, '')
68
- path = path.sub(/#{exts}/, '')
69
- parent = f
70
- item = [inc_file, path, parent]
71
- incs.push item
72
-
73
- end
74
- title = li
75
- end
76
- end
77
-
78
- # Sort included reqs and correct the path to the parent (including doc)
79
- # Push this back into 'normal' requirements array for regular processing
80
- inc_reqs.each do |l, f, title, chapter, doctitle|
81
- incs.each do |incfile, _incpath, parent|
82
- if f == incfile
83
- item = [l, parent, title, chapter, doctitle]
84
- reqs.push item
85
- end
86
- end
87
- end
88
-
89
- # Remove dupes
90
- reqs.uniq!
91
-
92
- i = 0
93
- reqs.each do |req, f, title, chapter, doctitle|
94
- i += 1
95
-
96
- id = /[^,]*\s*id\s*=\s*(\w+-?[0-9]+)\s*,.*/.match(req)[1]
97
- version = /(?<=version=)\d+/.match(req)
98
-
99
- f.gsub!(/^_docs\//, '')
100
- f.gsub!(/.adoc$/, '')
101
-
102
- link = "#{f}/index##{id}"
103
- ref = "<a class=\"link\" href=\"#{link}\"><emphasis role=\"strong\">#{title}</emphasis> </a>"
104
- breadcrumb = "<a href=\"#{f}\">#{chapter} / #{doctitle}</a>"
105
- row = "<tr> <th scope=\"row\">#{i}</th> <td>#{id}</td><td>#{version}</td> <td>#{ref}</td> <td>#{breadcrumb}</td> </tr>"
106
-
107
- rows.push(row)
108
- end
109
- end
110
- end