dxsectionx 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dxsectionx.rb +64 -0
- metadata +108 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e39f974433bfee9a6c35eca09338b9fdd4df9921
|
4
|
+
data.tar.gz: 8cf33efaf246dc73f83d59d6ac729b60b822f187
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cc981a90c9b98db1c93f696f83e8c173dda5321c0262ce4ff8992774788f421fb2ffe2444d9131332170d5d8d90f1a43c5f675b122bd6baaa1ac6849d1568aa7
|
7
|
+
data.tar.gz: 2dd99c16a81ef2a540f05e97e4d1ec036041aec8e3ef484f302219c31517dc48716112ea308895961955574dfb06334c0f5df75b8bc918ceea4d2001bade56fd
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/lib/dxsectionx.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: dxsectionx.rb
|
4
|
+
|
5
|
+
require 'dynarex'
|
6
|
+
require 'martile'
|
7
|
+
|
8
|
+
|
9
|
+
class DxSectionX
|
10
|
+
|
11
|
+
attr_writer :xsl_url, :domain
|
12
|
+
|
13
|
+
|
14
|
+
def initialize(filepath, domain: nil)
|
15
|
+
|
16
|
+
dx = Dynarex.new
|
17
|
+
dx.import filepath
|
18
|
+
@doc = dx.to_doc
|
19
|
+
@domain = domain
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_xml
|
24
|
+
|
25
|
+
@doc.root.xpath('records/section/x') do |x|
|
26
|
+
|
27
|
+
s = "=%s\n%s\n=" % [x.text.lines.first[/#\w+$/], x.text.unescape]
|
28
|
+
|
29
|
+
html = Martile.new(s, ignore_domainlabel: domain).to_html
|
30
|
+
|
31
|
+
e = x.parent
|
32
|
+
e.attributes.merge x.attributes
|
33
|
+
x.delete
|
34
|
+
doc2 = Rexle.new(html)
|
35
|
+
|
36
|
+
h1 = doc2.root.element('h1')
|
37
|
+
details = Rexle::Element.new('details')
|
38
|
+
details.attributes[:open] = 'open'
|
39
|
+
summary = Rexle::Element.new('summary')
|
40
|
+
summary.add h1
|
41
|
+
|
42
|
+
details.add summary
|
43
|
+
doc2.root.xpath('.').each {|x| details.add x }
|
44
|
+
doc2.root.add details
|
45
|
+
doc2.root.elements.each do |e2|
|
46
|
+
e.add e2
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
if @xsl_url then
|
51
|
+
|
52
|
+
@doc.instructions << [
|
53
|
+
'xml-stylesheet',
|
54
|
+
"title='XSL_formatting' type='text/xsl' href='#{@xsl_url}'"
|
55
|
+
]
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
return @doc
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dxsectionx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDkyNTE5MzUwN1oXDTE2MDkyNDE5MzUwN1owSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyL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a1ZXzGZXzzuW+g4Kgr48elktpRmyANrU2SRv15+aT17JIHdTXpbWK6eB0X
|
32
|
+
6kiGexYQCkyt+Q==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: dynarex
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.5'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.36
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.5'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.5.36
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: martile
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.6'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.6.12
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.6'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.6.12
|
76
|
+
description:
|
77
|
+
email: james@r0bertson.co.uk
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- lib/dxsectionx.rb
|
83
|
+
homepage: https://github.com/jrobertson/dxsectionx
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.4.8
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Transforms entries containing Markdown within a Dynarex document into HTML
|
107
|
+
using the Martile gem
|
108
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|