hyperlang 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.
- checksums.yaml +7 -0
- data/.github/workflows/rake.yml +19 -0
- data/.github/workflows/release.yml +28 -0
- data/.gitignore +8 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +45 -0
- data/Gemfile +15 -0
- data/README.adoc +176 -0
- data/Rakefile +12 -0
- data/hyperlang.gemspec +36 -0
- data/lib/hyperlang/version.rb +5 -0
- data/lib/hyperlang/xhtml/a.rb +44 -0
- data/lib/hyperlang/xhtml/abbr.rb +22 -0
- data/lib/hyperlang/xhtml/acronym.rb +22 -0
- data/lib/hyperlang/xhtml/address.rb +26 -0
- data/lib/hyperlang/xhtml/applet.rb +42 -0
- data/lib/hyperlang/xhtml/area.rb +29 -0
- data/lib/hyperlang/xhtml/b.rb +22 -0
- data/lib/hyperlang/xhtml/base.rb +17 -0
- data/lib/hyperlang/xhtml/basefont.rb +21 -0
- data/lib/hyperlang/xhtml/bdo.rb +22 -0
- data/lib/hyperlang/xhtml/big.rb +22 -0
- data/lib/hyperlang/xhtml/blockquote.rb +44 -0
- data/lib/hyperlang/xhtml/body.rb +54 -0
- data/lib/hyperlang/xhtml/br.rb +12 -0
- data/lib/hyperlang/xhtml/button.rb +42 -0
- data/lib/hyperlang/xhtml/caption.rb +20 -0
- data/lib/hyperlang/xhtml/center.rb +48 -0
- data/lib/hyperlang/xhtml/cite.rb +20 -0
- data/lib/hyperlang/xhtml/code.rb +22 -0
- data/lib/hyperlang/xhtml/col.rb +29 -0
- data/lib/hyperlang/xhtml/colgroup.rb +31 -0
- data/lib/hyperlang/xhtml/dd.rb +40 -0
- data/lib/hyperlang/xhtml/del.rb +38 -0
- data/lib/hyperlang/xhtml/dfn.rb +20 -0
- data/lib/hyperlang/xhtml/dir.rb +21 -0
- data/lib/hyperlang/xhtml/div.rb +64 -0
- data/lib/hyperlang/xhtml/dl.rb +21 -0
- data/lib/hyperlang/xhtml/dt.rb +30 -0
- data/lib/hyperlang/xhtml/em.rb +22 -0
- data/lib/hyperlang/xhtml/fieldset.rb +34 -0
- data/lib/hyperlang/xhtml/font.rb +26 -0
- data/lib/hyperlang/xhtml/form.rb +40 -0
- data/lib/hyperlang/xhtml/frame.rb +31 -0
- data/lib/hyperlang/xhtml/frameset.rb +25 -0
- data/lib/hyperlang/xhtml/h1.rb +34 -0
- data/lib/hyperlang/xhtml/h2.rb +34 -0
- data/lib/hyperlang/xhtml/h3.rb +34 -0
- data/lib/hyperlang/xhtml/h4.rb +34 -0
- data/lib/hyperlang/xhtml/h5.rb +34 -0
- data/lib/hyperlang/xhtml/h6.rb +34 -0
- data/lib/hyperlang/xhtml/head.rb +27 -0
- data/lib/hyperlang/xhtml/hr.rb +17 -0
- data/lib/hyperlang/xhtml/html.rb +17 -0
- data/lib/hyperlang/xhtml/i.rb +22 -0
- data/lib/hyperlang/xhtml/iframe.rb +40 -0
- data/lib/hyperlang/xhtml/img.rb +35 -0
- data/lib/hyperlang/xhtml/input.rb +55 -0
- data/lib/hyperlang/xhtml/ins.rb +38 -0
- data/lib/hyperlang/xhtml/isindex.rb +19 -0
- data/lib/hyperlang/xhtml/kbd.rb +20 -0
- data/lib/hyperlang/xhtml/label.rb +24 -0
- data/lib/hyperlang/xhtml/legend.rb +22 -0
- data/lib/hyperlang/xhtml/li.rb +42 -0
- data/lib/hyperlang/xhtml/link.rb +31 -0
- data/lib/hyperlang/xhtml/map.rb +35 -0
- data/lib/hyperlang/xhtml/menu.rb +21 -0
- data/lib/hyperlang/xhtml/meta.rb +23 -0
- data/lib/hyperlang/xhtml/namespace.rb +10 -0
- data/lib/hyperlang/xhtml/noframes.rb +46 -0
- data/lib/hyperlang/xhtml/noscript.rb +42 -0
- data/lib/hyperlang/xhtml/object.rb +48 -0
- data/lib/hyperlang/xhtml/ol.rb +25 -0
- data/lib/hyperlang/xhtml/optgroup.rb +23 -0
- data/lib/hyperlang/xhtml/option.rb +25 -0
- data/lib/hyperlang/xhtml/p.rb +36 -0
- data/lib/hyperlang/xhtml/param.rb +23 -0
- data/lib/hyperlang/xhtml/pre.rb +32 -0
- data/lib/hyperlang/xhtml/q.rb +22 -0
- data/lib/hyperlang/xhtml/rb.rb +20 -0
- data/lib/hyperlang/xhtml/rbc.rb +19 -0
- data/lib/hyperlang/xhtml/rp.rb +19 -0
- data/lib/hyperlang/xhtml/rt.rb +22 -0
- data/lib/hyperlang/xhtml/rtc.rb +23 -0
- data/lib/hyperlang/xhtml/ruby.rb +27 -0
- data/lib/hyperlang/xhtml/s.rb +20 -0
- data/lib/hyperlang/xhtml/samp.rb +20 -0
- data/lib/hyperlang/xhtml/script.rb +25 -0
- data/lib/hyperlang/xhtml/select.rb +37 -0
- data/lib/hyperlang/xhtml/small.rb +22 -0
- data/lib/hyperlang/xhtml/span.rb +24 -0
- data/lib/hyperlang/xhtml/strike.rb +20 -0
- data/lib/hyperlang/xhtml/strong.rb +22 -0
- data/lib/hyperlang/xhtml/style.rb +23 -0
- data/lib/hyperlang/xhtml/sub.rb +20 -0
- data/lib/hyperlang/xhtml/sup.rb +20 -0
- data/lib/hyperlang/xhtml/table.rb +43 -0
- data/lib/hyperlang/xhtml/tbody.rb +27 -0
- data/lib/hyperlang/xhtml/td.rb +42 -0
- data/lib/hyperlang/xhtml/textarea.rb +41 -0
- data/lib/hyperlang/xhtml/tfoot.rb +27 -0
- data/lib/hyperlang/xhtml/th.rb +42 -0
- data/lib/hyperlang/xhtml/thead.rb +27 -0
- data/lib/hyperlang/xhtml/title.rb +15 -0
- data/lib/hyperlang/xhtml/tr.rb +29 -0
- data/lib/hyperlang/xhtml/tt.rb +20 -0
- data/lib/hyperlang/xhtml/u.rb +20 -0
- data/lib/hyperlang/xhtml/ul.rb +23 -0
- data/lib/hyperlang/xhtml/var.rb +20 -0
- data/lib/hyperlang/xhtml/xhtml.rb +147 -0
- data/lib/hyperlang.rb +16 -0
- data/spec/hyperlang/round_trip_spec.rb +86 -0
- data/spec/hyperlang/xhtml/block_spec.rb +56 -0
- data/spec/hyperlang/xhtml/inline_spec.rb +60 -0
- data/spec/spec_helper.rb +17 -0
- metadata +173 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d5b04c05d3353ba14e7fabc8609d8681737eebcec58c2f5acc17e88e940b8ab8
|
|
4
|
+
data.tar.gz: 0051737e8f854dc03c2be88e3e3786cb799ac8e5956db1ec26ec891f57ea4819
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6d99633b71264fb819562a30cd7c08c3000aa9e70d72134b8c83c2e316b1f3fbfef5cf090728fde815d6a464e298249c65d163cab66d7b923de943a38831120c
|
|
7
|
+
data.tar.gz: 2d162a1064ba4cf0a08eac1e4567903e7742cb9b08a12c98c35b6e0fac76463c6c49a8f2fe1fac7c08cb9ed8c96f6eb688417aa38cc5da51101920bc397ef872
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: rake
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
packages: write
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
branches: [ master, main ]
|
|
12
|
+
tags: [ v* ]
|
|
13
|
+
pull_request:
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
rake:
|
|
17
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
|
18
|
+
secrets:
|
|
19
|
+
pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: release
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
packages: write
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
inputs:
|
|
13
|
+
next_version:
|
|
14
|
+
description: |
|
|
15
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
|
16
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
|
17
|
+
required: true
|
|
18
|
+
default: 'skip'
|
|
19
|
+
repository_dispatch:
|
|
20
|
+
types: [ do-release ]
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
release:
|
|
24
|
+
uses: relaton/support/.github/workflows/release.yml@main
|
|
25
|
+
with:
|
|
26
|
+
next_version: ${{ github.event.inputs.next_version }}
|
|
27
|
+
secrets:
|
|
28
|
+
rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
inherit_from:
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
|
+
- .rubocop_todo.yml
|
|
6
|
+
|
|
7
|
+
inherit_mode:
|
|
8
|
+
merge:
|
|
9
|
+
- Exclude
|
|
10
|
+
|
|
11
|
+
# local repo-specific modifications
|
|
12
|
+
# ...
|
|
13
|
+
plugins:
|
|
14
|
+
- rubocop-rspec
|
|
15
|
+
- rubocop-performance
|
|
16
|
+
- rubocop-rake
|
|
17
|
+
|
|
18
|
+
AllCops:
|
|
19
|
+
TargetRubyVersion: 3.0
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2026-03-28 04:02:35 UTC using RuboCop version 1.86.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: 6
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
12
|
+
# URISchemes: http, https
|
|
13
|
+
Layout/LineLength:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'hyperlang.gemspec'
|
|
16
|
+
- 'lib/hyperlang.rb'
|
|
17
|
+
- 'lib/hyperlang/xhtml/dd.rb'
|
|
18
|
+
- 'spec/hyperlang/xhtml/inline_spec.rb'
|
|
19
|
+
|
|
20
|
+
# Offense count: 1
|
|
21
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
22
|
+
# AllowedMethods: refine
|
|
23
|
+
Metrics/BlockLength:
|
|
24
|
+
Max: 28
|
|
25
|
+
|
|
26
|
+
# Offense count: 1
|
|
27
|
+
# Configuration parameters: IgnoredMetadata.
|
|
28
|
+
RSpec/DescribeClass:
|
|
29
|
+
Exclude:
|
|
30
|
+
- 'spec/hyperlang/round_trip_spec.rb'
|
|
31
|
+
|
|
32
|
+
# Offense count: 10
|
|
33
|
+
# Configuration parameters: CountAsOne.
|
|
34
|
+
RSpec/ExampleLength:
|
|
35
|
+
Max: 19
|
|
36
|
+
|
|
37
|
+
# Offense count: 2
|
|
38
|
+
RSpec/MultipleDescribes:
|
|
39
|
+
Exclude:
|
|
40
|
+
- 'spec/hyperlang/xhtml/block_spec.rb'
|
|
41
|
+
- 'spec/hyperlang/xhtml/inline_spec.rb'
|
|
42
|
+
|
|
43
|
+
# Offense count: 7
|
|
44
|
+
RSpec/MultipleExpectations:
|
|
45
|
+
Max: 4
|
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 xml-c14n.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
|
|
9
|
+
gem "nokogiri"
|
|
10
|
+
gem "rake"
|
|
11
|
+
gem "rspec"
|
|
12
|
+
gem "rubocop"
|
|
13
|
+
gem "rubocop-performance"
|
|
14
|
+
gem "rubocop-rake"
|
|
15
|
+
gem "rubocop-rspec"
|
data/README.adoc
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
= hyperlang
|
|
2
|
+
|
|
3
|
+
Complete XHTML 1.1 element model library for Lutaml.
|
|
4
|
+
|
|
5
|
+
== Overview
|
|
6
|
+
|
|
7
|
+
hyperlang provides Ruby object models for every XHTML 1.1 element (Strict, Transitional, and Frameset variants), built on top of `lutaml-model`. Each element class inherits from `Lutaml::Model::Serializable` and supports XML round-trip serialization via the `xml` DSL.
|
|
8
|
+
|
|
9
|
+
== Installation
|
|
10
|
+
|
|
11
|
+
Add to your Gemfile:
|
|
12
|
+
|
|
13
|
+
[source,ruby]
|
|
14
|
+
gem "hyperlang", "~> 0.1.0"
|
|
15
|
+
|
|
16
|
+
== Usage
|
|
17
|
+
|
|
18
|
+
=== Parsing XHTML
|
|
19
|
+
|
|
20
|
+
[source,ruby]
|
|
21
|
+
require "hyperlang"
|
|
22
|
+
|
|
23
|
+
html = Hyperlang::Xhtml::Html.from_xml(xhtml_string)
|
|
24
|
+
puts html.head.title.content
|
|
25
|
+
puts html.body.div.first.p.first.content
|
|
26
|
+
|
|
27
|
+
=== Generating XHTML
|
|
28
|
+
|
|
29
|
+
[source,ruby]
|
|
30
|
+
html = Hyperlang::Xhtml::Html.new(
|
|
31
|
+
head: Hyperlang::Xhtml::Head.new(
|
|
32
|
+
title: Hyperlang::Xhtml::Title.new(content: "My Page")
|
|
33
|
+
),
|
|
34
|
+
body: Hyperlang::Xhtml::Body.new(
|
|
35
|
+
div: [
|
|
36
|
+
Hyperlang::Xhtml::Div.new(
|
|
37
|
+
p: [Hyperlang::Xhtml::P.new(content: "Hello world")]
|
|
38
|
+
)
|
|
39
|
+
]
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
puts html.to_xml
|
|
44
|
+
|
|
45
|
+
== Elements
|
|
46
|
+
|
|
47
|
+
All 99 XHTML element classes live under `Hyperlang::Xhtml::`:
|
|
48
|
+
|
|
49
|
+
=== Structure
|
|
50
|
+
|
|
51
|
+
|===
|
|
52
|
+
| Element | Class
|
|
53
|
+
| `<html>` | `Html`
|
|
54
|
+
| `<head>` | `Head`
|
|
55
|
+
| `<title>` | `Title`
|
|
56
|
+
| `<body>` | `Body`
|
|
57
|
+
|===
|
|
58
|
+
|
|
59
|
+
=== Text Block
|
|
60
|
+
|
|
61
|
+
`Div`, `P`, `Pre`, `Address`, `H1`-`H6`, `Blockquote`, `Hr`
|
|
62
|
+
|
|
63
|
+
=== Text Inline
|
|
64
|
+
|
|
65
|
+
Phrasal:: `Abbr`, `Acronym`, `Cite`, `Code`, `Dfn`, `Em`, `Kbd`, `Q`, `Samp`, `Strong`, `Var`
|
|
66
|
+
|
|
67
|
+
Structural:: `Span`, `Br`
|
|
68
|
+
|
|
69
|
+
=== Hypertext
|
|
70
|
+
|
|
71
|
+
`A`
|
|
72
|
+
|
|
73
|
+
=== Lists
|
|
74
|
+
|
|
75
|
+
`Dl`, `Dt`, `Dd`, `Ol`, `Ul`, `Li`
|
|
76
|
+
|
|
77
|
+
=== Tables
|
|
78
|
+
|
|
79
|
+
`Table`, `Caption`, `Colgroup`, `Col`, `Thead`, `Tfoot`, `Tbody`, `Tr`, `Th`, `Td`
|
|
80
|
+
|
|
81
|
+
=== Forms
|
|
82
|
+
|
|
83
|
+
`Form`, `Fieldset`, `Legend`, `Label`, `Input`, `Select`, `Optgroup`, `Option`, `Textarea`, `Button`
|
|
84
|
+
|
|
85
|
+
=== Presentation
|
|
86
|
+
|
|
87
|
+
`B`, `Big`, `I`, `Small`, `Sub`, `Sup`, `Tt`
|
|
88
|
+
|
|
89
|
+
=== Other
|
|
90
|
+
|
|
91
|
+
`Object`, `Param`, `Img`, `Map`, `Area`, `Meta`, `Script`, `Noscript`, `Style`, `Link`, `Base`
|
|
92
|
+
|
|
93
|
+
=== Edit
|
|
94
|
+
|
|
95
|
+
`Del`, `Ins`
|
|
96
|
+
|
|
97
|
+
=== BIDI
|
|
98
|
+
|
|
99
|
+
`Bdo`
|
|
100
|
+
|
|
101
|
+
=== Ruby Annotation
|
|
102
|
+
|
|
103
|
+
`Ruby`, `Rbc`, `Rtc`, `Rb`, `Rt`, `Rp`
|
|
104
|
+
|
|
105
|
+
=== Transitional-only
|
|
106
|
+
|
|
107
|
+
`Applet`, `Basefont`, `Center`, `Dir`, `Font`, `Iframe`, `Isindex`, `Menu`, `S`, `Strike`, `U`
|
|
108
|
+
|
|
109
|
+
=== Frameset-only
|
|
110
|
+
|
|
111
|
+
`Frame`, `Frameset`, `Noframes`
|
|
112
|
+
|
|
113
|
+
== Namespace
|
|
114
|
+
|
|
115
|
+
All elements use the XHTML namespace `http://www.w3.org/1999/xhtml` with prefix `xhtml`.
|
|
116
|
+
|
|
117
|
+
== Architecture
|
|
118
|
+
|
|
119
|
+
=== Element class pattern
|
|
120
|
+
|
|
121
|
+
Every element follows a consistent pattern:
|
|
122
|
+
|
|
123
|
+
[source,ruby]
|
|
124
|
+
class Hyperlang::Xhtml::P < Lutaml::Model::Serializable
|
|
125
|
+
attribute :content, :string
|
|
126
|
+
attribute :span, Hyperlang::Xhtml::Span, collection: true
|
|
127
|
+
attribute :klass, :string
|
|
128
|
+
|
|
129
|
+
xml do
|
|
130
|
+
element "p"
|
|
131
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
132
|
+
mixed_content
|
|
133
|
+
map_content to: :content
|
|
134
|
+
map_element "span", to: :span
|
|
135
|
+
map_attribute "class", to: :klass
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
Key conventions:
|
|
140
|
+
|
|
141
|
+
* `mixed_content` + `map_content to: :content` for elements allowing text and child elements
|
|
142
|
+
* `collection: true` for child elements that can appear multiple times
|
|
143
|
+
* XML `class` attribute mapped to Ruby `:klass` to avoid collision with Ruby's `Class`
|
|
144
|
+
|
|
145
|
+
=== Document tree
|
|
146
|
+
|
|
147
|
+
[source]
|
|
148
|
+
Html
|
|
149
|
+
+-- Head
|
|
150
|
+
| +-- Title
|
|
151
|
+
| +-- Meta (collection)
|
|
152
|
+
| +-- Link (collection)
|
|
153
|
+
| +-- Style (collection)
|
|
154
|
+
| +-- Script (collection)
|
|
155
|
+
| +-- Base
|
|
156
|
+
+-- Body (mixed_content)
|
|
157
|
+
+-- Div, P, Span, A, Ul, Ol, Table, H1-H6, Pre, ...
|
|
158
|
+
|
|
159
|
+
=== Loading
|
|
160
|
+
|
|
161
|
+
Classes are loaded in topologically sorted order (computed from dependency analysis) to ensure parent classes load before children that reference them. Leaf-node elements (`Br`, `Img`, `Span`) load first; container elements (`Html`, `Body`, `Div`) load last.
|
|
162
|
+
|
|
163
|
+
== Relationship to reqif
|
|
164
|
+
|
|
165
|
+
The `reqif` gem uses hyperlang for XHTML content within ReqIF documents. The `<XHTML-CONTENT>` element in ReqIF can contain any XHTML element, and reqif references hyperlang's element classes for parsing and serializing rich text content.
|
|
166
|
+
|
|
167
|
+
== Development
|
|
168
|
+
|
|
169
|
+
After checking out the repo:
|
|
170
|
+
|
|
171
|
+
$ bundle install
|
|
172
|
+
$ bundle exec rake
|
|
173
|
+
|
|
174
|
+
== License
|
|
175
|
+
|
|
176
|
+
See `hyperlang.gemspec` for license information.
|
data/Rakefile
ADDED
data/hyperlang.gemspec
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/hyperlang/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "hyperlang"
|
|
7
|
+
spec.version = Hyperlang::VERSION
|
|
8
|
+
spec.authors = ["Ribose Inc."]
|
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Complete XHTML model library for Lutaml"
|
|
12
|
+
spec.description = "XHTML 1.1 Strict, Transitional, and Frameset element models for Lutaml"
|
|
13
|
+
spec.homepage = "https://github.com/lutaml/hyperlang"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/lutaml/hyperlang/releases"
|
|
19
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
20
|
+
|
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem
|
|
23
|
+
# that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
+
`git ls-files -z`
|
|
26
|
+
.split("\x0")
|
|
27
|
+
.reject { |f| f.match(%r{^(test|features)/}) }
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "exe"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
34
|
+
|
|
35
|
+
spec.add_dependency "lutaml-model", "~> 0.8.0"
|
|
36
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class A < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :href, :string
|
|
8
|
+
attribute :name, :string
|
|
9
|
+
attribute :hreflang, :string
|
|
10
|
+
attribute :type, :string
|
|
11
|
+
attribute :rel, :string
|
|
12
|
+
attribute :rev, :string
|
|
13
|
+
attribute :charset, :string
|
|
14
|
+
attribute :accesskey, :string
|
|
15
|
+
attribute :tabindex, :integer
|
|
16
|
+
attribute :shape, :string
|
|
17
|
+
attribute :coords, :string
|
|
18
|
+
attribute :id, :string
|
|
19
|
+
attribute :klass, :string
|
|
20
|
+
attribute :style, :string
|
|
21
|
+
|
|
22
|
+
xml do
|
|
23
|
+
element "a"
|
|
24
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
25
|
+
mixed_content
|
|
26
|
+
map_content to: :content
|
|
27
|
+
map_attribute "href", to: :href
|
|
28
|
+
map_attribute "name", to: :name
|
|
29
|
+
map_attribute "hreflang", to: :hreflang
|
|
30
|
+
map_attribute "type", to: :type
|
|
31
|
+
map_attribute "rel", to: :rel
|
|
32
|
+
map_attribute "rev", to: :rev
|
|
33
|
+
map_attribute "charset", to: :charset
|
|
34
|
+
map_attribute "accesskey", to: :accesskey
|
|
35
|
+
map_attribute "tabindex", to: :tabindex
|
|
36
|
+
map_attribute "shape", to: :shape
|
|
37
|
+
map_attribute "coords", to: :coords
|
|
38
|
+
map_attribute "id", to: :id
|
|
39
|
+
map_attribute "class", to: :klass
|
|
40
|
+
map_attribute "style", to: :style
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Abbr < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :title, :string
|
|
8
|
+
attribute :id, :string
|
|
9
|
+
attribute :klass, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "abbr"
|
|
13
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
14
|
+
mixed_content
|
|
15
|
+
map_content to: :content
|
|
16
|
+
map_attribute "title", to: :title
|
|
17
|
+
map_attribute "id", to: :id
|
|
18
|
+
map_attribute "class", to: :klass
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Acronym < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :title, :string
|
|
8
|
+
attribute :id, :string
|
|
9
|
+
attribute :klass, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "acronym"
|
|
13
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
14
|
+
mixed_content
|
|
15
|
+
map_content to: :content
|
|
16
|
+
map_attribute "title", to: :title
|
|
17
|
+
map_attribute "id", to: :id
|
|
18
|
+
map_attribute "class", to: :klass
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Address < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :p, Hyperlang::Xhtml::P, collection: true
|
|
8
|
+
attribute :span, Hyperlang::Xhtml::Span, collection: true
|
|
9
|
+
attribute :a, Hyperlang::Xhtml::A, collection: true
|
|
10
|
+
attribute :em, Hyperlang::Xhtml::Em, collection: true
|
|
11
|
+
attribute :strong, Hyperlang::Xhtml::Strong, collection: true
|
|
12
|
+
|
|
13
|
+
xml do
|
|
14
|
+
element "address"
|
|
15
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
16
|
+
mixed_content
|
|
17
|
+
map_content to: :content
|
|
18
|
+
map_element "p", to: :p
|
|
19
|
+
map_element "span", to: :span
|
|
20
|
+
map_element "a", to: :a
|
|
21
|
+
map_element "em", to: :em
|
|
22
|
+
map_element "strong", to: :strong
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Applet < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :codebase, :string
|
|
8
|
+
attribute :archive, :string
|
|
9
|
+
attribute :code, :string
|
|
10
|
+
attribute :object, :string
|
|
11
|
+
attribute :alt, :string
|
|
12
|
+
attribute :name, :string
|
|
13
|
+
attribute :width, :string
|
|
14
|
+
attribute :height, :string
|
|
15
|
+
attribute :align, :string
|
|
16
|
+
attribute :hspace, :string
|
|
17
|
+
attribute :vspace, :string
|
|
18
|
+
attribute :id, :string
|
|
19
|
+
attribute :klass, :string
|
|
20
|
+
|
|
21
|
+
xml do
|
|
22
|
+
element "applet"
|
|
23
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
24
|
+
mixed_content
|
|
25
|
+
map_content to: :content
|
|
26
|
+
map_attribute "codebase", to: :codebase
|
|
27
|
+
map_attribute "archive", to: :archive
|
|
28
|
+
map_attribute "code", to: :code
|
|
29
|
+
map_attribute "object", to: :object
|
|
30
|
+
map_attribute "alt", to: :alt
|
|
31
|
+
map_attribute "name", to: :name
|
|
32
|
+
map_attribute "width", to: :width
|
|
33
|
+
map_attribute "height", to: :height
|
|
34
|
+
map_attribute "align", to: :align
|
|
35
|
+
map_attribute "hspace", to: :hspace
|
|
36
|
+
map_attribute "vspace", to: :vspace
|
|
37
|
+
map_attribute "id", to: :id
|
|
38
|
+
map_attribute "class", to: :klass
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Area < Lutaml::Model::Serializable
|
|
6
|
+
attribute :shape, :string
|
|
7
|
+
attribute :coords, :string
|
|
8
|
+
attribute :href, :string
|
|
9
|
+
attribute :nohref, :string
|
|
10
|
+
attribute :alt, :string
|
|
11
|
+
attribute :tabindex, :integer
|
|
12
|
+
attribute :accesskey, :string
|
|
13
|
+
attribute :id, :string
|
|
14
|
+
|
|
15
|
+
xml do
|
|
16
|
+
element "area"
|
|
17
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
18
|
+
map_attribute "shape", to: :shape
|
|
19
|
+
map_attribute "coords", to: :coords
|
|
20
|
+
map_attribute "href", to: :href
|
|
21
|
+
map_attribute "nohref", to: :nohref
|
|
22
|
+
map_attribute "alt", to: :alt
|
|
23
|
+
map_attribute "tabindex", to: :tabindex
|
|
24
|
+
map_attribute "accesskey", to: :accesskey
|
|
25
|
+
map_attribute "id", to: :id
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class B < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :id, :string
|
|
8
|
+
attribute :klass, :string
|
|
9
|
+
attribute :style, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "b"
|
|
13
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
14
|
+
mixed_content
|
|
15
|
+
map_content to: :content
|
|
16
|
+
map_attribute "id", to: :id
|
|
17
|
+
map_attribute "class", to: :klass
|
|
18
|
+
map_attribute "style", to: :style
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Base < Lutaml::Model::Serializable
|
|
6
|
+
attribute :href, :string
|
|
7
|
+
attribute :id, :string
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
element "base"
|
|
11
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
12
|
+
map_attribute "href", to: :href
|
|
13
|
+
map_attribute "id", to: :id
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Basefont < Lutaml::Model::Serializable
|
|
6
|
+
attribute :id, :string
|
|
7
|
+
attribute :size, :string
|
|
8
|
+
attribute :color, :string
|
|
9
|
+
attribute :face, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "basefont"
|
|
13
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
14
|
+
map_attribute "id", to: :id
|
|
15
|
+
map_attribute "size", to: :size
|
|
16
|
+
map_attribute "color", to: :color
|
|
17
|
+
map_attribute "face", to: :face
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Bdo < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :dir, :string
|
|
8
|
+
attribute :id, :string
|
|
9
|
+
attribute :klass, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "bdo"
|
|
13
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
14
|
+
mixed_content
|
|
15
|
+
map_content to: :content
|
|
16
|
+
map_attribute "dir", to: :dir
|
|
17
|
+
map_attribute "id", to: :id
|
|
18
|
+
map_attribute "class", to: :klass
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyperlang
|
|
4
|
+
module Xhtml
|
|
5
|
+
class Big < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
attribute :id, :string
|
|
8
|
+
attribute :klass, :string
|
|
9
|
+
attribute :style, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "big"
|
|
13
|
+
namespace Hyperlang::Xhtml::Namespace
|
|
14
|
+
mixed_content
|
|
15
|
+
map_content to: :content
|
|
16
|
+
map_attribute "id", to: :id
|
|
17
|
+
map_attribute "class", to: :klass
|
|
18
|
+
map_attribute "style", to: :style
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|