Class: Decidim::Proposals::OdtToMarkdown
- Inherits:
-
Object
- Object
- Decidim::Proposals::OdtToMarkdown
- Defined in:
- lib/decidim/proposals/odt_to_markdown.rb
Overview
This class parses a participatory text document in markdown and produces Proposals 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 MarkdownToProposals 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 proposal.
- #to_md ⇒ Object
Constructor Details
#initialize(doc) ⇒ OdtToMarkdown
Public: Initializes the serializer with a proposal.
17 18 19 |
# File 'lib/decidim/proposals/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/proposals/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 |