oasis-etm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +23 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +14 -0
- data/.rubocop_todo.yml +24 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +15 -0
- data/README.adoc +152 -0
- data/Rakefile +12 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/oasis/etm/colspec.rb +28 -0
- data/lib/oasis/etm/entry.rb +39 -0
- data/lib/oasis/etm/row.rb +22 -0
- data/lib/oasis/etm/table.rb +31 -0
- data/lib/oasis/etm/tbody.rb +20 -0
- data/lib/oasis/etm/tcol.rb +28 -0
- data/lib/oasis/etm/tgroup.rb +37 -0
- data/lib/oasis/etm/thead.rb +20 -0
- data/lib/oasis/etm/version.rb +7 -0
- data/lib/oasis/etm.rb +13 -0
- data/lib/oasis-etm.rb +1 -0
- data/oasis-etm.gemspec +35 -0
- data/oasis-etm_wrapped.txt +1910 -0
- data/sig/oasis/etm.rbs +6 -0
- data/spec/fixtures/isosts/isosts_tables.cals.01.xml +16 -0
- data/spec/fixtures/isosts/isosts_tables.cals.02.xml +45 -0
- data/spec/fixtures/isosts/isosts_tables.cals.03.xml +35 -0
- data/spec/fixtures/isosts/isosts_tables.cals.04.xml +34 -0
- data/spec/fixtures/isosts/isosts_tables.cals.05.xml +63 -0
- data/spec/fixtures/isosts/isosts_tables.cals.06.xml +52 -0
- data/spec/fixtures/isosts/isosts_tables.cals.07.xml +33 -0
- data/spec/fixtures/isosts/isosts_tables.cals.08.xml +37 -0
- data/spec/fixtures/isosts/isosts_tables.cals.09.xml +37 -0
- data/spec/fixtures/isosts/isosts_tables.cals.10.xml +44 -0
- data/spec/fixtures/isosts/isosts_tables.cals.11.xml +43 -0
- data/spec/fixtures/isosts/isosts_tables.cals.12.xml +22 -0
- data/spec/fixtures/native/docbook_example.xml +47 -0
- data/spec/fixtures/niso-jats/niso-jats-table-wrap.xml +78 -0
- data/spec/oasis/etm/colspec_spec.rb +49 -0
- data/spec/oasis/etm/entry_spec.rb +103 -0
- data/spec/oasis/etm/row_spec.rb +43 -0
- data/spec/oasis/etm/table_spec.rb +94 -0
- data/spec/oasis/etm/tbody_spec.rb +48 -0
- data/spec/oasis/etm/tgroup_spec.rb +97 -0
- data/spec/oasis/etm/thead_spec.rb +48 -0
- data/spec/oasis/etm_spec.rb +81 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/shared_examples/validation_examples.rb +20 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad71a9a5219cab7710a57ebe6b3424172a11c50deac97889692b01ac239511a7
|
4
|
+
data.tar.gz: 11521a92f66914b6afef831dcd34f5544f082a00abc9dbd8e08c00d2ba48a6fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ece8bcbd0b7914cbe9eea7bbc6a9b59c9fc9e88f95f1278a710fa59e13e900239fd5a020c62d9cbfd8412e24664a64b8bf6369e6e73bd047c3a44b4f460ec0a
|
7
|
+
data.tar.gz: bf7e7b5b1921b33599e1e28ea2b494784227cb07c787dcf7de9a8dbcde5adf84f34f05ac2f97ac09224d375b57d031367960f92fd2abe4543532183d10dca7e3
|
@@ -0,0 +1,15 @@
|
|
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
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: release
|
4
|
+
|
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: 'skip'
|
13
|
+
repository_dispatch:
|
14
|
+
types: [ do-release ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
release:
|
18
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
19
|
+
with:
|
20
|
+
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
secrets:
|
22
|
+
rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
23
|
+
pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
3
|
+
- .rubocop_todo.yml
|
4
|
+
|
5
|
+
require:
|
6
|
+
- rubocop-performance
|
7
|
+
- rubocop-rake
|
8
|
+
- rubocop-rspec
|
9
|
+
|
10
|
+
AllCops:
|
11
|
+
TargetRubyVersion: 3.0
|
12
|
+
NewCops: enable
|
13
|
+
Exclude:
|
14
|
+
- 'vendor/**/*'
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2024-11-01 07:12:25 UTC using RuboCop version 1.68.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
12
|
+
# URISchemes: http, https
|
13
|
+
Layout/LineLength:
|
14
|
+
Exclude:
|
15
|
+
- 'spec/oasis/etm/entry_spec.rb'
|
16
|
+
|
17
|
+
# Offense count: 6
|
18
|
+
# Configuration parameters: CountAsOne.
|
19
|
+
RSpec/ExampleLength:
|
20
|
+
Max: 10
|
21
|
+
|
22
|
+
# Offense count: 12
|
23
|
+
RSpec/MultipleExpectations:
|
24
|
+
Max: 10
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in oasis-etm.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "nokogiri"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rspec", "~> 3.0"
|
11
|
+
gem "rubocop", "~> 1.21"
|
12
|
+
gem "rubocop-performance"
|
13
|
+
gem "rubocop-rake"
|
14
|
+
gem "rubocop-rspec"
|
15
|
+
gem "xml-c14n"
|
data/README.adoc
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
= OASIS Exchange Table Model (ETM) Parser
|
2
|
+
:toc: macro
|
3
|
+
:toclevels: 3
|
4
|
+
|
5
|
+
image:https://img.shields.io/gem/v/oasis-etm.svg[Gem Version, link=https://rubygems.org/gems/oasis-etm]
|
6
|
+
image:https://github.com/yourusername/oasis-etm/actions/workflows/test.yml/badge.svg[Build Status, link=https://github.com/yourusername/oasis-etm/actions/workflows/test.yml]
|
7
|
+
image:https://img.shields.io/github/license/yourusername/oasis-etm.svg[License, link=https://github.com/yourusername/oasis-etm/blob/main/LICENSE]
|
8
|
+
|
9
|
+
toc::[]
|
10
|
+
|
11
|
+
== Purpose
|
12
|
+
|
13
|
+
The OASIS ETM format is a simple XML format for representing tables for
|
14
|
+
exchange. It is used in the DocBook and NISO JATS standards.
|
15
|
+
|
16
|
+
This library provides a Ruby implementation of the
|
17
|
+
https://www.oasis-open.org/specs/a503.htm[OASIS Technical Resolution TR 9503:1995].
|
18
|
+
|
19
|
+
|
20
|
+
== Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
[source,ruby]
|
25
|
+
----
|
26
|
+
gem 'oasis-etm'
|
27
|
+
----
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
[source,shell]
|
32
|
+
----
|
33
|
+
bundle install
|
34
|
+
----
|
35
|
+
|
36
|
+
Or install it yourself as:
|
37
|
+
|
38
|
+
[source,shell]
|
39
|
+
----
|
40
|
+
gem install oasis-etm
|
41
|
+
----
|
42
|
+
|
43
|
+
|
44
|
+
== Usage
|
45
|
+
|
46
|
+
=== Basic example
|
47
|
+
|
48
|
+
[source,ruby]
|
49
|
+
----
|
50
|
+
require 'oasis-etm'
|
51
|
+
|
52
|
+
# Parse an ETM XML file
|
53
|
+
table = Oasis::Etm::Table.from_xml(File.read('table.xml'))
|
54
|
+
|
55
|
+
# Access table attributes
|
56
|
+
puts table.frame
|
57
|
+
puts table.colsep
|
58
|
+
puts table.rowsep
|
59
|
+
|
60
|
+
# Access table content
|
61
|
+
table.tgroups.each do |tgroup|
|
62
|
+
tgroup.colspecs.each do |colspec|
|
63
|
+
puts "Column #{colspec.colnum}: #{colspec.colwidth}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Create a new table
|
68
|
+
table = Oasis::Etm::Table.new(
|
69
|
+
frame: 'all',
|
70
|
+
colsep: 1,
|
71
|
+
rowsep: 1,
|
72
|
+
tgroups: [
|
73
|
+
Oasis::Etm::Tgroup.new(
|
74
|
+
cols: 3,
|
75
|
+
colspecs: [
|
76
|
+
Oasis::Etm::Colspec.new(colnum: 1, colwidth: '1*'),
|
77
|
+
Oasis::Etm::Colspec.new(colnum: 2, colwidth: '2*'),
|
78
|
+
Oasis::Etm::Colspec.new(colnum: 3, colwidth: '1*')
|
79
|
+
]
|
80
|
+
)
|
81
|
+
]
|
82
|
+
)
|
83
|
+
|
84
|
+
# Convert to XML
|
85
|
+
xml = table.to_xml
|
86
|
+
----
|
87
|
+
|
88
|
+
=== XML schema
|
89
|
+
|
90
|
+
The OASIS ETM format follows this basic structure:
|
91
|
+
|
92
|
+
[source,xml]
|
93
|
+
----
|
94
|
+
<table frame="all" colsep="1" rowsep="1">
|
95
|
+
<title>Sample Table</title>
|
96
|
+
<tgroup cols="3">
|
97
|
+
<colspec colnum="1" colwidth="1*"/>
|
98
|
+
<colspec colnum="2" colwidth="2*"/>
|
99
|
+
<colspec colnum="3" colwidth="1*"/>
|
100
|
+
<thead>
|
101
|
+
<row>
|
102
|
+
<entry>Header 1</entry>
|
103
|
+
<entry>Header 2</entry>
|
104
|
+
<entry>Header 3</entry>
|
105
|
+
</row>
|
106
|
+
</thead>
|
107
|
+
<tbody>
|
108
|
+
<row>
|
109
|
+
<entry>Cell 1</entry>
|
110
|
+
<entry>Cell 2</entry>
|
111
|
+
<entry>Cell 3</entry>
|
112
|
+
</row>
|
113
|
+
</tbody>
|
114
|
+
</tgroup>
|
115
|
+
</table>
|
116
|
+
----
|
117
|
+
|
118
|
+
== Development
|
119
|
+
|
120
|
+
=== Test files
|
121
|
+
|
122
|
+
`spec/fixtures/native/docbook_example.xml`::
|
123
|
+
https://tdg.docbook.org/tdg/4.5/table
|
124
|
+
|
125
|
+
`spec/fixtures/niso-jats/niso-jats-table-wrap.xml`::
|
126
|
+
https://jats.nlm.nih.gov/options/OASIS/tag-library/19990315/element/oasis-table.html
|
127
|
+
This is to test the OASIS exchange table model when it is namespaced from
|
128
|
+
another location.
|
129
|
+
|
130
|
+
`spec/fixtures/isosts/isosts_tables.cals.{nn}.xml`::
|
131
|
+
Tables extracted from https://www.iso.org/schema/isosts/cals/test/isosts_tables.cals.xml.
|
132
|
+
This is to test the OASIS exchange table model when it is namespaced from
|
133
|
+
another location.
|
134
|
+
|
135
|
+
|
136
|
+
== Contributing
|
137
|
+
|
138
|
+
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
|
139
|
+
|
140
|
+
. Fork it
|
141
|
+
. Create your feature branch (`git checkout -b my-new-feature`)
|
142
|
+
. Commit your changes (`git commit -am 'Add some feature'`)
|
143
|
+
. Push to the branch (`git push origin my-new-feature`)
|
144
|
+
. Create new Pull Request
|
145
|
+
|
146
|
+
|
147
|
+
== License and Copyright
|
148
|
+
|
149
|
+
This project is licensed under the BSD 2-clause License.
|
150
|
+
See the link:LICENSE.md[] file for details.
|
151
|
+
|
152
|
+
Copyright Ribose.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "oasis/etm"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "irb"
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Oasis
|
2
|
+
module Etm
|
3
|
+
class Colspec < Lutaml::Model::Serializable
|
4
|
+
# Optional attributes
|
5
|
+
attribute :colnum, :integer
|
6
|
+
attribute :colname, :string
|
7
|
+
attribute :colwidth, :string
|
8
|
+
attribute :colsep, :integer, values: [0, 1]
|
9
|
+
attribute :rowsep, :integer, values: [0, 1]
|
10
|
+
attribute :align, :string, values: %w[left right center justify char]
|
11
|
+
attribute :char, :string
|
12
|
+
attribute :charoff, :string
|
13
|
+
|
14
|
+
xml do
|
15
|
+
root "colspec"
|
16
|
+
|
17
|
+
map_attribute "colnum", to: :colnum
|
18
|
+
map_attribute "colname", to: :colname
|
19
|
+
map_attribute "colwidth", to: :colwidth
|
20
|
+
map_attribute "colsep", to: :colsep
|
21
|
+
map_attribute "rowsep", to: :rowsep
|
22
|
+
map_attribute "align", to: :align
|
23
|
+
map_attribute "char", to: :char
|
24
|
+
map_attribute "charoff", to: :charoff
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Oasis
|
2
|
+
module Etm
|
3
|
+
class Entry < Lutaml::Model::Serializable
|
4
|
+
# Optional attributes
|
5
|
+
attribute :colname, :string
|
6
|
+
attribute :namest, :string
|
7
|
+
attribute :nameend, :string
|
8
|
+
attribute :morerows, :integer
|
9
|
+
attribute :colsep, :integer, values: [0, 1]
|
10
|
+
attribute :rowsep, :integer, values: [0, 1]
|
11
|
+
attribute :align, :string, values: %w[left right center justify char]
|
12
|
+
attribute :char, :string
|
13
|
+
attribute :charoff, :string
|
14
|
+
attribute :valign, :string, values: %w[top middle bottom]
|
15
|
+
|
16
|
+
# Content
|
17
|
+
attribute :content, :string
|
18
|
+
|
19
|
+
xml do
|
20
|
+
root "entry"
|
21
|
+
|
22
|
+
# Attribute mappings
|
23
|
+
map_attribute "colname", to: :colname
|
24
|
+
map_attribute "namest", to: :namest
|
25
|
+
map_attribute "nameend", to: :nameend
|
26
|
+
map_attribute "morerows", to: :morerows
|
27
|
+
map_attribute "colsep", to: :colsep
|
28
|
+
map_attribute "rowsep", to: :rowsep
|
29
|
+
map_attribute "align", to: :align
|
30
|
+
map_attribute "char", to: :char
|
31
|
+
map_attribute "charoff", to: :charoff
|
32
|
+
map_attribute "valign", to: :valign
|
33
|
+
|
34
|
+
# Content mapping
|
35
|
+
map_content to: :content
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative "entry"
|
2
|
+
|
3
|
+
module Oasis
|
4
|
+
module Etm
|
5
|
+
class Row < Lutaml::Model::Serializable
|
6
|
+
# Optional attributes
|
7
|
+
attribute :rowsep, :integer, values: [0, 1]
|
8
|
+
attribute :valign, :string, values: %w[top middle bottom]
|
9
|
+
|
10
|
+
# Content
|
11
|
+
attribute :entries, Entry, collection: true
|
12
|
+
|
13
|
+
xml do
|
14
|
+
root "row"
|
15
|
+
|
16
|
+
map_attribute "rowsep", to: :rowsep
|
17
|
+
map_attribute "valign", to: :valign
|
18
|
+
map_element "entry", to: :entries
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative "tgroup"
|
2
|
+
|
3
|
+
module Oasis
|
4
|
+
module Etm
|
5
|
+
class Table < Lutaml::Model::Serializable
|
6
|
+
# Table attributes
|
7
|
+
attribute :frame, :string, values: %w[top bottom topbot all sides none]
|
8
|
+
attribute :colsep, :integer, values: [0, 1]
|
9
|
+
attribute :rowsep, :integer, values: [0, 1]
|
10
|
+
attribute :pgwide, :integer, values: [0, 1]
|
11
|
+
|
12
|
+
# Table content
|
13
|
+
attribute :title, :string
|
14
|
+
attribute :tgroups, Tgroup, collection: true
|
15
|
+
|
16
|
+
xml do
|
17
|
+
root "table"
|
18
|
+
|
19
|
+
# Frame mappings
|
20
|
+
map_attribute "frame", to: :frame
|
21
|
+
map_attribute "colsep", to: :colsep
|
22
|
+
map_attribute "rowsep", to: :rowsep
|
23
|
+
map_attribute "pgwide", to: :pgwide
|
24
|
+
|
25
|
+
# Content mappings
|
26
|
+
map_element "title", to: :title
|
27
|
+
map_element "tgroup", to: :tgroups
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative "row"
|
2
|
+
|
3
|
+
module Oasis
|
4
|
+
module Etm
|
5
|
+
class Tbody < Lutaml::Model::Serializable
|
6
|
+
# Optional attributes
|
7
|
+
attribute :valign, :string, values: %w[top middle bottom]
|
8
|
+
|
9
|
+
# Content
|
10
|
+
attribute :rows, Row, collection: true
|
11
|
+
|
12
|
+
xml do
|
13
|
+
root "tbody"
|
14
|
+
|
15
|
+
map_attribute "valign", to: :valign
|
16
|
+
map_element "row", to: :rows
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Oasis
|
2
|
+
module Etm
|
3
|
+
class Colspec < Lutaml::Model::Serializable
|
4
|
+
# Optional attributes
|
5
|
+
attribute :colnum, :integer
|
6
|
+
attribute :colname, :string
|
7
|
+
attribute :colwidth, :string
|
8
|
+
attribute :colsep, :integer, values: [0, 1]
|
9
|
+
attribute :rowsep, :integer, values: [0, 1]
|
10
|
+
attribute :align, :string, values: %w[left right center justify char]
|
11
|
+
attribute :char, :string
|
12
|
+
attribute :charoff, :string
|
13
|
+
|
14
|
+
xml do
|
15
|
+
root "colspec"
|
16
|
+
|
17
|
+
map_attribute "colnum", to: :colnum
|
18
|
+
map_attribute "colname", to: :colname
|
19
|
+
map_attribute "colwidth", to: :colwidth
|
20
|
+
map_attribute "colsep", to: :colsep
|
21
|
+
map_attribute "rowsep", to: :rowsep
|
22
|
+
map_attribute "align", to: :align
|
23
|
+
map_attribute "char", to: :char
|
24
|
+
map_attribute "charoff", to: :charoff
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative "colspec"
|
2
|
+
require_relative "thead"
|
3
|
+
require_relative "tbody"
|
4
|
+
|
5
|
+
module Oasis
|
6
|
+
module Etm
|
7
|
+
class Tgroup < Lutaml::Model::Serializable
|
8
|
+
# Required attributes
|
9
|
+
attribute :cols, :integer
|
10
|
+
|
11
|
+
# Optional attributes
|
12
|
+
attribute :colsep, :integer, values: [0, 1]
|
13
|
+
attribute :rowsep, :integer, values: [0, 1]
|
14
|
+
attribute :align, :string, values: %w[left right center justify char]
|
15
|
+
|
16
|
+
# Content
|
17
|
+
attribute :colspecs, Colspec, collection: true
|
18
|
+
attribute :thead, Thead
|
19
|
+
attribute :tbody, Tbody
|
20
|
+
|
21
|
+
xml do
|
22
|
+
root "tgroup"
|
23
|
+
|
24
|
+
# Attribute mappings
|
25
|
+
map_attribute "cols", to: :cols
|
26
|
+
map_attribute "colsep", to: :colsep
|
27
|
+
map_attribute "rowsep", to: :rowsep
|
28
|
+
map_attribute "align", to: :align
|
29
|
+
|
30
|
+
# Content mappings
|
31
|
+
map_element "colspec", to: :colspecs
|
32
|
+
map_element "thead", to: :thead
|
33
|
+
map_element "tbody", to: :tbody
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative "row"
|
2
|
+
|
3
|
+
module Oasis
|
4
|
+
module Etm
|
5
|
+
class Thead < Lutaml::Model::Serializable
|
6
|
+
# Optional attributes
|
7
|
+
attribute :valign, :string, values: %w[top middle bottom]
|
8
|
+
|
9
|
+
# Content
|
10
|
+
attribute :rows, Row, collection: true
|
11
|
+
|
12
|
+
xml do
|
13
|
+
root "thead"
|
14
|
+
|
15
|
+
map_attribute "valign", to: :valign
|
16
|
+
map_element "row", to: :rows
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|