sts 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. checksums.yaml +4 -4
  2. data/GAPS.guidelines.iso-sts-ed2.1/01-maintenance.md +19 -0
  3. data/GAPS.guidelines.iso-sts-ed2.1/03-general.md +75 -0
  4. data/GAPS.guidelines.iso-sts-ed2.1/04-structure.md +75 -0
  5. data/GAPS.guidelines.iso-sts-ed2.1/05-content.md +63 -0
  6. data/GAPS.guidelines.iso-sts-ed2.1/06-tables.md +53 -0
  7. data/GAPS.guidelines.iso-sts-ed2.1/07-formulae.md +41 -0
  8. data/GAPS.guidelines.iso-sts-ed2.1/08-figures.md +45 -0
  9. data/GAPS.guidelines.iso-sts-ed2.1/09-terms.md +56 -0
  10. data/GAPS.guidelines.iso-sts-ed2.1/10-references.md +56 -0
  11. data/GAPS.guidelines.iso-sts-ed2.1/annex-a-multilingual.md +79 -0
  12. data/GAPS.guidelines.niso-sts-v1.0/01-introduction-scope.md +27 -0
  13. data/GAPS.guidelines.niso-sts-v1.0/02-document-structure.md +100 -0
  14. data/GAPS.guidelines.niso-sts-v1.0/03-front-matter.md +149 -0
  15. data/GAPS.guidelines.niso-sts-v1.0/04-body-content.md +209 -0
  16. data/GAPS.guidelines.niso-sts-v1.0/05-tables-figures.md +152 -0
  17. data/GAPS.guidelines.niso-sts-v1.0/06-math-formulae.md +128 -0
  18. data/GAPS.guidelines.niso-sts-v1.0/07-references.md +113 -0
  19. data/GAPS.guidelines.niso-sts-v1.0/08-terminology.md +127 -0
  20. data/GAPS.guidelines.niso-sts-v1.0/09-metadata.md +113 -0
  21. data/GAPS.guidelines.niso-sts-v1.0/10-iso-iec-variant.md +141 -0
  22. data/GAPS.guidelines.niso-sts-v1.0/SUMMARY.md +96 -0
  23. data/GAPS.guidelines.schema-xref.md +101 -0
  24. data/Gemfile +1 -0
  25. data/TODO.sts-refactor/00-overview.md +172 -0
  26. data/TODO.sts-refactor/01-mathml-delegation.md +153 -0
  27. data/TODO.sts-refactor/02-type-resolution.md +122 -0
  28. data/TODO.sts-refactor/03-namespace-coupling.md +158 -0
  29. data/TODO.sts-refactor/04-register-versioning.md +180 -0
  30. data/TODO.sts-refactor/05-missing-elements.md +195 -0
  31. data/TODO.sts-refactor/06-missing-attributes.md +152 -0
  32. data/TODO.sts-refactor/07-incomplete-models.md +180 -0
  33. data/TODO.sts-refactor/08-isoiec-profile.md +169 -0
  34. data/TODO.sts-refactor/09-autoload-cleanup.md +88 -0
  35. data/TODO.sts-refactor/10-test-coverage.md +164 -0
  36. data/TODO.sts-refactor/11-duplicate-models.md +168 -0
  37. data/lib/sts/iso_sts/annex_type.rb +2 -0
  38. data/lib/sts/iso_sts/bold.rb +9 -9
  39. data/lib/sts/iso_sts/break.rb +3 -0
  40. data/lib/sts/iso_sts/comm_ref.rb +2 -0
  41. data/lib/sts/iso_sts/content_language.rb +22 -0
  42. data/lib/sts/iso_sts/copyright_holder.rb +4 -2
  43. data/lib/sts/iso_sts/copyright_statement.rb +4 -2
  44. data/lib/sts/iso_sts/copyright_year.rb +3 -0
  45. data/lib/sts/iso_sts/doc_ref.rb +2 -0
  46. data/lib/sts/iso_sts/document_identification.rb +2 -0
  47. data/lib/sts/iso_sts/edition.rb +2 -0
  48. data/lib/sts/iso_sts/ext_link.rb +1 -1
  49. data/lib/sts/iso_sts/front.rb +2 -0
  50. data/lib/sts/iso_sts/iso_meta.rb +2 -2
  51. data/lib/sts/iso_sts/italic.rb +9 -9
  52. data/lib/sts/iso_sts/label.rb +7 -5
  53. data/lib/sts/iso_sts/language.rb +2 -0
  54. data/lib/sts/iso_sts/meta_date.rb +20 -0
  55. data/lib/sts/iso_sts/mixed_citation.rb +5 -5
  56. data/lib/sts/iso_sts/monospace.rb +26 -0
  57. data/lib/sts/iso_sts/named_content.rb +44 -0
  58. data/lib/sts/iso_sts/nat_meta.rb +4 -4
  59. data/lib/sts/iso_sts/page_count.rb +2 -0
  60. data/lib/sts/iso_sts/paragraph.rb +8 -8
  61. data/lib/sts/iso_sts/permissions.rb +2 -0
  62. data/lib/sts/iso_sts/preformat.rb +3 -3
  63. data/lib/sts/iso_sts/reg_meta.rb +4 -4
  64. data/lib/sts/iso_sts/release_date.rb +2 -0
  65. data/lib/sts/iso_sts/sc.rb +26 -0
  66. data/lib/sts/iso_sts/sec.rb +2 -2
  67. data/lib/sts/iso_sts/secretariat.rb +2 -0
  68. data/lib/sts/iso_sts/standard_cross_reference.rb +4 -2
  69. data/lib/sts/iso_sts/standard_identification.rb +2 -0
  70. data/lib/sts/iso_sts/standard_ref.rb +16 -0
  71. data/lib/sts/iso_sts/std.rb +3 -1
  72. data/lib/sts/iso_sts/std_ref.rb +2 -0
  73. data/lib/sts/iso_sts/strike.rb +26 -0
  74. data/lib/sts/iso_sts/styled_content.rb +11 -9
  75. data/lib/sts/iso_sts/sub.rb +2 -0
  76. data/lib/sts/iso_sts/sup.rb +2 -0
  77. data/lib/sts/iso_sts/table_wrap_foot.rb +2 -0
  78. data/lib/sts/iso_sts/td.rb +7 -7
  79. data/lib/sts/iso_sts/term.rb +5 -5
  80. data/lib/sts/iso_sts/th.rb +7 -7
  81. data/lib/sts/iso_sts/title.rb +6 -4
  82. data/lib/sts/iso_sts/title_compl.rb +2 -0
  83. data/lib/sts/iso_sts/title_full.rb +2 -0
  84. data/lib/sts/iso_sts/title_intro.rb +2 -0
  85. data/lib/sts/iso_sts/title_main.rb +2 -0
  86. data/lib/sts/iso_sts/underline.rb +26 -0
  87. data/lib/sts/iso_sts/uri.rb +32 -0
  88. data/lib/sts/iso_sts/xref.rb +3 -3
  89. data/lib/sts/iso_sts.rb +9 -0
  90. data/lib/sts/mathml.rb +12 -58
  91. data/lib/sts/namespaces.rb +2 -0
  92. data/lib/sts/niso_sts/abstract.rb +2 -0
  93. data/lib/sts/niso_sts/access_date.rb +2 -0
  94. data/lib/sts/niso_sts/accrediting_organization.rb +2 -0
  95. data/lib/sts/niso_sts/addr_line.rb +2 -0
  96. data/lib/sts/niso_sts/address.rb +2 -0
  97. data/lib/sts/niso_sts/aff_alternatives.rb +3 -0
  98. data/lib/sts/niso_sts/alt_text.rb +2 -0
  99. data/lib/sts/niso_sts/alt_title.rb +2 -0
  100. data/lib/sts/niso_sts/alternatives.rb +2 -0
  101. data/lib/sts/niso_sts/anonymous.rb +3 -0
  102. data/lib/sts/niso_sts/app.rb +2 -0
  103. data/lib/sts/niso_sts/article_title.rb +2 -0
  104. data/lib/sts/niso_sts/attrib.rb +2 -0
  105. data/lib/sts/niso_sts/authorization.rb +2 -0
  106. data/lib/sts/niso_sts/award_group.rb +22 -4
  107. data/lib/sts/niso_sts/award_id.rb +6 -0
  108. data/lib/sts/niso_sts/back.rb +22 -4
  109. data/lib/sts/niso_sts/body.rb +2 -0
  110. data/lib/sts/niso_sts/boxed_text.rb +38 -4
  111. data/lib/sts/niso_sts/break.rb +3 -0
  112. data/lib/sts/niso_sts/caption.rb +8 -0
  113. data/lib/sts/niso_sts/chapter_title.rb +2 -0
  114. data/lib/sts/niso_sts/chem_struct.rb +2 -0
  115. data/lib/sts/niso_sts/citation_alternatives.rb +2 -0
  116. data/lib/sts/niso_sts/city.rb +2 -0
  117. data/lib/sts/niso_sts/code.rb +111 -0
  118. data/lib/sts/niso_sts/collab_alternatives.rb +3 -0
  119. data/lib/sts/niso_sts/comm_ref_group.rb +3 -0
  120. data/lib/sts/niso_sts/comment.rb +2 -0
  121. data/lib/sts/niso_sts/compound_subject.rb +29 -0
  122. data/lib/sts/niso_sts/compound_subject_part.rb +39 -0
  123. data/lib/sts/niso_sts/conf_acronym.rb +2 -0
  124. data/lib/sts/niso_sts/conf_date.rb +2 -0
  125. data/lib/sts/niso_sts/conf_loc.rb +2 -0
  126. data/lib/sts/niso_sts/conf_name.rb +2 -0
  127. data/lib/sts/niso_sts/conf_num.rb +2 -0
  128. data/lib/sts/niso_sts/conf_sponsor.rb +2 -0
  129. data/lib/sts/niso_sts/conf_theme.rb +2 -0
  130. data/lib/sts/niso_sts/conference.rb +2 -0
  131. data/lib/sts/niso_sts/content_language.rb +2 -0
  132. data/lib/sts/niso_sts/contrib_id.rb +2 -0
  133. data/lib/sts/niso_sts/copyright_holder.rb +2 -0
  134. data/lib/sts/niso_sts/copyright_statement.rb +2 -0
  135. data/lib/sts/niso_sts/copyright_year.rb +2 -0
  136. data/lib/sts/niso_sts/country.rb +2 -0
  137. data/lib/sts/niso_sts/counts.rb +2 -0
  138. data/lib/sts/niso_sts/custom_meta.rb +2 -0
  139. data/lib/sts/niso_sts/custom_meta_group.rb +3 -0
  140. data/lib/sts/niso_sts/data_title.rb +29 -0
  141. data/lib/sts/niso_sts/date.rb +2 -0
  142. data/lib/sts/niso_sts/date_in_citation.rb +2 -0
  143. data/lib/sts/niso_sts/day.rb +2 -0
  144. data/lib/sts/niso_sts/def.rb +3 -0
  145. data/lib/sts/niso_sts/def_head.rb +18 -0
  146. data/lib/sts/niso_sts/def_item.rb +4 -0
  147. data/lib/sts/niso_sts/def_list.rb +21 -4
  148. data/lib/sts/niso_sts/degrees.rb +2 -0
  149. data/lib/sts/niso_sts/disp_formula_group.rb +0 -2
  150. data/lib/sts/niso_sts/disp_quote.rb +2 -0
  151. data/lib/sts/niso_sts/display_formula.rb +37 -4
  152. data/lib/sts/niso_sts/doc_number.rb +2 -0
  153. data/lib/sts/niso_sts/doc_type.rb +2 -0
  154. data/lib/sts/niso_sts/editing_instruction.rb +8 -2
  155. data/lib/sts/niso_sts/edition.rb +2 -0
  156. data/lib/sts/niso_sts/elocation_id.rb +2 -0
  157. data/lib/sts/niso_sts/email.rb +2 -0
  158. data/lib/sts/niso_sts/equation_count.rb +2 -0
  159. data/lib/sts/niso_sts/era.rb +2 -0
  160. data/lib/sts/niso_sts/ext_link.rb +16 -0
  161. data/lib/sts/niso_sts/fax.rb +2 -0
  162. data/lib/sts/niso_sts/fig_count.rb +2 -0
  163. data/lib/sts/niso_sts/floats_group.rb +2 -0
  164. data/lib/sts/niso_sts/fn_group.rb +3 -0
  165. data/lib/sts/niso_sts/fpage.rb +2 -0
  166. data/lib/sts/niso_sts/front.rb +15 -0
  167. data/lib/sts/niso_sts/funding_source.rb +2 -0
  168. data/lib/sts/niso_sts/given_names.rb +2 -0
  169. data/lib/sts/niso_sts/gov.rb +2 -0
  170. data/lib/sts/niso_sts/graphic.rb +4 -0
  171. data/lib/sts/niso_sts/hr.rb +3 -0
  172. data/lib/sts/niso_sts/ics.rb +3 -0
  173. data/lib/sts/niso_sts/ics_desc.rb +2 -0
  174. data/lib/sts/niso_sts/ics_wrap.rb +9 -0
  175. data/lib/sts/niso_sts/index.rb +32 -0
  176. data/lib/sts/niso_sts/index_div.rb +30 -0
  177. data/lib/sts/niso_sts/index_entry.rb +32 -0
  178. data/lib/sts/niso_sts/index_title_group.rb +22 -0
  179. data/lib/sts/niso_sts/inline_formula.rb +29 -4
  180. data/lib/sts/niso_sts/inline_media.rb +50 -0
  181. data/lib/sts/niso_sts/institution.rb +2 -0
  182. data/lib/sts/niso_sts/institution_id.rb +2 -0
  183. data/lib/sts/niso_sts/institution_wrap.rb +2 -0
  184. data/lib/sts/niso_sts/intro.rb +2 -0
  185. data/lib/sts/niso_sts/is_proof.rb +2 -0
  186. data/lib/sts/niso_sts/isbn.rb +2 -0
  187. data/lib/sts/niso_sts/issn.rb +2 -0
  188. data/lib/sts/niso_sts/issn_l.rb +2 -0
  189. data/lib/sts/niso_sts/issue.rb +2 -0
  190. data/lib/sts/niso_sts/kwd_group.rb +8 -0
  191. data/lib/sts/niso_sts/label.rb +4 -0
  192. data/lib/sts/niso_sts/legend.rb +39 -0
  193. data/lib/sts/niso_sts/license.rb +2 -0
  194. data/lib/sts/niso_sts/license_p.rb +2 -0
  195. data/lib/sts/niso_sts/list.rb +2 -0
  196. data/lib/sts/niso_sts/list_item.rb +2 -2
  197. data/lib/sts/niso_sts/long_desc.rb +2 -0
  198. data/lib/sts/niso_sts/lpage.rb +2 -0
  199. data/lib/sts/niso_sts/main.rb +2 -0
  200. data/lib/sts/niso_sts/meta_date.rb +2 -0
  201. data/lib/sts/niso_sts/metadata_std.rb +0 -2
  202. data/lib/sts/niso_sts/mml_content.rb +0 -2
  203. data/lib/sts/niso_sts/month.rb +2 -0
  204. data/lib/sts/niso_sts/name.rb +2 -0
  205. data/lib/sts/niso_sts/name_alternatives.rb +5 -0
  206. data/lib/sts/niso_sts/named_content.rb +51 -1
  207. data/lib/sts/niso_sts/nat_meta.rb +2 -0
  208. data/lib/sts/niso_sts/nested_kwd.rb +2 -0
  209. data/lib/sts/niso_sts/non_normative_note.rb +2 -0
  210. data/lib/sts/niso_sts/normative_note.rb +2 -0
  211. data/lib/sts/niso_sts/object_id.rb +4 -0
  212. data/lib/sts/niso_sts/on_behalf_of.rb +2 -0
  213. data/lib/sts/niso_sts/open_access.rb +2 -0
  214. data/lib/sts/niso_sts/originator.rb +2 -0
  215. data/lib/sts/niso_sts/page_count.rb +2 -0
  216. data/lib/sts/niso_sts/page_range.rb +2 -0
  217. data/lib/sts/niso_sts/paragraph.rb +2 -0
  218. data/lib/sts/niso_sts/part_number.rb +2 -0
  219. data/lib/sts/niso_sts/part_of_speech.rb +2 -0
  220. data/lib/sts/niso_sts/patent.rb +2 -0
  221. data/lib/sts/niso_sts/permissions.rb +6 -1
  222. data/lib/sts/niso_sts/phone.rb +2 -0
  223. data/lib/sts/niso_sts/postal_code.rb +2 -0
  224. data/lib/sts/niso_sts/prefix.rb +2 -0
  225. data/lib/sts/niso_sts/price.rb +2 -0
  226. data/lib/sts/niso_sts/principal_award_recipient.rb +2 -0
  227. data/lib/sts/niso_sts/principal_investigator.rb +2 -0
  228. data/lib/sts/niso_sts/private_char.rb +2 -0
  229. data/lib/sts/niso_sts/processing_meta.rb +54 -0
  230. data/lib/sts/niso_sts/product.rb +2 -0
  231. data/lib/sts/niso_sts/proj_id.rb +2 -0
  232. data/lib/sts/niso_sts/pub_date.rb +2 -0
  233. data/lib/sts/niso_sts/pub_id.rb +2 -0
  234. data/lib/sts/niso_sts/publisher.rb +2 -0
  235. data/lib/sts/niso_sts/publisher_loc.rb +2 -0
  236. data/lib/sts/niso_sts/publisher_name.rb +2 -0
  237. data/lib/sts/niso_sts/ref_count.rb +2 -0
  238. data/lib/sts/niso_sts/reference_standard.rb +2 -2
  239. data/lib/sts/niso_sts/reg_meta.rb +2 -0
  240. data/lib/sts/niso_sts/related_term.rb +2 -0
  241. data/lib/sts/niso_sts/release_date.rb +2 -0
  242. data/lib/sts/niso_sts/release_version.rb +2 -0
  243. data/lib/sts/niso_sts/release_version_id.rb +2 -0
  244. data/lib/sts/niso_sts/role.rb +35 -0
  245. data/lib/sts/niso_sts/sdo.rb +2 -0
  246. data/lib/sts/niso_sts/season.rb +2 -0
  247. data/lib/sts/niso_sts/sec_meta.rb +26 -0
  248. data/lib/sts/niso_sts/secretariat.rb +2 -0
  249. data/lib/sts/niso_sts/section.rb +8 -0
  250. data/lib/sts/niso_sts/see_also_entry.rb +26 -0
  251. data/lib/sts/niso_sts/see_entry.rb +26 -0
  252. data/lib/sts/niso_sts/self_uri.rb +2 -0
  253. data/lib/sts/niso_sts/series.rb +2 -0
  254. data/lib/sts/niso_sts/series_text.rb +2 -0
  255. data/lib/sts/niso_sts/series_title.rb +2 -0
  256. data/lib/sts/niso_sts/sig.rb +2 -0
  257. data/lib/sts/niso_sts/size.rb +2 -0
  258. data/lib/sts/niso_sts/source.rb +29 -0
  259. data/lib/sts/niso_sts/speaker.rb +2 -0
  260. data/lib/sts/niso_sts/standard_identification.rb +2 -0
  261. data/lib/sts/niso_sts/state.rb +2 -0
  262. data/lib/sts/niso_sts/std_doc_meta.rb +49 -11
  263. data/lib/sts/niso_sts/std_id.rb +2 -0
  264. data/lib/sts/niso_sts/std_id_group.rb +3 -0
  265. data/lib/sts/niso_sts/std_org_abbrev.rb +2 -0
  266. data/lib/sts/niso_sts/std_org_group.rb +3 -0
  267. data/lib/sts/niso_sts/std_org_name.rb +2 -0
  268. data/lib/sts/niso_sts/std_organization.rb +2 -0
  269. data/lib/sts/niso_sts/string_conf.rb +2 -0
  270. data/lib/sts/niso_sts/string_date.rb +2 -0
  271. data/lib/sts/niso_sts/string_name.rb +2 -0
  272. data/lib/sts/niso_sts/styled_content.rb +2 -0
  273. data/lib/sts/niso_sts/subj_group.rb +11 -1
  274. data/lib/sts/niso_sts/subtitle.rb +2 -0
  275. data/lib/sts/niso_sts/suffix.rb +2 -0
  276. data/lib/sts/niso_sts/suppl_number.rb +2 -0
  277. data/lib/sts/niso_sts/suppl_type.rb +2 -0
  278. data/lib/sts/niso_sts/suppl_version.rb +2 -0
  279. data/lib/sts/niso_sts/surname.rb +2 -0
  280. data/lib/sts/niso_sts/table_count.rb +2 -0
  281. data/lib/sts/niso_sts/table_wrap_group.rb +32 -0
  282. data/lib/sts/niso_sts/term_display.rb +22 -1
  283. data/lib/sts/niso_sts/term_display_string.rb +22 -0
  284. data/lib/sts/niso_sts/term_head.rb +2 -0
  285. data/lib/sts/niso_sts/term_source.rb +2 -0
  286. data/lib/sts/niso_sts/tex_math.rb +2 -0
  287. data/lib/sts/niso_sts/textual_form.rb +2 -0
  288. data/lib/sts/niso_sts/time_stamp.rb +2 -0
  289. data/lib/sts/niso_sts/title.rb +6 -0
  290. data/lib/sts/niso_sts/title_wrap.rb +2 -0
  291. data/lib/sts/niso_sts/toc.rb +32 -0
  292. data/lib/sts/niso_sts/toc_div.rb +30 -0
  293. data/lib/sts/niso_sts/toc_entry.rb +30 -0
  294. data/lib/sts/niso_sts/toc_title_group.rb +22 -0
  295. data/lib/sts/niso_sts/trans_source.rb +2 -0
  296. data/lib/sts/niso_sts/trans_title.rb +2 -0
  297. data/lib/sts/niso_sts/trans_title_group.rb +3 -0
  298. data/lib/sts/niso_sts/uri.rb +2 -0
  299. data/lib/sts/niso_sts/urn.rb +2 -0
  300. data/lib/sts/niso_sts/verse_line.rb +2 -0
  301. data/lib/sts/niso_sts/version.rb +2 -0
  302. data/lib/sts/niso_sts/volume.rb +2 -0
  303. data/lib/sts/niso_sts/volume_id.rb +2 -0
  304. data/lib/sts/niso_sts/volume_issue_group.rb +2 -0
  305. data/lib/sts/niso_sts/volume_series.rb +2 -0
  306. data/lib/sts/niso_sts/word_count.rb +2 -0
  307. data/lib/sts/niso_sts/year.rb +2 -0
  308. data/lib/sts/niso_sts.rb +35 -10
  309. data/lib/sts/profiles/iso_iec/constraints.rb +43 -0
  310. data/lib/sts/profiles/iso_iec/validator.rb +73 -0
  311. data/lib/sts/profiles/iso_iec.rb +10 -0
  312. data/lib/sts/profiles.rb +7 -0
  313. data/lib/sts/tbx_iso_tml/bold.rb +2 -0
  314. data/lib/sts/tbx_iso_tml/caption.rb +3 -0
  315. data/lib/sts/tbx_iso_tml/cross_reference.rb +2 -0
  316. data/lib/sts/tbx_iso_tml/definition.rb +2 -0
  317. data/lib/sts/tbx_iso_tml/entailed_term.rb +2 -0
  318. data/lib/sts/tbx_iso_tml/example.rb +0 -2
  319. data/lib/sts/tbx_iso_tml/external_graphic.rb +2 -0
  320. data/lib/sts/tbx_iso_tml/external_source.rb +2 -0
  321. data/lib/sts/tbx_iso_tml/fn_group.rb +3 -0
  322. data/lib/sts/tbx_iso_tml/geographical_usage.rb +3 -0
  323. data/lib/sts/tbx_iso_tml/grammatical_gender.rb +2 -0
  324. data/lib/sts/tbx_iso_tml/grammatical_number.rb +2 -0
  325. data/lib/sts/tbx_iso_tml/italic.rb +2 -0
  326. data/lib/sts/tbx_iso_tml/lang_set.rb +2 -0
  327. data/lib/sts/tbx_iso_tml/mfenced.rb +2 -0
  328. data/lib/sts/tbx_iso_tml/mfrac.rb +2 -2
  329. data/lib/sts/tbx_iso_tml/mi.rb +3 -2
  330. data/lib/sts/tbx_iso_tml/mrow.rb +2 -2
  331. data/lib/sts/tbx_iso_tml/mspace.rb +2 -0
  332. data/lib/sts/tbx_iso_tml/mstyle.rb +2 -2
  333. data/lib/sts/tbx_iso_tml/msub.rb +2 -0
  334. data/lib/sts/tbx_iso_tml/msup.rb +2 -0
  335. data/lib/sts/tbx_iso_tml/munder.rb +3 -0
  336. data/lib/sts/tbx_iso_tml/munderover.rb +2 -0
  337. data/lib/sts/tbx_iso_tml/normative_authorization.rb +2 -0
  338. data/lib/sts/tbx_iso_tml/part_of_speech.rb +2 -0
  339. data/lib/sts/tbx_iso_tml/pronunciation.rb +3 -0
  340. data/lib/sts/tbx_iso_tml/see.rb +2 -0
  341. data/lib/sts/tbx_iso_tml/semantics.rb +2 -0
  342. data/lib/sts/tbx_iso_tml/source.rb +2 -0
  343. data/lib/sts/tbx_iso_tml/subject_field.rb +2 -0
  344. data/lib/sts/tbx_iso_tml/sup.rb +3 -2
  345. data/lib/sts/tbx_iso_tml/table_wrap.rb +0 -1
  346. data/lib/sts/tbx_iso_tml/table_wrap_foot.rb +2 -0
  347. data/lib/sts/tbx_iso_tml/td.rb +115 -24
  348. data/lib/sts/tbx_iso_tml/term_type.rb +2 -0
  349. data/lib/sts/tbx_iso_tml/th.rb +124 -30
  350. data/lib/sts/tbx_iso_tml/xref.rb +2 -2
  351. data/lib/sts/version.rb +1 -1
  352. data/lib/sts.rb +1 -12
  353. data/reference-docs/Guidelines for coding ed.2.1.pdf +0 -0
  354. data/reference-docs/NISO-STS-1-2-compare-1-0.pdf +0 -0
  355. data/reference-docs/NISOSTS-guidelines-v1.0.pdf +0 -0
  356. metadata +71 -14
  357. data/lib/sts/content_groups/helpers.rb +0 -27
  358. data/lib/sts/enum_values.rb +0 -17
  359. data/lib/sts/iso_sts/content_groups/highlight_elements.rb +0 -285
  360. data/lib/sts/niso_sts/content_groups/body_elements.rb +0 -50
  361. data/lib/sts/niso_sts/content_groups/citation_elements.rb +0 -74
  362. data/lib/sts/niso_sts/content_groups/emphasized_text.rb +0 -67
  363. data/lib/sts/niso_sts/content_groups/highlight_elements.rb +0 -51
  364. data/lib/sts/niso_sts/content_groups/inside_cell.rb +0 -116
  365. data/lib/sts/niso_sts/content_groups/p_elements.rb +0 -41
  366. data/lib/sts/niso_sts/content_groups/para_level.rb +0 -67
  367. data/lib/sts/niso_sts/content_groups/styled_content_elements.rb +0 -93
  368. data/lib/sts/niso_sts/content_groups/table_group_attributes.rb +0 -62
  369. data/lib/sts/niso_sts/content_groups.rb +0 -8
@@ -0,0 +1,96 @@
1
+ # NISO STS 1.0 Guidelines Audit: sts-ruby Gap Report Summary
2
+
3
+ **Date**: 2026-05-06
4
+ **Source**: NISO STS 1.0 - IEC/ISO Coding Guidelines (v. 1.0 / 2021-01-01)
5
+ **Audited against**: sts-ruby (branch rt-enhance-private)
6
+
7
+ ## Model Inventory
8
+
9
+ | Namespace | Classes | Directory |
10
+ |-----------|---------|-----------|
11
+ | NisoSts | 285 | lib/sts/niso_sts/ |
12
+ | IsoSts | 76 | lib/sts/iso_sts/ |
13
+ | TbxIsoTml | 52 | lib/sts/tbx_iso_tml/ |
14
+ | Sts::Mathml | 1 | lib/sts/mathml.rb |
15
+
16
+ ## Overall Assessment
17
+
18
+ sts-ruby provides **good foundational coverage** of the NISO STS 1.0 element set. All major structural elements (`<standard>`, `<front>`, `<body>`, `<back>`, `<sec>`, `<app>`, `<fig>`, `<table-wrap>`, `<p>`, `<list>`, `<xref>`, `<std>`, etc.) are modeled. The TBX terminology support is comprehensive with `termEntry`, `langSet`, `tig`, and related elements.
19
+
20
+ However, there are significant gaps in several areas that would prevent full round-trip fidelity with real-world NISO STS documents.
21
+
22
+ ## Critical Gaps (Prevent Round-Trip Fidelity)
23
+
24
+ ### 1. Missing Elements (No Model Exists)
25
+
26
+ | Element | Section | Impact |
27
+ |---------|---------|--------|
28
+ | `<index>` hierarchy (index, index-div, index-entry, index-title-group, see-entry, related-object) | 4.4.4 | Back matter index content lost |
29
+ | `<code>` with 7 attributes | 5.12 | Programming code content lost |
30
+
31
+ ### 2. Incomplete Models (Exist but Missing Critical Parts)
32
+
33
+ | Model | Missing Parts | Impact |
34
+ |-------|--------------|--------|
35
+ | `Permissions` | `<license>`, `<license-p>`, `<license_ref>`, rich `<copyright-statement>` | IEC metadata with full license text lost |
36
+ | `EditingInstruction` | `@content-type`, `<p>` child | IEC amendment instructions degraded to empty elements |
37
+ | `TermDisplay` | `<term>`, `<def>`, `<list>`, `<xref>`, `<label>` | IEC term-display content lost |
38
+ | `DefList` | `@list-content` attribute | Formula/figure/abbreviation keys lose semantic meaning |
39
+ | `Graphic` | `@id`, `<label>`, `<caption>` children | ISO sub-figure captions lost |
40
+ | `Front` (NisoSts) | `<std-doc-meta>` wiring, multiple `<std-meta>` | Adoption documents and national metadata lost |
41
+ | `BoxedText` | Most valid children (table-wrap, fig, disp-formula, etc.) | Guidance boxes with complex content degraded |
42
+
43
+ ### 3. Missing Child Element Wiring
44
+
45
+ | Parent | Missing Child | Impact |
46
+ |--------|--------------|--------|
47
+ | `<p>` (Paragraph) | `@content-type`, `<supplementary-material>`, `<inline-graphic>` | Unit statements and supplementary materials lost |
48
+ | `<sec>` (Section) | `<supplementary-material>`, `<normative-note>`, `<normative-example>`, `<code>`, `<media>` | Various content types lost |
49
+ | `<ref>` (Reference) | `<non-normative-note>` | Notes on references lost |
50
+ | `<std>` (ReferenceStandard) | `<styled-content>`, `<italic>` | IEC amendment styled content lost |
51
+
52
+ ### 4. Type Mismatches
53
+
54
+ | Model | Current | Should Be | Impact |
55
+ |-------|---------|-----------|--------|
56
+ | `Permissions#copyright_statement` | String | Structured (mixed content) | IEC inline-graphic and breaks lost |
57
+ | `Permissions#copyright_holder` | Single string | Collection | Multiple holders lost |
58
+ | `MetadataIso` fields (title_wrap, std_ref, etc.) | Single | Collection | Multi-language/multi-value data lost |
59
+ | `MetadataStd#page_count` | Direct | Wrapped in `<counts>` | IEC counts wrapper lost |
60
+ | `TableWrap#label` | String | Label (mixed content) | Superscript footnote markers lost |
61
+
62
+ ## Medium-Priority Gaps
63
+
64
+ | Gap | Section | Notes |
65
+ |-----|---------|-------|
66
+ | `<abstract>` not in metadata models | A.2 | IEC metadata includes abstracts |
67
+ | `<isbn>`, `<suppl-type>`, `<suppl-number>` not in `StandardIdentification` | A.2 | IEC std-ident includes these |
68
+ | `@originator` missing from `StdId` | A.2 | IEC std-id uses this attribute |
69
+ | `<comm-ref>` should support `@id` | A.2 | IEC comm-ref has ID attribute |
70
+ | MathML coverage limited (~16 of 35+ elements) | 7.6 | Complex formulae may not round-trip |
71
+ | `DefItem` missing `@id` | 10.1.5 | Abbreviation cross-references need ID |
72
+
73
+ ## Low-Priority Gaps
74
+
75
+ | Gap | Section | Notes |
76
+ |-----|---------|-------|
77
+ | Legacy IEC `<def-head>` vs `<label>` | 7.5 | Legacy only |
78
+ | Legacy IEC `<tfoot>` in tables | 6.6.3 | Legacy only |
79
+ | Legacy IEC `<tr>/<td>` in `<table-wrap-foot>` | 6.6.3 | Legacy only |
80
+ | `<editing-instruction>` `@content-type` (legacy) | 5.14 | Dropped in recent conversion |
81
+ | Text between disp-formula in disp-formula-group | 7.4 | Edge case |
82
+
83
+ ## Files in This Report
84
+
85
+ | File | Topic |
86
+ |------|-------|
87
+ | `01-introduction-scope.md` | Sections 1-3: Introduction, scope, conventions |
88
+ | `02-document-structure.md` | Section 4: Overall document structure |
89
+ | `03-front-matter.md` | Section 4.2: Metadata elements |
90
+ | `04-body-content.md` | Section 5: Body content elements |
91
+ | `05-tables-figures.md` | Sections 6, 8: Tables and figures |
92
+ | `06-math-formulae.md` | Section 7: Formulae and MathML |
93
+ | `07-references.md` | Section 10: Cross-references and bibliography |
94
+ | `08-terminology.md` | Section 9: TBX and term-display |
95
+ | `09-metadata.md` | Annex A: Metadata usage |
96
+ | `10-iso-iec-variant.md` | ISO/IEC variants, amendments, ID schemes |
@@ -0,0 +1,101 @@
1
+ # Schema Element Coverage: mnconvert XSD vs sts-ruby
2
+
3
+ **Source**: NISO STS Extended 1.0 MathML3 XSD from mnconvert
4
+ **Date**: 2026-05-06
5
+ **Method**: Extracted all `xsd:element name=` declarations from XSD schema files, compared against all `map_element` and `element` declarations in sts-ruby.
6
+
7
+ ## Summary
8
+
9
+ | Metric | Count |
10
+ |--------|-------|
11
+ | XSD-defined elements | 374 |
12
+ | Ruby-mapped elements | 470* |
13
+ | Missing from Ruby | 52 |
14
+ | Extra in Ruby (not in XSD) | ~150** |
15
+
16
+ *Ruby count includes TBX, MathML, and content group helper elements that may map to the same XML element name with different namespace/module prefixes.
17
+
18
+ **Extra Ruby elements include TBX elements (urn:iso:std:iso:30042:ed-1 namespace), MathML elements, and internal helpers.
19
+
20
+ ## Elements in XSD but NOT in sts-ruby
21
+
22
+ ### Critical (Structural / Round-trip Impact)
23
+
24
+ | Element | Parent(s) in XSD | Notes |
25
+ |---------|-----------------|-------|
26
+ | `code` | Paragraph, Section, ListItem | Code blocks — entirely missing |
27
+ | `index` | Back | Index container |
28
+ | `index-div` | Index | Index division |
29
+ | `index-entry` | IndexDiv | Index entry |
30
+ | `index-group` | Sec, App | Index group |
31
+ | `index-title-group` | IndexDiv | Index title |
32
+ | `index-term-range-end` | IndexEntry | Range end marker |
33
+ | `table-wrap-group` | Sec, App | Grouped tables |
34
+ | `toc` | Front | Table of contents |
35
+ | `toc-div` | Toc | TOC division |
36
+ | `toc-entry` | TocDiv | TOC entry |
37
+ | `toc-group` | Sec | TOC group |
38
+ | `toc-title-group` | Toc | TOC title |
39
+ | `sec-meta` | Sec | Section metadata |
40
+ | `std-doc-meta` | Front | Standard document metadata |
41
+
42
+ ### Table Model (OASIS CALS)
43
+
44
+ | Element | Notes |
45
+ |---------|-------|
46
+ | `tgroup` | OASIS table group — alternative to XHTML table model |
47
+ | `colspec` | Column specification for OASIS tables |
48
+ | `row` | Row in OASIS table |
49
+ | `entry` | Cell in OASIS table |
50
+
51
+ sts-ruby only supports XHTML-style `<table>` with `<tr>/<td>/<th>`. OASIS CALS table model (`<tgroup>/<colspec>/<row>/<entry>`) is unimplemented.
52
+
53
+ ### Less Critical / Edge Cases
54
+
55
+ | Element | Notes |
56
+ |---------|-------|
57
+ | `abbrev` | Abbreviation element (abbreviation display) |
58
+ | `article-categories` | JATS legacy — not used in NISO STS |
59
+ | `article-id` | JATS legacy |
60
+ | `article-meta` | JATS legacy |
61
+ | `compl-title-wrap` | Complementary title wrap |
62
+ | `compound-subject` | Compound subject |
63
+ | `compound-subject-part` | Part of compound subject |
64
+ | `count` | Count element |
65
+ | `externalCrossReference` | TBX external cross reference |
66
+ | `fallback` | Alternatives fallback |
67
+ | `fixed-case` | Fixed-case text |
68
+ | `free_to_read` | ALI free-to-read indicator |
69
+ | `glyph-data` | Private character glyph data |
70
+ | `glyph-ref` | Private character glyph reference |
71
+ | `include` | XInclude element |
72
+ | `intro-title-wrap` | Introduction title wrap |
73
+ | `issue-id` | Journal issue ID |
74
+ | `issue-part` | Journal issue part |
75
+ | `issue-sponsor` | Journal issue sponsor |
76
+ | `issue-title` | Journal issue title |
77
+ | `journal-id` | Journal ID |
78
+ | `license_ref` | ALI license reference (ali:license_ref) |
79
+ | `main-title-wrap` | Main title wrap |
80
+ | `nav-pointer` | Navigation pointer |
81
+ | `nav-pointer-group` | Navigation pointer group |
82
+ | `num` | Number element |
83
+ | `overline-end` | Overline end marker |
84
+ | `overline-start` | Overline start marker |
85
+ | `part-title` | Part title |
86
+ | `see-also-entry` | Index "see also" entry |
87
+ | `see-entry` | Index "see" entry |
88
+ | `sub-part` | Sub-part element |
89
+ | `title-group` | Title group |
90
+ | `trans-subtitle` | Translated subtitle |
91
+ | `underline-end` | Underline end marker |
92
+ | `underline-start` | Underline start marker |
93
+ | `x` | MathML x element |
94
+ | `xMathML` | Content MathML |
95
+
96
+ ## Recommendations
97
+
98
+ 1. **Immediate priority**: `code`, `index/*`, `toc/*`, `table-wrap-group` — these appear in real ISO documents
99
+ 2. **OASIS table model**: Consider if needed — most modern ISO documents use XHTML tables
100
+ 3. **JATS legacy elements**: Skip — not relevant for NISO STS standards documents
101
+ 4. **ALI namespace elements** (`free_to_read`, `license_ref`): Add when supporting ALI permissions
data/Gemfile CHANGED
@@ -13,3 +13,4 @@ gem "rubocop"
13
13
  gem "rubocop-performance"
14
14
  gem "rubocop-rake"
15
15
  gem "rubocop-rspec"
16
+ gem "simplecov", require: false
@@ -0,0 +1,172 @@
1
+ # STS-Ruby Refactoring TODO Overview
2
+
3
+ **Date**: 2026-05-06
4
+ **Priority Order**: Execute in numeric order, dependencies noted
5
+ **Total Files**: 11
6
+
7
+ ## Architecture Principles
8
+ - **MECE**: Mutually Exclusive, Collectively Exhaustive task organization
9
+ - **Model-Driven**: All elements defined via lutaml-model, no runtime string-lookup
10
+ - **Open/Closed**: Schema modules open for extension, closed for modification
11
+ - **DRY**: Content groups eliminate duplication; no copy-paste inheritance
12
+ - **No Anti-Patterns**: Never `send`, `respond_to`, `Object.const_get`, `method_missing`
13
+
14
+ ---
15
+
16
+ ## File Inventory
17
+
18
+ | # | File | Category | Priority | Dependencies |
19
+ |---|------|----------|----------|--------------|
20
+ | 01 | `01-mathml-delegation.md` | Anti-Pattern Fix | DONE | — |
21
+ | 02 | `02-type-resolution.md` | Anti-Pattern Fix | DONE | — |
22
+ | 03 | `03-namespace-coupling.md` | Architecture | IN PROGRESS | 01, 02 |
23
+ | 04 | `04-register-versioning.md` | Architecture | HIGH | 01, 02 |
24
+ | 05 | `05-missing-elements.md` | Feature Gap | MOSTLY DONE | 04 |
25
+ | 06 | `06-missing-attributes.md` | Feature Gap | DONE | 04 |
26
+ | 07 | `07-incomplete-models.md` | Feature Gap | MOSTLY DONE | 04 |
27
+ | 08 | `08-isoiec-profile.md` | Architecture | DONE | 04 |
28
+ | 09 | `09-autoload-cleanup.md` | Cleanup | DONE | 01, 03 |
29
+ | 10 | `10-test-coverage.md` | Quality | ONGOING | All |
30
+ | 11 | `11-duplicate-models.md` | Architecture | MEDIUM | 03, 04 |
31
+
32
+ ---
33
+
34
+ ## Quick Reference: Critical Gaps from Audit
35
+
36
+ ### From GAPS.guidelines.iso-sts-ed2.1/
37
+ - ~~`<processing-meta>` (Ed 2.1 new element) — NOT modeled~~ → DONE
38
+ - ~~`<code>`, `<inline-code>` — NOT modeled~~ → DONE
39
+ - ~~`<legend>` — NOT modeled~~ → DONE
40
+ - ~~7+ elements missing `@id` attribute~~ → DONE: all 7 have `@id`
41
+ - ~~`Permissions` incomplete~~ → DONE
42
+ - ~~`Graphic` missing `@id`~~ → DONE
43
+
44
+ ### From GAPS.guidelines.niso-sts-v1.0/
45
+ - ~~`<index>` hierarchy entirely missing~~ → DONE (Index, IndexDiv, IndexEntry, IndexTitleGroup, SeeEntry, SeeAlsoEntry)
46
+ - ~~`<toc>` hierarchy entirely missing~~ → DONE (Toc, TocDiv, TocEntry, TocTitleGroup)
47
+ - ~~`TermDisplay` incomplete~~ → DONE
48
+ - ~~`@xml:lang` on multilingual elements~~ → DONE (Label, Caption, DefItem, DefList, etc.)
49
+ - ~~`BoxedText` incomplete~~ → DONE (full children, form-type, originator)
50
+ - ~~`Front` missing std-doc-meta, toc~~ → DONE
51
+ - ~~`Back` missing index, toc, glossary~~ → DONE
52
+ - ~~`@originator` missing on 7+ elements~~ → DONE (Paragraph, Section, Abstract, App, DispQuote, List, NormativeNote, NonNormativeNote)
53
+
54
+ ### From GAPS.guidelines.schema-xref.md
55
+ - ~~`<sec-meta>` — NOT modeled (lower priority)~~ → DONE
56
+ - OASIS CALS table model unsupported (legacy, lower priority)
57
+ - ~~NISO STS 1.2 additions partially done~~ → DONE (vocab, style-detail, use-type attrs on IcsWrap, KwdGroup, NamedContent, Role, SubjGroup)
58
+
59
+ ---
60
+
61
+ ## Completed (2026-05-06)
62
+
63
+ ### 01-mathml-delegation.md ✅
64
+ - Replaced `lib/sts/mathml.rb` (had `method_missing`, `respond_to_missing?`, `.send`)
65
+ - New version is a thin type alias: `Sts::Mathml::Math = Mml::V3::Math`
66
+ - All actual MathML elements used directly from `Mml::V3::*`
67
+
68
+ ### 02-type-resolution.md ✅
69
+ - Replaced `Object.const_get` in `lib/sts/content_groups/helpers.rb`
70
+ - `inject_elements` now takes actual class objects (compile-time safe)
71
+ - Updated docstrings with tuple format documentation
72
+
73
+ ### Dead Code Removed
74
+ - `lib/sts/iso_sts/content_groups/` — entire directory (highlight_elements.rb
75
+ was only file that used helpers, but IsoSts models all define attributes
76
+ explicitly, so content groups were never called)
77
+ - `lib/sts/niso_sts/content_groups/` — entire directory (9 files, all dead
78
+ code — would crash with `NoMethodError` if ever loaded since they call
79
+ `inject_elements` which was never defined in NisoSts::ContentGroups)
80
+
81
+ ### Anti-Pattern Audit Result
82
+ ```
83
+ grep -r "method_missing|respond_to_missing|Object.const_get|\.send" lib/
84
+ # Zero matches
85
+ ```
86
+
87
+ ### Moxml Monkey-Patch Removed
88
+ - Removed the no-op monkey-patch on `Moxml::Adapter::Nokogiri.children`
89
+ - The patch was replacing `children` with an identical implementation
90
+ - Likely originally worked around a Moxml bug that was since fixed upstream
91
+
92
+ ### @id Attributes Added (Partial TODO 06)
93
+ - `NisoSts::DefItem` — now has `@id`
94
+ - `NisoSts::Graphic` — now has `@id`
95
+ - `NisoSts::ListItem` — now has `@id`
96
+ - `NisoSts::ReferenceStandard` — now has `@id`
97
+ - `TbxIsoTml::Xref` — now has `@id`
98
+ - `TbxIsoTml::TableWrapFoot` — now has `@id`
99
+
100
+ ### frozen_string_literal: true
101
+ - All 456 `.rb` files in `lib/` now have `# frozen_string_literal: true`
102
+
103
+ ### Anti-Pattern Regression Test
104
+ - `spec/anti_patterns_spec.rb` — 1768 examples checking every lib file for:
105
+ `method_missing`, `respond_to_missing?`, `Object.const_get`, `.send()`
106
+
107
+ ### Test Results
108
+ ```
109
+ 2058 examples, 0 failures, 1 pending
110
+ 480 files inspected, no offenses detected
111
+ 0 anti-patterns found in 459 lib files
112
+ ```
113
+
114
+ ### @id Attributes Added to All Models (2026-05-07)
115
+ - 161 NisoSts models now have `@id` (XSD-verified)
116
+ - 32 TbxIsoTml models now have `@id`
117
+ - 29 IsoSts models now have `@id`
118
+ - Total: 222 models updated
119
+
120
+ ### Table Cell Content Expansion (2026-05-07)
121
+ - `TbxIsoTml::Td` expanded from 18 children to 40+ children matching XSD inside-cell content model
122
+ - `TbxIsoTml::Th` expanded from 17 children to 40+ children matching XSD inside-cell content model
123
+ - Added: disp-formula, disp-formula-group, element-citation, mixed-citation, emphasis elements (overline, roman, sc, strike), fig, fig-group, inline-graphic, private-char, normative-note, normative-example, non-normative-example, email, ext-link, named-content, alternatives, code, media, preformat, target, array
124
+ - Note: disp-quote, speech, statement are NOT in XSD inside-cell group — NOT needed
125
+
126
+ ### ISO/IEC Profile Validator (2026-05-07)
127
+ - `Sts::Profiles::IsoIec::Validator` with structural, metadata, originator, and doc-type validation
128
+ - `Sts::Profiles::IsoIec::Constraints` with frozen string constants
129
+ - 11 specs covering: valid doc, missing front/body, missing std-ident children, unrecognized originator/doc-type
130
+ - Zero anti-patterns: direct method calls only, no send/respond_to/const_get
131
+
132
+ ### NameAlternatives Expansion (2026-05-07)
133
+ - Added `string-name` child to `NameAlternatives` per XSD name-alternatives.class
134
+
135
+ ### Test Results (2026-05-07)
136
+ ```
137
+ 2085 examples, 0 failures, 1 pending
138
+ 485 files inspected, no offenses detected
139
+ 0 anti-patterns found in lib/
140
+ ```
141
+
142
+ ### IsoSts Namespace Independence (2026-05-07)
143
+ - ARCHITECTURE DECISION: IsoSts and NisoSts must remain fully independent
144
+ - ISOSTS is frozen legacy; NISO STS evolves — combining them violates OCP
145
+ - Created 11 new IsoSts-specific types: Monospace, Sc, Strike, Underline, Uri,
146
+ NamedContent, StandardRef, MetaDate, ContentLanguage (with autoloads)
147
+ - Decoupled Bold, Italic, ExtLink to use IsoSts types instead of NisoSts
148
+ - Reduced IsoSts→NisoSts cross-references from 157 to 63 (60% reduction)
149
+ - 48 types still need IsoSts equivalents for complete independence
150
+ - Test coverage: 99.8% line coverage, 2121 examples passing
151
+
152
+ ### Code Cleanup (2026-05-07)
153
+ - Removed redundant `require "lutaml/model"` from 13 files (already loaded by lib/sts.rb)
154
+ - Added SimpleCov coverage tracking with 80% minimum threshold
155
+ - Cleaned extra blank lines from require removal
156
+
157
+ ---
158
+
159
+ ## Remaining Work (2026-05-07)
160
+
161
+ ### Small Items
162
+ - OASIS CALS table model (legacy, lower priority)
163
+ - ~~Expand table cell content (disp-quote, speech, statement in td — NISO STS 1.2)~~ → NOT in XSD inside-cell group; Td/Th expanded to full XSD inside-cell content model
164
+ - ~~Expand StringName usage (in contrib, element-citation, related-article — NISO STS 1.2)~~ → DONE: added to name-alternatives; already in person-group and mixed-citation
165
+
166
+ ### Architectural Items (High Effort)
167
+ - `03-namespace-coupling.md` — IN PROGRESS: 157→63 IsoSts→NisoSts cross-references remaining
168
+ - `04-register-versioning.md` — Version the models via lutaml-model Registers
169
+ - `11-duplicate-models.md` — 44 overlapping element resolution (depends on 03)
170
+
171
+ ## Next Action
172
+ Proceed with `03-namespace-coupling.md` — audit and resolve 157+ IsoSts→NisoSts cross-references.
@@ -0,0 +1,153 @@
1
+ # 01: MathML Delegation Anti-Pattern Fix
2
+
3
+ **Priority**: CRITICAL
4
+ **Category**: Anti-Pattern Elimination
5
+ **Estimated Effort**: Medium
6
+ **Files Affected**: `lib/sts/mathml.rb`
7
+
8
+ ## Problem
9
+
10
+ Current `lib/sts/mathml.rb` uses three anti-patterns that violate encapsulation:
11
+
12
+ ```ruby
13
+ # Anti-Pattern 1: method_missing delegates everything to wrapped object
14
+ def method_missing(method_name, *args, &block)
15
+ if math.respond_to?(method_name)
16
+ math.send(method_name, *args, &block)
17
+ else
18
+ super
19
+ end
20
+ end
21
+
22
+ # Anti-Pattern 2: respond_to checks wrapped object internals
23
+ def respond_to_missing?(method_name, include_private = false)
24
+ math.respond_to?(method_name, include_private) || super
25
+ end
26
+
27
+ # Anti-Pattern 3: send bypasses encapsulation
28
+ math.send(method_name, *args, &block)
29
+ ```
30
+
31
+ ### Why These Are Wrong
32
+
33
+ 1. **`method_missing`**: Hides interface boundary, makes IDE/tools blind to actual API, creates invisible coupling
34
+ 2. **`respond_to_missing?`**: Returns false positives for private/internal methods, breaks type checking
35
+ 3. **`send`**: Bypasses access control, breaks encapsulation, no warning for private method calls
36
+
37
+ ### Impact
38
+
39
+ - Debugging is harder — no clear call stack
40
+ - Static analysis tools (RuboCop, Sorbet) cannot understand the interface
41
+ - Mix of `method_missing` and explicit method definitions creates inconsistency
42
+ - Performance: `send` is slower than direct calls
43
+
44
+ ## Solution
45
+
46
+ Replace delegation with **explicit forwarding** or **composition via inheritance** following the mml gem's register pattern.
47
+
48
+ ### Option A: Explicit Forwardable (Preferred)
49
+
50
+ Create explicit delegation methods for the API we actually need:
51
+
52
+ ```ruby
53
+ module Sts
54
+ module Mathml
55
+ class Math < Lutaml::Model::Serializable
56
+ attribute :id, :string
57
+ attribute :display, :string
58
+ attribute :math, Mml::V3::Math
59
+ attribute :class, :string
60
+ attribute :style, :string
61
+ attribute :xref, :string
62
+ attribute :encoding, :string
63
+ attribute :maxsize, :string
64
+ attribute :minsize, :string
65
+ attribute :other, :string
66
+ attribute :otherpr, :string
67
+
68
+ xml do
69
+ namespace ::Sts::Namespaces::MathmlNamespace
70
+ element "math"
71
+ mixed_content
72
+ map_attribute :id, to: :id
73
+ map_attribute :display, to: :display
74
+ map_attribute :class, to: :class
75
+ map_attribute :style, to: :style
76
+ map_attribute :xref, to: :xref
77
+ map_attribute "encoding", to: :encoding
78
+ map_attribute "maxsize", to: :maxsize
79
+ map_attribute "minsize", to: :minsize
80
+ map_attribute "other", to: :other
81
+ map_attribute "otherpr", to: :otherpr
82
+ map_element "math", to: :math
83
+ end
84
+
85
+ # Delegate children/annotations explicitly
86
+ def children
87
+ math.children
88
+ end
89
+
90
+ def to_xml(*args)
91
+ math.to_xml(*args)
92
+ end
93
+
94
+ def self.from_xml(input)
95
+ parsed = Mml::V3::Math.from_xml(input)
96
+ new(
97
+ id: parsed.id,
98
+ display: parsed.display,
99
+ math: parsed
100
+ )
101
+ end
102
+ end
103
+ end
104
+ end
105
+ ```
106
+
107
+ ### Option B: Forwardable Module
108
+
109
+ Use Ruby's `Forwardable` module for cleaner delegation:
110
+
111
+ ```ruby
112
+ require 'forwardable'
113
+
114
+ module Sts
115
+ module Mathml
116
+ class Math < Lutaml::Model::Serializable
117
+ extend Forwardable
118
+
119
+ attribute :id, :string
120
+ attribute :display, :string
121
+ attribute :math, Mml::V3::Math
122
+
123
+ def_delegators :math, :children, :to_xml, :to_json
124
+ def_delegators :math, :id=, :display=
125
+
126
+ xml do
127
+ # ... xml mapping
128
+ end
129
+ end
130
+ end
131
+ end
132
+ ```
133
+
134
+ ## Verification
135
+
136
+ After fix, ensure:
137
+ 1. `bundle exec rubocop lib/sts/mathml.rb` passes with no Style/Send, Style/MethodMissing violations
138
+ 2. `bundle exec rspec spec/` round-trip tests pass for MathML content
139
+ 3. Reference doc `C070908e.xml` parses and serializes correctly
140
+
141
+ ## Dependencies
142
+
143
+ None — can be done independently.
144
+
145
+ ## TODO Checklist
146
+
147
+ - [ ] Read current `lib/sts/mathml.rb`
148
+ - [ ] Identify all methods actually called on `Mml::V3::Math` in codebase
149
+ - [ ] Implement Option A or B
150
+ - [ ] Update `lib/sts/mathml.rb`
151
+ - [ ] Verify rubocop: no anti-pattern warnings
152
+ - [ ] Run round-trip tests
153
+ - [ ] Test C070908e.xml specifically
@@ -0,0 +1,122 @@
1
+ # 02: Type Resolution Anti-Pattern Fix
2
+
3
+ **Priority**: HIGH
4
+ **Category**: Anti-Pattern Elimination
5
+ **Estimated Effort**: Low
6
+ **Files Affected**: `lib/sts/content_groups/helpers.rb`
7
+
8
+ ## Problem
9
+
10
+ Current `lib/sts/content_groups/helpers.rb` uses `Object.const_get` for type resolution:
11
+
12
+ ```ruby
13
+ def inject_elements(klass, elements)
14
+ elements.each do |name, type_name, _, is_collection|
15
+ type = Object.const_get(type_name) # Anti-pattern
16
+ coll = is_collection.nil? || is_collection
17
+ klass.attribute name, type, collection: coll
18
+ end
19
+ end
20
+ ```
21
+
22
+ ### Why This Is Wrong
23
+
24
+ 1. **`Object.const_get`**: String-based lookup, no compile-time checking, fragile to typos
25
+ 2. **Hidden dependency**: No `require` statement indicates the dependency
26
+ 3. **Security risk**: Can resolve arbitrary constants if input is user-controlled
27
+ 4. **Performance**: Resolved at runtime, not cached efficiently
28
+
29
+ ## Solution
30
+
31
+ ### Option A: Direct Constant Reference
32
+
33
+ Pass actual class objects instead of strings:
34
+
35
+ ```ruby
36
+ module Sts
37
+ module ContentGroups
38
+ module Helpers
39
+ module_function
40
+
41
+ # Elements is now [[:attribute_name, Class, nil, is_collection?], ...]
42
+ def inject_elements(klass, elements)
43
+ elements.each do |name, type, _, is_collection|
44
+ coll = is_collection.nil? || is_collection
45
+ klass.attribute name, type, collection: coll
46
+ end
47
+ end
48
+
49
+ def inject_element_mappings(klass, mappings)
50
+ mappings.each do |xml_name, type, ruby_name|
51
+ klass.xml { map_element xml_name, to: ruby_name }
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ ```
58
+
59
+ ### Option B: Register-Based Resolution
60
+
61
+ Use lutaml-model's register system:
62
+
63
+ ```ruby
64
+ module Sts
65
+ module ContentGroups
66
+ module Helpers
67
+ module_function
68
+
69
+ def resolve_type(type_identifier)
70
+ case type_identifier
71
+ when Module then type_identifier
72
+ when Symbol
73
+ Lutaml::Model::GlobalRegister.resolve(type_identifier) ||
74
+ raise(ArgumentError, "Unknown type: #{type_identifier}")
75
+ else
76
+ raise(TypeError, "Expected Module or Symbol, got #{type_identifier.class}")
77
+ end
78
+ end
79
+
80
+ def inject_elements(klass, elements)
81
+ elements.each do |name, type, _, is_collection|
82
+ resolved_type = resolve_type(type)
83
+ coll = is_collection.nil? || is_collection
84
+ klass.attribute name, resolved_type, collection: coll
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ ```
91
+
92
+ ## Files Using This Helper
93
+
94
+ Need to update all callers to pass class objects:
95
+
96
+ ```bash
97
+ grep -r "inject_elements\|inject_element_mappings" lib/sts/
98
+ ```
99
+
100
+ Expected to find calls in:
101
+ - `lib/sts/iso_sts/content_groups/*.rb`
102
+ - `lib/sts/niso_sts/content_groups/*.rb`
103
+
104
+ ## Verification
105
+
106
+ 1. All callers pass actual class constants, not strings
107
+ 2. `bundle exec rubocop lib/sts/content_groups/helpers.rb` passes
108
+ 3. All specs pass — types resolved at class definition time
109
+
110
+ ## Dependencies
111
+
112
+ None — can be done independently.
113
+
114
+ ## TODO Checklist
115
+
116
+ - [ ] Read `lib/sts/content_groups/helpers.rb`
117
+ - [ ] Find all callers: `grep -r "inject_elements\|inject_element_mappings" lib/sts/`
118
+ - [ ] Choose Option A or B
119
+ - [ ] Update helper methods
120
+ - [ ] Update all callers to pass class objects
121
+ - [ ] Verify no `Object.const_get` remains
122
+ - [ ] Run full test suite