Skip to content

Commit

Permalink
fix: native round-trip specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Nov 1, 2024
1 parent 0d8eb4a commit 2279c62
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
14 changes: 14 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ exchange. It is used in the DocBook and NISO JATS standards.
This library provides a Ruby implementation of the
https://www.oasis-open.org/specs/a503.htm[OASIS Technical Resolution TR 9503:1995].

== Features

* Full implementation of the OASIS Exchange Table Model TR 9503:1995
* Intentionally excludes CALS table features not part of the Exchange subset (like `tfoot`)
* XML serialization and deserialization
* Validation of attribute values
* Support for all Exchange Table Model elements:
** `table`
** `tgroup`
** `colspec`
** `thead`
** `tbody`
** `row`
** `entry`

== Installation

Expand Down
2 changes: 1 addition & 1 deletion lib/oasis/etm/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Entry < Lutaml::Model::Serializable
attribute :valign, :string, values: %w[top middle bottom]

# Content
attribute :content, :string
attribute :content, :string, raw: true

xml do
root "entry"
Expand Down
2 changes: 1 addition & 1 deletion lib/oasis/etm/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Table < Lutaml::Model::Serializable
attribute :tgroups, Tgroup, collection: true

xml do
root "table"
root "table", ordered: true

# Frame mappings
map_attribute "frame", to: :frame
Expand Down
2 changes: 1 addition & 1 deletion lib/oasis/etm/tgroup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Tgroup < Lutaml::Model::Serializable
attribute :tbody, Tbody

xml do
root "tgroup"
root "tgroup", ordered: true

# Attribute mappings
map_attribute "cols", to: :cols
Expand Down
5 changes: 3 additions & 2 deletions spec/fixtures/native/docbook_example.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!-- <!DOCTYPE table PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> -->
<!-- tfoot commented out to comply with ETM (it is a CALS thing -->
<table frame='all'><title>Sample Table</title>
<tgroup cols='5' align='left' colsep='1' rowsep='1'>
<colspec colname='c1'/>
Expand All @@ -14,15 +15,15 @@
<entry>a5</entry>
</row>
</thead>
<tfoot>
<!-- <tfoot>
<row>
<entry>f1</entry>
<entry>f2</entry>
<entry>f3</entry>
<entry>f4</entry>
<entry>f5</entry>
</row>
</tfoot>
</tfoot> -->
<tbody>
<row>
<entry>b1</entry>
Expand Down

0 comments on commit 2279c62

Please sign in to comment.