Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display attribute for Math tag #4

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/mml/math_with_namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ class MathWithNamespace < Lutaml::Model::Serializable
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
end

attribute :display, :string

xml do
root "math", mixed: true
namespace "http://www.w3.org/1998/Math/MathML", nil

Mml::Configuration::SUPPORTED_TAGS.each do |tag|
map_element tag.to_sym, to: :"#{tag}_value"
end

map_attribute :display, to: :display
end
end
end
4 changes: 4 additions & 0 deletions lib/mml/math_with_nil_namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ class MathWithNilNamespace < Lutaml::Model::Serializable
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
end

attribute :display, :string

xml do
root "math", mixed: true

Mml::Configuration::SUPPORTED_TAGS.each do |tag|
map_element tag.to_sym, to: :"#{tag}_value"
end

map_attribute :display, to: :display
end
end
end
2 changes: 1 addition & 1 deletion lib/mml/mml.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

DEFAULT_ADAPTER = if RUBY_VERSION == "opal"
DEFAULT_ADAPTER = if RUBY_ENGINE == "opal"
require "lutaml/model/xml_adapter/oga_adapter"
:oga
else
Expand Down
2 changes: 1 addition & 1 deletion lib/mml/mn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Mml
class Mn < Lutaml::Model::Serializable
model Mml::Configuration.class_for(:mn)

attribute :value, :integer
attribute :value, :string
attribute :mathcolor, :string
attribute :mathbackground, :string
attribute :mathvariant, :string
Expand Down
2 changes: 1 addition & 1 deletion mml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_runtime_dependency "lutaml-model", "~> 0.3"
spec.add_runtime_dependency "lutaml-model", "~> 0.5"
spec.add_runtime_dependency "zeitwerk"
end
2 changes: 1 addition & 1 deletion spec/fixtures/with_namespace/example_1.mml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<math xmlns="http://www.w3.org/1998/Math/MathML">
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>i</mi>
<mo>+</mo>
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/without_namespace/example_1.mml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<math>
<math display="block">
<mrow>
<mi>i</mi>
<mo>+</mo>
Expand Down
Loading