onix 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/dtd/2.1r3/iso-amsa.ent +173 -0
- data/dtd/2.1r3/iso-amsb.ent +146 -0
- data/dtd/2.1r3/iso-amsc.ent +49 -0
- data/dtd/2.1r3/iso-amsn.ent +117 -0
- data/dtd/2.1r3/iso-amso.ent +77 -0
- data/dtd/2.1r3/iso-amsr.ent +205 -0
- data/dtd/2.1r3/iso-box.ent +67 -0
- data/dtd/2.1r3/iso-cyr1.ent +94 -0
- data/dtd/2.1r3/iso-cyr2.ent +53 -0
- data/dtd/2.1r3/iso-dia.ent +41 -0
- data/dtd/2.1r3/iso-grk3.ent +70 -0
- data/dtd/2.1r3/iso-lat1.ent +89 -0
- data/dtd/2.1r3/iso-lat2.ent +148 -0
- data/dtd/2.1r3/iso-mfrk.ent +79 -0
- data/dtd/2.1r3/iso-mopf.ent +53 -0
- data/dtd/2.1r3/iso-mscr.ent +79 -0
- data/dtd/2.1r3/iso-num.ent +103 -0
- data/dtd/2.1r3/iso-num.old.ent +103 -0
- data/dtd/2.1r3/iso-pub.ent +110 -0
- data/dtd/2.1r3/iso-tech.ent +183 -0
- data/dtd/2.1r3/onix-international.dtd +1012 -0
- data/dtd/2.1r3/onix-xhtml.elt +672 -0
- data/dtd/2.1r3/reference.elt +4758 -0
- data/dtd/2.1r3/xhtml-special.ent +79 -0
- data/dtd/2.1r3/xhtml-symbol.ent +242 -0
- data/lib/onix.rb +3 -1
- data/lib/onix/normaliser.rb +156 -0
- data/spec/normaliser_spec.rb +77 -0
- data/support/entities.txt +1499 -0
- data/support/extract.rb +25 -0
- data/support/switch-onix-tagnames-1.1.xsl +25 -0
- data/support/switch-onix-tagnames-2.0.xsl +37 -0
- metadata +54 -2
data/support/extract.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby1.9
|
2
|
+
|
3
|
+
#
|
4
|
+
# A small script to extract entities from the ONIX DTD
|
5
|
+
#
|
6
|
+
# USAGE: ./extract <dir>
|
7
|
+
#
|
8
|
+
# Where dir is a directory containing an ONIX 2.1r3 DTD.
|
9
|
+
#
|
10
|
+
|
11
|
+
unless File.directory?(ARGV.first)
|
12
|
+
$stderr.puts "directory doesn't exist"
|
13
|
+
exit(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
Dir.entries(ARGV.first).each do |f|
|
17
|
+
next unless f[-4,4] == ".ent"
|
18
|
+
|
19
|
+
content = File.binread(ARGV.first + "/" + f)
|
20
|
+
content.scan(/ENTITY [a-zA-Z0-9]+.*"\&#x.+;/).each do |str|
|
21
|
+
m, name, numeric = *str.match(/ENTITY ([a-zA-Z0-9]+).*"\&([^;]+);/)
|
22
|
+
puts "#{name}:#{numeric}"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
3
|
+
<xsl:variable name="release" select="/*/@release"/>
|
4
|
+
<xsl:variable name="target"><xsl:choose>
|
5
|
+
<xsl:when test="/ONIXMessage">short</xsl:when>
|
6
|
+
<xsl:otherwise>reference</xsl:otherwise>
|
7
|
+
</xsl:choose></xsl:variable>
|
8
|
+
<xsl:variable name="dtd-url">http://www.editeur.org/onix/<xsl:value-of select="$release"/>/<xsl:value-of select="$target"/>/onix-international.dtd</xsl:variable>
|
9
|
+
<xsl:output method="xml" doctype-system="{$dtd-url}"/>
|
10
|
+
<xsl:template match="*">
|
11
|
+
<xsl:variable name="target-name">
|
12
|
+
<xsl:choose>
|
13
|
+
<xsl:when test="$target='short'"><xsl:value-of select="@shortname"/></xsl:when>
|
14
|
+
<xsl:otherwise><xsl:value-of select="@refname"/></xsl:otherwise>
|
15
|
+
</xsl:choose>
|
16
|
+
</xsl:variable>
|
17
|
+
<xsl:element name="{$target-name}">
|
18
|
+
<xsl:copy-of select="@*[not(name()='refname' or name()='shortname')]"/>
|
19
|
+
<xsl:apply-templates select="*|text()"/>
|
20
|
+
</xsl:element>
|
21
|
+
</xsl:template>
|
22
|
+
<xsl:template match="text()">
|
23
|
+
<xsl:copy/>
|
24
|
+
</xsl:template>
|
25
|
+
</xsl:stylesheet>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
3
|
+
<xsl:param name="result-document" required="yes"/>
|
4
|
+
<xsl:variable name="release" select="/*/@release"/>
|
5
|
+
<xsl:variable name="target">
|
6
|
+
<xsl:choose>
|
7
|
+
<xsl:when test="/ONIXMessage">short</xsl:when>
|
8
|
+
<xsl:otherwise>reference</xsl:otherwise>
|
9
|
+
</xsl:choose>
|
10
|
+
</xsl:variable>
|
11
|
+
<xsl:variable name="dtd-url">http://www.editeur.org/onix/<xsl:value-of select="$release"/>/<xsl:value-of select="$target"/>/onix-international.dtd</xsl:variable>
|
12
|
+
<xsl:output method="xml"/>
|
13
|
+
<xsl:template match="/">
|
14
|
+
<xsl:result-document href="{$result-document}" method="xml" doctype-system="{$dtd-url}">
|
15
|
+
<xsl:apply-templates/>
|
16
|
+
</xsl:result-document>
|
17
|
+
</xsl:template>
|
18
|
+
<xsl:template match="*">
|
19
|
+
<xsl:variable name="target-name">
|
20
|
+
<xsl:choose>
|
21
|
+
<xsl:when test="$target='short'">
|
22
|
+
<xsl:value-of select="@shortname"/>
|
23
|
+
</xsl:when>
|
24
|
+
<xsl:otherwise>
|
25
|
+
<xsl:value-of select="@refname"/>
|
26
|
+
</xsl:otherwise>
|
27
|
+
</xsl:choose>
|
28
|
+
</xsl:variable>
|
29
|
+
<xsl:element name="{$target-name}">
|
30
|
+
<xsl:copy-of select="@*[not(name()='refname' or name()='shortname')]"/>
|
31
|
+
<xsl:apply-templates select="*|text()"/>
|
32
|
+
</xsl:element>
|
33
|
+
</xsl:template>
|
34
|
+
<xsl:template match="text()">
|
35
|
+
<xsl:copy/>
|
36
|
+
</xsl:template>
|
37
|
+
</xsl:stylesheet>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-19 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -77,10 +77,61 @@ files:
|
|
77
77
|
- lib/onix/measure.rb
|
78
78
|
- lib/onix/writer.rb
|
79
79
|
- lib/onix/common.rb
|
80
|
+
- lib/onix/normaliser.rb
|
80
81
|
- lib/onix.rb
|
81
82
|
- README.markdown
|
82
83
|
- TODO
|
83
84
|
- CHANGELOG
|
85
|
+
- dtd/2.1r3/onix-international.dtd
|
86
|
+
- dtd/2.1r3/onix-xhtml.elt
|
87
|
+
- dtd/2.1r3/reference.elt
|
88
|
+
- dtd/2.1r3/iso-amsa.ent
|
89
|
+
- dtd/2.1r3/iso-amsb.ent
|
90
|
+
- dtd/2.1r3/iso-amsc.ent
|
91
|
+
- dtd/2.1r3/iso-amsn.ent
|
92
|
+
- dtd/2.1r3/iso-amso.ent
|
93
|
+
- dtd/2.1r3/iso-amsr.ent
|
94
|
+
- dtd/2.1r3/iso-box.ent
|
95
|
+
- dtd/2.1r3/iso-cyr1.ent
|
96
|
+
- dtd/2.1r3/iso-cyr2.ent
|
97
|
+
- dtd/2.1r3/iso-dia.ent
|
98
|
+
- dtd/2.1r3/iso-grk3.ent
|
99
|
+
- dtd/2.1r3/iso-lat1.ent
|
100
|
+
- dtd/2.1r3/iso-lat2.ent
|
101
|
+
- dtd/2.1r3/iso-mfrk.ent
|
102
|
+
- dtd/2.1r3/iso-mopf.ent
|
103
|
+
- dtd/2.1r3/iso-mscr.ent
|
104
|
+
- dtd/2.1r3/iso-num.ent
|
105
|
+
- dtd/2.1r3/iso-num.old.ent
|
106
|
+
- dtd/2.1r3/iso-pub.ent
|
107
|
+
- dtd/2.1r3/iso-tech.ent
|
108
|
+
- dtd/2.1r3/xhtml-special.ent
|
109
|
+
- dtd/2.1r3/xhtml-symbol.ent
|
110
|
+
- support/switch-onix-tagnames-2.0.xsl
|
111
|
+
- support/switch-onix-tagnames-1.1.xsl
|
112
|
+
- support/extract.rb
|
113
|
+
- support/entities.txt
|
114
|
+
- spec/header_spec.rb
|
115
|
+
- spec/product_spec.rb
|
116
|
+
- spec/reader_spec.rb
|
117
|
+
- spec/writer_spec.rb
|
118
|
+
- spec/contributor_spec.rb
|
119
|
+
- spec/imprint_spec.rb
|
120
|
+
- spec/market_representation_spec.rb
|
121
|
+
- spec/website_spec.rb
|
122
|
+
- spec/measure_spec.rb
|
123
|
+
- spec/media_file_spec.rb
|
124
|
+
- spec/other_text_spec.rb
|
125
|
+
- spec/price_spec.rb
|
126
|
+
- spec/product_identifier_spec.rb
|
127
|
+
- spec/publisher_spec.rb
|
128
|
+
- spec/sales_restriction_spec.rb
|
129
|
+
- spec/sender_identifier.rb
|
130
|
+
- spec/stock_spec.rb
|
131
|
+
- spec/subject_spec.rb
|
132
|
+
- spec/supply_detail_spec.rb
|
133
|
+
- spec/title_spec.rb
|
134
|
+
- spec/normaliser_spec.rb
|
84
135
|
has_rdoc: true
|
85
136
|
homepage: http://github.com/yob/onix/tree/master
|
86
137
|
licenses: []
|
@@ -132,3 +183,4 @@ test_files:
|
|
132
183
|
- spec/subject_spec.rb
|
133
184
|
- spec/supply_detail_spec.rb
|
134
185
|
- spec/title_spec.rb
|
186
|
+
- spec/normaliser_spec.rb
|