class Srx::Format::Xml
Support for XML
@see www.w3.org/TR/xml/
Constants
- ATTRIBUTE
- ATT_VALUE
- CHAR_REF
- EMPTY_ELEM_TAG
- END_TAG
- ENTITY_REF
- EQUALS
- NAME
- NAME_CHAR
rubocop:enable Layout/LineLength
- NAME_START_CHAR
rubocop:disable Layout/LineLength
- REFERENCE
- SPACE
- START_TAG
- TAG
Public Instance Methods
end_formatting?(markup)
click to toggle source
# File lib/srx/format/xml.rb, line 37 def end_formatting?(markup) END_TAG.match?(markup) end
extract_markups(str)
click to toggle source
# File lib/srx/format/xml.rb, line 29 def extract_markups(str) extract_markups_by_pattern(str, TAG) end
isolated_formatting?(markup)
click to toggle source
# File lib/srx/format/xml.rb, line 41 def isolated_formatting?(markup) EMPTY_ELEM_TAG.match?(markup) end
start_formatting?(markup)
click to toggle source
# File lib/srx/format/xml.rb, line 33 def start_formatting?(markup) START_TAG.match?(markup) end
Protected Instance Methods
extract_markups_by_pattern(str, pattern)
click to toggle source
@param str [String] @param pattern [Regexp]
# File lib/srx/format/xml.rb, line 49 def extract_markups_by_pattern(str, pattern) markups = [] plain_text = str.gsub(pattern) do |match| markups << [$LAST_MATCH_INFO.begin(0), match] '' end [plain_text, markups] end