Class: EpubTools::XHTMLCleaner
- Inherits:
-
Object
- Object
- EpubTools::XHTMLCleaner
- Defined in:
- lib/epub_tools/xhtml_cleaner.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(filename, class_config = 'text_style_classes.yaml') ⇒ XHTMLCleaner
constructor
A new instance of XHTMLCleaner.
Constructor Details
#initialize(filename, class_config = 'text_style_classes.yaml') ⇒ XHTMLCleaner
Returns a new instance of XHTMLCleaner.
8 9 10 11 |
# File 'lib/epub_tools/xhtml_cleaner.rb', line 8 def initialize(filename, class_config = 'text_style_classes.yaml') @filename = filename @classes = YAML.load_file(class_config).transform_keys(&:to_sym) end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/epub_tools/xhtml_cleaner.rb', line 13 def call raw_content = read_and_strip_problematic_hr doc = parse_xml(raw_content) remove_empty_paragraphs(doc) remove_bold_spans(doc) replace_italic_spans(doc) unwrap_remaining_spans(doc) write_pretty_output(doc) end |