clerq 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ class Promo < Thor
9
9
  def publish
10
10
  doc = Clerq.settings.document
11
11
  tmp = '.publish.md'
12
- `clerq build -t pandoc.md.erb -o #{tmp}`
12
+ `clerq build -o #{tmp}`
13
13
  Dir.chdir(Clerq.settings.bin) do
14
14
  `pandoc -s --toc #{tmp} -o "#{doc}.docx"`
15
15
  File.delete(tmp)
@@ -1,14 +1,14 @@
1
- # 1 Introduction
1
+ # Introduction
2
2
  {{skip_meta: true}}
3
3
 
4
- ## 1.1 Purpose
4
+ ## Purpose
5
5
  {{skip_meta: true}}
6
6
 
7
7
  The purpose of this document is to provide a demo project "Clerq Promo SRS" for all perspective Clerq users to introduce the system by example and provide a sandbox for experiments for the existing users.
8
8
 
9
9
  The other purpose (rather technical) is to have repository that provides all possible combinations of markup inside (links, ids, macros, etc.) to exercise in writing documents templates.
10
10
 
11
- ## 1.2 Scope
11
+ ## Scope
12
12
  {{skip_meta: true}}
13
13
 
14
14
  This software system will be a command-line interface (CLI) that provides a set of tools related to requirements management tasks. The system will also provide the requirements repository structure and the format of the requirements sources.
@@ -17,7 +17,7 @@ The system does not provide any graphical user interface. Assumed that users cre
17
17
 
18
18
  Any features related to restricting access to the requirements repository or to the functions of the system are out of scope. Assumed that each project repository is under control of an SCM tool (Git, Subversion, etc.) and the SCM is in charge of user's access to the SCM artifacts.
19
19
 
20
- ## 1.3 Definitions, acronyms, and abbreviations
20
+ ## Definitions, acronyms, and abbreviations
21
21
  {{skip_meta: true}}
22
22
 
23
23
  CLI
@@ -40,16 +40,14 @@ OS
40
40
 
41
41
  : Operations System
42
42
 
43
- [//]: # (to use the extension `--from markdown+definition_lists`)
44
-
45
- ## 1.4 References
43
+ ## References
46
44
  {{skip_meta: true}}
47
45
 
48
46
  1. [Markdown Guide](https://www.markdownguide.org/)
49
- 2. [Pandoc Users Guide](https://pandoc.org/MANUAL.html)
50
- 3. [Git Documentation](https://git-scm.com/doc)
47
+ 2. [Pandoc User's Guide](https://pandoc.org/MANUAL.html)
48
+ 3. [Git User's Manual](https://git-scm.com/docs/user-manual.html)
51
49
 
52
- ## 1.5 Overview
50
+ ## Overview
53
51
  {{skip_meta: true}}
54
52
 
55
53
  The remaining sections of this document provide user requirements and functional requirements of the system.
@@ -58,10 +56,10 @@ The next chapter [[us]] introduces the system from User Stories' point of view a
58
56
 
59
57
  The following chapter [[fr]] describes detailed requirements for functions and user interfaces that are based on user stories from the previous chapter. The chapter is structured around system components and is written primarily for developers and quality assurance specialists.
60
58
 
61
- # [us] 2 User stories
59
+ # [us] User stories
62
60
  {{skip_meta: true; order_index: .reader .writer}}
63
61
 
64
- # [fr] 3 Functional requirements
62
+ # [fr] Functional requirements
65
63
  {{skip_meta: true}}
66
64
 
67
65
  ## [cmp] Components
@@ -1,42 +1,9 @@
1
1
  <%
2
-
3
- require 'delegate'
4
-
5
- class MarkupNode < SimpleDelegator
6
- def title
7
- s = super
8
- s = ".#{id.split(/\./).last}" if s.empty?
9
- '#' * nesting_level + ' ' + s
10
- end
11
-
12
- def meta
13
- return '' if nesting_level == 0
14
- hsh = {}.merge(super)
15
- hsh.delete(:parent)
16
- hsh.delete(:order_index)
17
- hsh.delete(:filename)
18
- return '' if hsh.empty?
19
-
20
- hsh.map{|k, v| "#{k}: #{v}"}
21
- .unshift("{{")
22
- .push("}}")
23
- .join("\n")
24
- end
25
-
26
- def markup
27
- [].tap do |o|
28
- o << title
29
- o << meta unless meta.empty?
30
- unless body.empty?
31
- o << "\n#{body}"
32
- end
33
- end.join("\n")
34
- end
35
- end
2
+ require_relative "lib/markup_node"
36
3
  -%>
37
4
  % <%= @object.title %>
38
- % generated by Clerq on <%= Time.now.strftime('%B %e, %Y at %H:%M') %>
39
- % default template
5
+ % This file was generated by [Clerq](https://nvoynov.github.io/clerq/) <%= Time.now.strftime('on %B %e, %Y at %H:%M') %>
6
+ % using "default.md.erb" template
40
7
 
41
8
  <% for @node in @object.to_a.drop(1) -%>
42
9
  <% n = MarkupNode.new(@node) -%>
@@ -4,8 +4,14 @@ module Clerq
4
4
  module Services
5
5
 
6
6
  class Service
7
- def self.call(*args, **opts)
8
- new(*args, **opts).call
7
+ if RUBY_VERSION =~ /3\.[[:digit:]]+\.[[:digit:]]/
8
+ def self.call(*args, **opts)
9
+ new(*args, **opts).call
10
+ end
11
+ else
12
+ def self.call(*args)
13
+ new(*args).call
14
+ end
9
15
  end
10
16
 
11
17
  private_class_method :new
data/lib/clerq/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Clerq
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/promo.png ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clerq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikolay Voynov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,6 +89,7 @@ files:
89
89
  - clerq.thor
90
90
  - docs/README.md
91
91
  - docs/_config.yml
92
+ - docs/promo.png
92
93
  - exe/clerq
93
94
  - lib/assets/knb/SRS-IEEE-830-1998.md
94
95
  - lib/assets/knb/SRS-RUP.md
@@ -104,7 +105,11 @@ files:
104
105
  - lib/assets/knb/vision-document.md
105
106
  - lib/assets/lib/clerq_doc.thor
106
107
  - lib/assets/lib/colonize_repo.rb
108
+ - lib/assets/lib/markup_macro.rb
109
+ - lib/assets/lib/markup_node.rb
107
110
  - lib/assets/lib/spec/colonize_repo_spec.rb
111
+ - lib/assets/lib/spec/markup_macro_spec.rb
112
+ - lib/assets/lib/spec/markup_node_spec.rb
108
113
  - lib/assets/new/README.md.tt
109
114
  - lib/assets/new/clerq.thor.tt
110
115
  - lib/assets/new/clerq.yml.tt
@@ -132,7 +137,6 @@ files:
132
137
  - lib/assets/promo/src/us/us.reader.md
133
138
  - lib/assets/promo/src/us/us.writer.md
134
139
  - lib/assets/tt/default.md.erb
135
- - lib/assets/tt/pandoc.md.erb
136
140
  - lib/clerq.rb
137
141
  - lib/clerq/cli.rb
138
142
  - lib/clerq/entities.rb
@@ -154,6 +158,7 @@ files:
154
158
  - lib/clerq/services/service.rb
155
159
  - lib/clerq/settings.rb
156
160
  - lib/clerq/version.rb
161
+ - promo.png
157
162
  homepage: https://github.com/nvoynov/clerq
158
163
  licenses:
159
164
  - MIT
@@ -1,91 +0,0 @@
1
- <%
2
- require 'delegate'
3
- # Template for generate documents by Pandoc
4
- class MarkupNode < SimpleDelegator
5
- def title
6
- s = super
7
- s = ".#{id.split(/\./).last}" if s.empty?
8
- "#{'#' * nesting_level} #{s} {##{url(id)}}"
9
- end
10
-
11
- def meta
12
- return '' if nesting_level == 0
13
- return '' if super[:skip_meta]
14
-
15
- hsh = {id: id}.merge(super)
16
- hsh.delete(:order_index)
17
- hsh.delete(:filename)
18
- hsh.delete(:parent)
19
- [].tap{|ary|
20
- ary << "Attribute | Value"
21
- ary << "--------- | -----"
22
- hsh.each{|k,v| ary << "#{k} | #{v}"}
23
- }.join("\n")
24
- end
25
-
26
- def body
27
- # links replacement
28
- txt = String.new(super)
29
- links.each{|l| txt.gsub! "[[#{l}]]", link(l)}
30
- # macro substitution
31
- macro.each{|m| txt.gsub! m.regex, m.substitution}
32
- txt
33
- end
34
-
35
- def link(ref)
36
- node = root.find{|n| n.id == ref}
37
- return "[#{ref}](#unknown)" unless node
38
- "[#{node.title}](##{url(ref)})"
39
- end
40
-
41
- def url(id)
42
- r = id.start_with?(/[[:digit:]]/) ? "p#{id}" : id
43
- r.downcase
44
- .gsub(/[^A-Za-z0-9]{1,}/, '-')
45
- .gsub(/^-/, '')
46
- .gsub(/-$/, '')
47
- end
48
-
49
- class Macro
50
- attr_reader :regex
51
- def initialize(regex, &substitution)
52
- @regex, @substitution = regex, substitution
53
- end
54
-
55
- def substitution
56
- @substitution.call()
57
- end
58
- end
59
-
60
- def macro
61
- [].tap do |ary|
62
- ary << Macro.new(/{{@@skip[\s\S]*?}}/, &Proc.new{ '' })
63
- ary << Macro.new("{{@@list}}", &Proc.new{list})
64
- ary << Macro.new("{{@@tree}}", &Proc.new{tree})
65
- end
66
- end
67
-
68
- def tree
69
- this_level = nesting_level + 1
70
- to_a.drop(1).inject([]) do |ary, n|
71
- lead_spaces = ' ' * (n.nesting_level - this_level)
72
- ary << "#{lead_spaces}* [#{n.title}](##{url(n.id)})"
73
- end.join("\n")
74
- end
75
-
76
- def list
77
- items.inject([]) do |ary, n|
78
- ary << "* [#{n.title}](##{url(n.id)})"
79
- end.join("\n")
80
- end
81
- end
82
- -%>
83
- % <%= @object.title %>
84
- % generated by Clerq on <%= Time.now.strftime('%B %e, %Y at %H:%M') %>
85
- % pandoc template
86
-
87
- <% for @node in @object.to_a.drop(1) -%>
88
- <% n = MarkupNode.new(@node) -%>
89
- <%= [n.title, n.meta, n.body].select{|t| !t.empty?}.join("\n\n") %>
90
-
91
- <% end %>