Class: Slamdown::Conversion::SemanticExtractor
- Inherits:
-
Object
- Object
- Slamdown::Conversion::SemanticExtractor
- Defined in:
- lib/slamdown/conversion/semantic_extractor.rb
Overview
Reads the small registered set of semantic source attributes before retention policy can discard those attributes.
Constant Summary collapse
- HTML_WHITESPACE =
/[\t\n\f\r ]+/.freeze
- LANGUAGE_CLASS =
/\Alanguage-([A-Za-z0-9+_.-]+)\z/.freeze
- RECOGNISED_STYLE_PROPERTIES =
%w[font-weight font-style text-decoration].freeze
Instance Method Summary collapse
-
#consumed_class?(node, token) ⇒ Boolean
Language classes become fence metadata and must not also survive as presentation classes.
- #extract(node) ⇒ Object
Instance Method Details
#consumed_class?(node, token) ⇒ Boolean
Language classes become fence metadata and must not also survive as presentation classes.
25 26 27 |
# File 'lib/slamdown/conversion/semantic_extractor.rb', line 25 def consumed_class?(node, token) ["code", "pre"].include?(node.source_name) && LANGUAGE_CLASS.match(token) end |
#extract(node) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/slamdown/conversion/semantic_extractor.rb', line 12 def extract(node) attributes = Hash[node.attributes] values = {} extract_image_fallback(node, attributes, values) extract_span_styles(node, attributes, values) extract_code_language(node, attributes, values) extract_table_spans(node, attributes, values) values end |