Class: Uniword::Mhtml::StylesConfiguration
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Mhtml::StylesConfiguration
- Defined in:
- lib/uniword/mhtml/styles_configuration.rb
Overview
MHTML-specific Styles Configuration class
This is SEPARATE from OOXML WordprocessingML StylesConfiguration. MHTML uses HTML/CSS for styling, not OOXML style parts.
This class manages style definitions for MHTML documents and provides CSS output for MHTML serialization.
Instance Method Summary collapse
-
#add_style(name, properties) ⇒ Object
MHTML-specific: Add a style.
-
#style(name) ⇒ Hash?
MHTML-specific: Get style by name.
-
#to_css ⇒ String
MHTML-specific: Convert styles to CSS.
Instance Method Details
#add_style(name, properties) ⇒ Object
MHTML-specific: Add a style
45 46 47 |
# File 'lib/uniword/mhtml/styles_configuration.rb', line 45 def add_style(name, properties) styles[name.to_s] = properties end |
#style(name) ⇒ Hash?
MHTML-specific: Get style by name
37 38 39 |
# File 'lib/uniword/mhtml/styles_configuration.rb', line 37 def style(name) styles[name.to_s] end |
#to_css ⇒ String
MHTML-specific: Convert styles to CSS
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/uniword/mhtml/styles_configuration.rb', line 21 def to_css css = +"" styles.each do |name, properties| css << ".#{name} {\n" properties.each do |prop, value| css << " #{prop_to_css(prop)}: #{value};\n" end css << "}\n\n" end css end |