Class: Decidim::EnhancedTextwork::OdtToMarkdown
- Inherits:
-
Object
- Object
- Decidim::EnhancedTextwork::OdtToMarkdown
- Defined in:
- lib/decidim/enhanced_textwork/odt_to_markdown.rb
Overview
This class parses a participatory text document in markdown and produces Paragraphs in the form of sections and articles.
This implementation uses Redcarpet Base renderer. Redcarpet::Render::Base performs a callback for every block it finds, what MarkdownToParagraphs does is to implement callbacks for the blocks which it is interested in performing some actions.
Instance Method Summary collapse
-
#initialize(doc) ⇒ OdtToMarkdown
constructor
Public: Initializes the serializer with a paragraph.
- #to_md ⇒ Object
Constructor Details
#initialize(doc) ⇒ OdtToMarkdown
Public: Initializes the serializer with a paragraph.
17 18 19 |
# File 'lib/decidim/enhanced_textwork/odt_to_markdown.rb', line 17 def initialize(doc) @doc = doc end |
Instance Method Details
#to_md ⇒ Object
21 22 23 24 25 |
# File 'lib/decidim/enhanced_textwork/odt_to_markdown.rb', line 21 def to_md doc_file = doc_to_tmp_file md_file = transform_to_md_file(doc_file) md_file.read end |