sts 0.1.0

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 (52) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/rake.yml +15 -0
  3. data/.github/workflows/release.yml +23 -0
  4. data/.gitignore +11 -0
  5. data/.rspec +3 -0
  6. data/CODE_OF_CONDUCT.md +84 -0
  7. data/Gemfile +12 -0
  8. data/README.adoc +36 -0
  9. data/Rakefile +12 -0
  10. data/lib/sts/niso_sts/back.rb +18 -0
  11. data/lib/sts/niso_sts/body.rb +18 -0
  12. data/lib/sts/niso_sts/document_identification.rb +25 -0
  13. data/lib/sts/niso_sts/front.rb +18 -0
  14. data/lib/sts/niso_sts/list.rb +16 -0
  15. data/lib/sts/niso_sts/metadata_iso.rb +41 -0
  16. data/lib/sts/niso_sts/non_normative_note.rb +20 -0
  17. data/lib/sts/niso_sts/page_count.rb +16 -0
  18. data/lib/sts/niso_sts/paragraph.rb +16 -0
  19. data/lib/sts/niso_sts/reference.rb +24 -0
  20. data/lib/sts/niso_sts/reference_list.rb +24 -0
  21. data/lib/sts/niso_sts/reference_standard.rb +24 -0
  22. data/lib/sts/niso_sts/section.rb +32 -0
  23. data/lib/sts/niso_sts/standard.rb +24 -0
  24. data/lib/sts/niso_sts/standard_identification.rb +25 -0
  25. data/lib/sts/niso_sts/standard_ref.rb +18 -0
  26. data/lib/sts/niso_sts/term_display.rb +22 -0
  27. data/lib/sts/niso_sts/term_section.rb +24 -0
  28. data/lib/sts/niso_sts/title_wrap.rb +25 -0
  29. data/lib/sts/niso_sts.rb +21 -0
  30. data/lib/sts/tbx_iso_tml/definition.rb +18 -0
  31. data/lib/sts/tbx_iso_tml/example.rb +18 -0
  32. data/lib/sts/tbx_iso_tml/external_graphic.rb +18 -0
  33. data/lib/sts/tbx_iso_tml/external_source.rb +20 -0
  34. data/lib/sts/tbx_iso_tml/geographical_usage.rb +18 -0
  35. data/lib/sts/tbx_iso_tml/grammatical_gender.rb +19 -0
  36. data/lib/sts/tbx_iso_tml/grammatical_number.rb +19 -0
  37. data/lib/sts/tbx_iso_tml/lang_set.rb +48 -0
  38. data/lib/sts/tbx_iso_tml/normative_authorization.rb +19 -0
  39. data/lib/sts/tbx_iso_tml/note.rb +18 -0
  40. data/lib/sts/tbx_iso_tml/part_of_speech.rb +19 -0
  41. data/lib/sts/tbx_iso_tml/see.rb +20 -0
  42. data/lib/sts/tbx_iso_tml/source.rb +18 -0
  43. data/lib/sts/tbx_iso_tml/term.rb +20 -0
  44. data/lib/sts/tbx_iso_tml/term_entry.rb +26 -0
  45. data/lib/sts/tbx_iso_tml/term_information_group.rb +42 -0
  46. data/lib/sts/tbx_iso_tml/term_type.rb +27 -0
  47. data/lib/sts/tbx_iso_tml.rb +23 -0
  48. data/lib/sts/version.rb +5 -0
  49. data/lib/sts.rb +15 -0
  50. data/sig/sts.rbs +4 -0
  51. data/sts.gemspec +41 -0
  52. metadata +180 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module NisoSts
5
+ end
6
+ end
7
+
8
+ require_relative "niso_sts/back"
9
+ require_relative "niso_sts/body"
10
+ require_relative "niso_sts/front"
11
+ require_relative "niso_sts/list"
12
+ require_relative "niso_sts/metadata_iso"
13
+ require_relative "niso_sts/non_normative_note"
14
+ require_relative "niso_sts/paragraph"
15
+ require_relative "niso_sts/reference"
16
+ require_relative "niso_sts/reference_list"
17
+ require_relative "niso_sts/reference_standard"
18
+ require_relative "niso_sts/section"
19
+ require_relative "niso_sts/standard"
20
+ require_relative "niso_sts/term_display"
21
+ require_relative "niso_sts/term_section"
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class Definition < Shale::Mapper
8
+ attribute :value, Shale::Type::String
9
+
10
+ xml do
11
+ root "definition"
12
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
13
+
14
+ map_content to: :value
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class Example < Shale::Mapper
8
+ attribute :value, Shale::Type::String
9
+
10
+ xml do
11
+ root "example"
12
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
13
+
14
+ map_content to: :value
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class ExternalGraphic < Shale::Mapper
8
+ attribute :target, Shale::Type::String
9
+
10
+ xml do
11
+ root "xGraphic"
12
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
13
+
14
+ map_attribute "xtarget", to: :target
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class ExternalSource < Shale::Mapper
8
+ attribute :target, Shale::Type::String
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "xSource"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "xtarget", to: :target
16
+ map_content to: :value
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class GeographicalUsage < Shale::Mapper
8
+ attribute :value, Shale::Type::String
9
+
10
+ xml do
11
+ root "geographicalUsage"
12
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
13
+
14
+ map_content to: :value
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class GrammaticalGender < Shale::Mapper
8
+ # TODO: can be masculine, feminine, singular
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "grammaticalGender"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "value", to: :value
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class GrammaticalNumber < Shale::Mapper
8
+ # TODO: can be singular | plural
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "grammaticalNumber"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "value", to: :value
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ require_relative "note"
6
+ require_relative "example"
7
+ require_relative "definition"
8
+ require_relative "see"
9
+ require_relative "source"
10
+ require_relative "external_source"
11
+ require_relative "term_information_group"
12
+
13
+ module Sts
14
+ module TbxIsoTml
15
+ class LangSet < Shale::Mapper
16
+ attribute :lang, Shale::Type::String
17
+ attribute :note, Note, collection: true
18
+ attribute :example, Example, collection: true
19
+ attribute :definition, Definition
20
+ attribute :tig, TermInformationGroup, collection: true
21
+ attribute :see, See, collection: true
22
+ attribute :source, Source, collection: true
23
+ attribute :x_source, ExternalSource, collection: true
24
+ attribute :cross_reference, Shale::Type::String, collection: true
25
+ attribute :subject_field, Shale::Type::String
26
+ # attribute :x_graphic, ExternalGraphic, collection: true
27
+
28
+ xml do
29
+ root "langSet"
30
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
31
+
32
+ map_attribute "lang", to: :lang,
33
+ namespace: "http://www.w3.org/XML/1998/namespace",
34
+ prefix: "xml"
35
+ map_element "note", to: :note
36
+ map_element "example", to: :example
37
+ map_element "definition", to: :definition
38
+ map_element "tig", to: :tig
39
+ map_element "see", to: :see
40
+ map_element "source", to: :source
41
+ map_element "xSource", to: :x_source
42
+ map_element "crossReference", to: :cross_reference
43
+ map_element "subjectField", to: :subject_field
44
+ # map_element 'xGraphic', to: :x_graphic
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class NormativeAuthorization < Shale::Mapper
8
+ # TODO: can be: admittedTerm, preferredTerm, deprecatedTerm
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "normativeAuthorization"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "value", to: :value
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class Note < Shale::Mapper
8
+ attribute :value, Shale::Type::String
9
+
10
+ xml do
11
+ root "note"
12
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
13
+
14
+ map_content to: :value
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class PartOfSpeech < Shale::Mapper
8
+ # TODO: can be `noun`, `verb`, `adj`, `adv`
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "partOfSpeech"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "value", to: :value
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class See < Shale::Mapper
8
+ attribute :script, Shale::Type::String
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "see"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "script", to: :script
16
+ map_content to: :value
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class Source < Shale::Mapper
8
+ attribute :value, Shale::Type::String
9
+
10
+ xml do
11
+ root "source"
12
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
13
+
14
+ map_content to: :value
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class Term < Shale::Mapper
8
+ attribute :id, Shale::Type::String
9
+ attribute :value, Shale::Type::String
10
+
11
+ xml do
12
+ root "term"
13
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
14
+
15
+ map_attribute "id", to: :id
16
+ map_content to: :value
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ require_relative "lang_set"
6
+ require_relative "external_graphic"
7
+
8
+ module Sts
9
+ module TbxIsoTml
10
+ class TermEntry < Shale::Mapper
11
+ attribute :id, Shale::Type::String
12
+ attribute :lang_set, LangSet, collection: true
13
+ attribute :x_graphic, ExternalGraphic, collection: true
14
+
15
+ xml do
16
+ root "termEntry"
17
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
18
+
19
+ map_attribute "id", to: :id
20
+ map_element "langSet", to: :lang_set
21
+ map_element "xGraphic", to: :x_graphic
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ require_relative "term"
6
+ require_relative "part_of_speech"
7
+ require_relative "normative_authorization"
8
+ require_relative "geographical_usage"
9
+ require_relative "grammatical_gender"
10
+ require_relative "grammatical_number"
11
+ require_relative "term_type"
12
+
13
+ module Sts
14
+ module TbxIsoTml
15
+ class TermInformationGroup < Shale::Mapper
16
+ attribute :term, Term
17
+ attribute :pos, PartOfSpeech
18
+ attribute :usage_note, Shale::Type::String
19
+ attribute :normative_authorization, NormativeAuthorization
20
+ attribute :geographical_usage, GeographicalUsage
21
+ attribute :grammatical_gender, GrammaticalGender
22
+ attribute :grammatical_number, GrammaticalNumber
23
+ attribute :pronunciation, Shale::Type::String
24
+ attribute :term_type, TermType
25
+
26
+ xml do
27
+ root "tig"
28
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
29
+
30
+ map_element "term", to: :term
31
+ map_element "partOfSpeech", to: :pos
32
+ map_element "usageNote", to: :usage_note
33
+ map_element "normativeAuthorization", to: :normative_authorization
34
+ map_element "geographicalUsage", to: :geographical_usage
35
+ map_element "pronunciation", to: :pronunciation
36
+ map_element "termType", to: :term_type
37
+ map_element "grammaticalGender", to: :grammatical_gender
38
+ map_element "grammaticalNumber", to: :grammatical_number
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "shale"
4
+
5
+ module Sts
6
+ module TbxIsoTml
7
+ class TermType < Shale::Mapper
8
+ # TODO: can be:
9
+ # - acronym
10
+ # - abbreviation
11
+ # - equation
12
+ # - formula
13
+ # - fullForm
14
+ # - symbol
15
+ # - variant
16
+
17
+ attribute :value, Shale::Type::String
18
+
19
+ xml do
20
+ root "termType"
21
+ namespace "urn:iso:std:iso:30042:ed-1", "tbx"
22
+
23
+ map_attribute "value", to: :value
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module TbxIsoTml
5
+ end
6
+ end
7
+
8
+ require_relative "tbx_iso_tml/definition"
9
+ require_relative "tbx_iso_tml/example"
10
+ require_relative "tbx_iso_tml/external_graphic"
11
+ require_relative "tbx_iso_tml/external_source"
12
+ require_relative "tbx_iso_tml/geographical_usage"
13
+ require_relative "tbx_iso_tml/grammatical_gender"
14
+ require_relative "tbx_iso_tml/lang_set"
15
+ require_relative "tbx_iso_tml/normative_authorization"
16
+ require_relative "tbx_iso_tml/note"
17
+ require_relative "tbx_iso_tml/part_of_speech"
18
+ require_relative "tbx_iso_tml/see"
19
+ require_relative "tbx_iso_tml/source"
20
+ require_relative "tbx_iso_tml/term"
21
+ require_relative "tbx_iso_tml/term_entry"
22
+ require_relative "tbx_iso_tml/term_information_group"
23
+ require_relative "tbx_iso_tml/term_type"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ VERSION = "0.1.0"
5
+ end
data/lib/sts.rb ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "sts/version"
4
+ require "shale"
5
+ require "shale/adapter/nokogiri"
6
+
7
+ module Sts
8
+ Shale.xml_adapter = Shale::Adapter::Nokogiri
9
+
10
+ class Error < StandardError; end
11
+ # Your code goes here...
12
+ end
13
+
14
+ require_relative "sts/tbx_iso_tml"
15
+ require_relative "sts/niso_sts"
data/sig/sts.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Sts
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data/sts.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/sts/version"
4
+
5
+ all_files_in_git = Dir.chdir(File.expand_path(__dir__)) do
6
+ `git ls-files -z`.split("\x0")
7
+ end
8
+
9
+ Gem::Specification.new do |spec|
10
+ spec.name = "sts"
11
+ spec.version = Sts::VERSION
12
+ spec.authors = ["Ribose"]
13
+ spec.email = ["open.source@ribose.com"]
14
+
15
+ spec.summary = "Library to work with NISO STS and ISOSTS."
16
+ spec.homepage = "https://github.com/metanorma/sts-ruby"
17
+ spec.license = "BSD-2-Clause"
18
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = spec.homepage
22
+ spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ spec.files = all_files_in_git
26
+ .reject { |f| f.match(%r{\A(?:test|spec|features|bin|\.)/}) }
27
+
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "nokogiri"
33
+ spec.add_dependency "shale"
34
+ # spec.add_dependency "thor"
35
+
36
+ spec.add_development_dependency "pry", "~> 0.14.0"
37
+ spec.add_development_dependency "rake", "~> 13.0"
38
+ spec.add_development_dependency "rspec", "~> 3.10"
39
+ # spec.add_development_dependency "rubocop"
40
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
41
+ end