stepmod-utils 0.2.0 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +42 -0
- data/.github/workflows/release.yml +23 -20
- data/Gemfile +2 -1
- data/Makefile +5 -0
- data/README.adoc +82 -1
- data/exe/stepmod-annotate-all +39 -0
- data/exe/stepmod-build-resource-docs-cache +19 -0
- data/exe/stepmod-convert-express-description +33 -0
- data/exe/stepmod-convert-express-resource +33 -0
- data/exe/stepmod-extract-terms +3 -3
- data/exe/stepmod-find-express-files +23 -0
- data/lib/stepmod/utils/cleaner.rb +11 -0
- data/lib/stepmod/utils/converters/a.rb +47 -0
- data/lib/stepmod/utils/converters/blockquote.rb +22 -0
- data/lib/stepmod/utils/converters/br.rb +15 -0
- data/lib/stepmod/utils/converters/bypass.rb +81 -0
- data/lib/stepmod/utils/converters/code.rb +19 -0
- data/lib/stepmod/utils/converters/comment.rb +16 -0
- data/lib/stepmod/utils/converters/dd.rb +15 -0
- data/lib/stepmod/utils/converters/def.rb +11 -4
- data/lib/stepmod/utils/converters/dl.rb +31 -0
- data/lib/stepmod/utils/converters/drop.rb +22 -0
- data/lib/stepmod/utils/converters/dt.rb +17 -0
- data/lib/stepmod/utils/converters/em_express_description.rb +22 -0
- data/lib/stepmod/utils/converters/eqn.rb +97 -0
- data/lib/stepmod/utils/converters/example.rb +1 -6
- data/lib/stepmod/utils/converters/express_g.rb +49 -0
- data/lib/stepmod/utils/converters/express_ref_express_description.rb +13 -0
- data/lib/stepmod/utils/converters/ext_description.rb +17 -0
- data/lib/stepmod/utils/converters/ext_descriptions.rb +14 -0
- data/lib/stepmod/utils/converters/fund_cons.rb +21 -0
- data/lib/stepmod/utils/converters/head.rb +22 -0
- data/lib/stepmod/utils/converters/hr.rb +15 -0
- data/lib/stepmod/utils/converters/ignore.rb +16 -0
- data/lib/stepmod/utils/converters/introduction.rb +15 -0
- data/lib/stepmod/utils/converters/note.rb +1 -6
- data/lib/stepmod/utils/converters/ol.rb +3 -2
- data/lib/stepmod/utils/converters/p.rb +21 -0
- data/lib/stepmod/utils/converters/pass_through.rb +13 -0
- data/lib/stepmod/utils/converters/q.rb +16 -0
- data/lib/stepmod/utils/converters/resource.rb +14 -0
- data/lib/stepmod/utils/converters/schema.rb +19 -0
- data/lib/stepmod/utils/converters/schema_diag.rb +14 -0
- data/lib/stepmod/utils/converters/strong.rb +41 -0
- data/lib/stepmod/utils/converters/sub.rb +24 -0
- data/lib/stepmod/utils/converters/sup.rb +22 -0
- data/lib/stepmod/utils/converters/table.rb +62 -0
- data/lib/stepmod/utils/converters/text.rb +68 -0
- data/lib/stepmod/utils/html_to_asciimath.rb +157 -0
- data/lib/stepmod/utils/smrl_description_converter.rb +49 -0
- data/lib/stepmod/utils/smrl_resource_converter.rb +67 -0
- data/lib/stepmod/utils/stepmod_file_annotator.rb +78 -0
- data/lib/stepmod/utils/version.rb +1 -1
- data/migrating_from_cvs.adoc +190 -0
- data/stepmod-utils.gemspec +1 -0
- metadata +69 -8
- data/.github/workflows/macos.yml +0 -39
- data/.github/workflows/ubuntu.yml +0 -53
- data/.github/workflows/windows.yml +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe9caf0ee63e637eb1a73289d7394a495b5f8a313c6ee3d69aff2bdcc150e57f
|
4
|
+
data.tar.gz: 791c199203956d117839a900869fd61362ead66703f6723cd4b5c0c8d871ccc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1910feb532333a698daa864f4387ccefdbcdeb6ccbcf3a962d3e7ec5dfa0a0c0f17643e8eba22ed625aa2a308595b0c30ea7d49ce5bed2de0a8c638cb1e2e00d
|
7
|
+
data.tar.gz: 19757106a503652a64052eb823750bb5a618750b68bf42abdc3833dde6be9d3345dbc80c5051d37cea2507fe07c87b0669cf3af60c66cf6579ace1cd02f9bf96
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
+
experimental: [ false ]
|
22
|
+
include:
|
23
|
+
- ruby: '3.0'
|
24
|
+
os: 'ubuntu-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '3.0'
|
27
|
+
os: 'windows-latest'
|
28
|
+
experimental: true
|
29
|
+
- ruby: '3.0'
|
30
|
+
os: 'macos-latest'
|
31
|
+
experimental: true
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
with:
|
35
|
+
submodules: true
|
36
|
+
|
37
|
+
- uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
40
|
+
bundler-cache: true
|
41
|
+
|
42
|
+
- run: bundle exec rake
|
@@ -1,41 +1,44 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
1
3
|
name: release
|
2
4
|
|
3
5
|
on:
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
next_version:
|
9
|
+
description: |
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
11
|
+
required: true
|
12
|
+
default: 'patch'
|
4
13
|
push:
|
5
|
-
tags:
|
6
|
-
- '*'
|
14
|
+
tags: [ v* ]
|
7
15
|
|
8
16
|
jobs:
|
9
17
|
release:
|
10
|
-
runs-on: ubuntu-
|
18
|
+
runs-on: ubuntu-latest
|
11
19
|
steps:
|
12
|
-
- uses: actions/checkout@
|
13
|
-
|
14
|
-
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
|
22
|
+
- uses: ruby/setup-ruby@v1
|
15
23
|
with:
|
16
24
|
ruby-version: '2.6'
|
17
|
-
|
18
|
-
-
|
19
|
-
|
20
|
-
|
21
|
-
bundle install --jobs 4 --retry 3
|
22
|
-
- name: Update stepmod-utils.jar
|
23
|
-
run: |
|
24
|
-
rm -f bin/stepmod-utils.jar
|
25
|
-
rake bin/stepmod-utils.jar
|
26
|
-
- name: Run specs
|
25
|
+
|
26
|
+
- run: gem install gem-release
|
27
|
+
|
28
|
+
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
27
29
|
run: |
|
28
|
-
|
29
|
-
|
30
|
+
git config user.name github-actions
|
31
|
+
git config user.email github-actions@github.com
|
32
|
+
gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
33
|
+
|
34
|
+
- name: publish to rubygems.org
|
30
35
|
env:
|
31
36
|
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
32
37
|
run: |
|
33
38
|
gem install gem-release
|
34
|
-
touch ~/.gem/credentials
|
35
39
|
cat > ~/.gem/credentials << EOF
|
36
40
|
---
|
37
41
|
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
38
42
|
EOF
|
39
43
|
chmod 0600 ~/.gem/credentials
|
40
|
-
git status
|
41
44
|
gem release
|
data/Gemfile
CHANGED
data/Makefile
ADDED
data/README.adoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= STEPmod utilities
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma.svg["Gem Version", link="https://rubygems.org/gems/metanorma"]
|
4
4
|
image:https://github.com/metanorma/stepmod-utils/workflows/ubuntu/badge.svg["Ubuntu Build Status", link="https://github.com/metanorma/stepmod-utils/actions?query=workflow%3Aubuntu"]
|
@@ -12,6 +12,12 @@ image:https://img.shields.io/github/commits-since/metanorma/stepmod-utils/latest
|
|
12
12
|
|
13
13
|
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod repository.
|
14
14
|
|
15
|
+
|
16
|
+
== CVS to Git migration procedures
|
17
|
+
|
18
|
+
include::migrating_from_cvs.adoc[]
|
19
|
+
|
20
|
+
|
15
21
|
== Installation
|
16
22
|
|
17
23
|
[source,ruby]
|
@@ -37,6 +43,81 @@ Then these files will be created:
|
|
37
43
|
* `031-generated-terms.adoc` all terms extracted
|
38
44
|
* `991-generated-bibliography.adoc` all bibliographic sources where the terms come from
|
39
45
|
|
46
|
+
== Conversion of STEPmod descriptions.xml into adoc
|
47
|
+
|
48
|
+
[source,sh]
|
49
|
+
----
|
50
|
+
$ stepmod-convert-express-description /path/to/the/stepmod/descriptions.xml
|
51
|
+
----
|
52
|
+
|
53
|
+
Example output:
|
54
|
+
[source,adoc]
|
55
|
+
-----
|
56
|
+
(*"application_context_schema"
|
57
|
+
|
58
|
+
*)
|
59
|
+
(*"application_context_schema.exchange_identification_context_select"
|
60
|
+
The *exchange\_identification\_context\_select* type allows for the designation of the data types express_ref:[management_resources_schema:ir_express:management_resources_schema.identification_assignment] and express_ref:[person_organization_schema:ir_express:person_organization_schema.organization] .
|
61
|
+
*)
|
62
|
+
(*"application_context_schema.application_context"
|
63
|
+
An *application\_context*, as defined in ISO 10303-1, is a context in which product data is defined and has meaning. An *application\_context* represents various types of information that relate to product data and may affect the meaning and usage of that data.
|
64
|
+
*)
|
65
|
+
(*"application_context_schema.application_context.application"
|
66
|
+
|
67
|
+
the express_ref:[support_resource_schema:ir_express:support_resource_schema.label] by which the *application\_context* is known.
|
68
|
+
|
69
|
+
[NOTE]
|
70
|
+
--
|
71
|
+
The meaning of this attribute can be defined in the annotated EXPRESS schemas that use or specialize this entity, or in an agreement of common understanding between the partners sharing this information.
|
72
|
+
--
|
73
|
+
|
74
|
+
*)
|
75
|
+
-----
|
76
|
+
|
77
|
+
|
78
|
+
== Conversion of STEPmod resource.xml into adoc
|
79
|
+
|
80
|
+
Given resource.xml file contents:
|
81
|
+
|
82
|
+
[source,xml]
|
83
|
+
----
|
84
|
+
<schema name="contract_schema" number="8369" version="3">
|
85
|
+
<introduction>
|
86
|
+
The subject of the <b>contract_schema</b> is the description of contract agreements.
|
87
|
+
</introduction>
|
88
|
+
<fund_cons>
|
89
|
+
Contract information may be attached to any aspect of a product data.
|
90
|
+
</fund_cons>
|
91
|
+
<express-g>
|
92
|
+
<imgfile file="contract_schemaexpg1.xml"/>
|
93
|
+
<imgfile file="contract_schemaexpg2.xml"/>
|
94
|
+
</express-g>
|
95
|
+
</schema>
|
96
|
+
----
|
97
|
+
|
98
|
+
Command:
|
99
|
+
|
100
|
+
[source,sh]
|
101
|
+
----
|
102
|
+
$ stepmod-convert-express-resource resource.xml
|
103
|
+
----
|
104
|
+
|
105
|
+
Will give output:
|
106
|
+
|
107
|
+
[source,adoc]
|
108
|
+
----
|
109
|
+
== Introduction
|
110
|
+
|
111
|
+
The subject of the *contract_schema* is the description of contract agreements.
|
112
|
+
|
113
|
+
== Fundamental concerns
|
114
|
+
|
115
|
+
Contract information may be attached to any aspect of a product data.
|
116
|
+
|
117
|
+
expg_image:contract_schemaexpg1.xml[]
|
118
|
+
expg_image:contract_schemaexpg2.xml[]
|
119
|
+
----
|
120
|
+
|
40
121
|
|
41
122
|
== CVS revision detection
|
42
123
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'concurrent'
|
4
|
+
require 'stepmod/utils/stepmod_file_annotator'
|
5
|
+
|
6
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
7
|
+
|
8
|
+
# build resource_docs cache
|
9
|
+
resource_docs_cache_file = `mktemp`
|
10
|
+
`"#{File.join(__dir__, 'stepmod-build-resource-docs-cache')}" "#{stepmod_dir}" > "#{resource_docs_cache_file}"`
|
11
|
+
|
12
|
+
# annotate each file
|
13
|
+
files = `"#{File.join(__dir__, 'stepmod-find-express-files')}" "#{stepmod_dir}"`.strip.split("\n")
|
14
|
+
MAX_THREADS = [2, Concurrent.processor_count].max * 2
|
15
|
+
MAX_QUEUE_SIZE = MAX_THREADS * 4
|
16
|
+
# https://github.com/ruby-concurrency/concurrent-ruby/blob/master/docs-source/thread_pools.md
|
17
|
+
pool = Concurrent::ThreadPoolExecutor.new(
|
18
|
+
:min_threads => MAX_THREADS,
|
19
|
+
:max_threads => MAX_THREADS,
|
20
|
+
:max_queue => MAX_QUEUE_SIZE,
|
21
|
+
:fallback_policy => :caller_runs
|
22
|
+
)
|
23
|
+
files.each_slice(MAX_QUEUE_SIZE) do |batch|
|
24
|
+
puts("Queueing next batch")
|
25
|
+
batch.each do |file|
|
26
|
+
pool.post do
|
27
|
+
puts("#{Thread.current.object_id}: Queued processing #{file}")
|
28
|
+
annotated = Stepmod::Utils::StepmodFileAnnotator.new(express_file: file, resource_docs_cache_file: resource_docs_cache_file, stepmod_dir: stepmod_dir).call
|
29
|
+
File.open(File.join(File.dirname(file), "#{File.basename(file, '.exp')}_annotated.exp"), 'w') do |file|
|
30
|
+
file.puts(annotated)
|
31
|
+
end
|
32
|
+
puts("#{Thread.current.object_id}: Done processing #{file}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
pool.shutdown
|
36
|
+
end
|
37
|
+
|
38
|
+
# cleanup
|
39
|
+
`rm "#{resource_docs_cache_file}"`
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
7
|
+
|
8
|
+
schemas = {}
|
9
|
+
Dir.glob(File.join(stepmod_dir, 'data/resource_docs/*/resource.xml')).each do |resource_docs_file|
|
10
|
+
match = resource_docs_file.match('data/resource_docs/([^/]+)/resource.xml')
|
11
|
+
resource_docs_dir = match.captures[0]
|
12
|
+
|
13
|
+
resource_docs = Nokogiri::XML(File.read(resource_docs_file)).root
|
14
|
+
resource_docs.xpath('schema').each do |schema|
|
15
|
+
schemas[schema['name']] = resource_docs_dir
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
puts JSON.pretty_generate(schemas)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
10
|
+
|
11
|
+
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
+
require "rubygems/specification"
|
13
|
+
|
14
|
+
class Gem::Specification
|
15
|
+
def this; self; end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'bundler/setup'
|
19
|
+
require 'stepmod/utils/smrl_description_converter'
|
20
|
+
|
21
|
+
ReverseAdoc.config.unknown_tags = :bypass
|
22
|
+
|
23
|
+
input_content = ARGF.read
|
24
|
+
|
25
|
+
result = Stepmod::Utils::SmrlDescriptionConverter.convert(input_content, {})
|
26
|
+
result.split("\n").each do |line|
|
27
|
+
begin
|
28
|
+
$stdout.puts(line)
|
29
|
+
$stdout.flush
|
30
|
+
rescue Errno::EPIPE
|
31
|
+
exit(74)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
10
|
+
|
11
|
+
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
+
require "rubygems/specification"
|
13
|
+
|
14
|
+
class Gem::Specification
|
15
|
+
def this; self; end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'bundler/setup'
|
19
|
+
require 'stepmod/utils/smrl_resource_converter'
|
20
|
+
|
21
|
+
ReverseAdoc.config.unknown_tags = :bypass
|
22
|
+
|
23
|
+
input_content = ARGF.read
|
24
|
+
|
25
|
+
result = Stepmod::Utils::SmrlResourceConverter.convert(input_content, {})
|
26
|
+
result.split("\n").each do |line|
|
27
|
+
begin
|
28
|
+
$stdout.puts(line)
|
29
|
+
$stdout.flush
|
30
|
+
rescue Errno::EPIPE
|
31
|
+
exit(74)
|
32
|
+
end
|
33
|
+
end
|
data/exe/stepmod-extract-terms
CHANGED
@@ -76,7 +76,7 @@ files.each do |file_path|
|
|
76
76
|
end
|
77
77
|
|
78
78
|
# TODO: we may want a command line option to override this in the future
|
79
|
-
unless %w(IS DIS TS).include? bibdata.doctype
|
79
|
+
unless %w(IS DIS FDIS TS).include? bibdata.doctype
|
80
80
|
log "INFO: skipped #{bibdata.docid} as it is not IS, DIS or TS"
|
81
81
|
next
|
82
82
|
end
|
@@ -135,7 +135,7 @@ files.each do |file_path|
|
|
135
135
|
|
136
136
|
end
|
137
137
|
|
138
|
-
parsed_bibliography
|
138
|
+
parsed_bibliography
|
139
139
|
|
140
140
|
File.open('031-generated-terms.adoc', 'w') { |file|
|
141
141
|
file.puts(parsed_terms.map(&:to_mn_adoc).join("\n"))
|
@@ -144,7 +144,7 @@ File.open('031-generated-terms.adoc', 'w') { |file|
|
|
144
144
|
log "INFO: written to: 031-generated-terms.adoc"
|
145
145
|
|
146
146
|
File.open('991-generated-bibliography.adoc', 'w') { |file|
|
147
|
-
file.puts(parsed_bibliography.map(&:to_mn_adoc).join("\n"))
|
147
|
+
file.puts(parsed_bibliography.map(&:to_mn_adoc).uniq.join("\n"))
|
148
148
|
}
|
149
149
|
|
150
150
|
log "INFO: written to: 991-generated-bibliography.adoc"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
6
|
+
|
7
|
+
index = Nokogiri::XML(File.read(File.join(stepmod_dir, 'repository_index.xml'))).root
|
8
|
+
|
9
|
+
files = []
|
10
|
+
index.xpath('modules/module').each do |item|
|
11
|
+
files << "#{stepmod_dir}/data/modules/#{item['name']}/arm.exp"
|
12
|
+
files << "#{stepmod_dir}/data/modules/#{item['name']}/mim.exp"
|
13
|
+
end
|
14
|
+
index.xpath('resources/resource').each do |item|
|
15
|
+
files << "#{stepmod_dir}/data/resources/#{item['name']}/#{item['name']}.exp"
|
16
|
+
end
|
17
|
+
index.xpath('business_object_models/business_object_model').each do |item|
|
18
|
+
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/bom.exp"
|
19
|
+
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/DomainModel.exp"
|
20
|
+
end
|
21
|
+
|
22
|
+
existing_files = files.filter{|file| File.exists?(file)}
|
23
|
+
puts existing_files
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "uri"
|
4
|
+
|
5
|
+
module Stepmod
|
6
|
+
module Utils
|
7
|
+
module Converters
|
8
|
+
class A < ReverseAdoc::Converters::Base
|
9
|
+
def convert(node, state = {})
|
10
|
+
name = treat_children(node, state)
|
11
|
+
href = node['href']
|
12
|
+
title = extract_title(node)
|
13
|
+
id = node['id'] || node['name']
|
14
|
+
|
15
|
+
id = id&.gsub(/\s/, "")&.gsub(/__+/, "_")
|
16
|
+
|
17
|
+
if /^_Toc\d+$|^_GoBack$/.match id
|
18
|
+
""
|
19
|
+
elsif !id.nil? && !id.empty?
|
20
|
+
"[[#{id}]]"
|
21
|
+
elsif href.to_s.start_with?('#')
|
22
|
+
href = href.sub(/^#/, "").gsub(/\s/, "").gsub(/__+/, "_")
|
23
|
+
if name.empty?
|
24
|
+
"<<#{href}>>"
|
25
|
+
else
|
26
|
+
"<<#{href},#{name}>>"
|
27
|
+
end
|
28
|
+
elsif href.to_s.empty?
|
29
|
+
name
|
30
|
+
else
|
31
|
+
name = title if name.empty?
|
32
|
+
href = "link:#{href}" unless href.to_s =~ URI::DEFAULT_PARSER.make_regexp
|
33
|
+
link = "#{href}[#{name}]"
|
34
|
+
# link.prepend(' ')
|
35
|
+
link = " #{link}"
|
36
|
+
link
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
ReverseAdoc::Converters.register :a, A.new
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|