-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ListItem: added attaching block paragraph/block/admonition - List: added multiple tests in various combinations of the above e.g. nested lists, attached paragraph, attached admonition, two attached paragraphs, nested list with attached paragraph, nested list with attached multiline paragraph, attached paragraph and nested list Important improvement: code in Coradoc::Parser::Asciidoc::Base that converts grammar rules written as ruby methods into proper parslet rules, which as it turned out was not the case previously. On top of that, it goes beyond what parslet is capable by also supporting arguments. Due to this improvement time for running all the tests came down (on tested hardware, approximately) from 50 seconds to 10 seconds (5x speedup) and time for running utils/round_trip.rb came down from 2.5 minutes to 3 seconds (50x speedup), which is also realistic input. This improvement makes it possible to iterate on grammar rules much faster, develop parsing inlines and potentially parsing input from various sources, for example test cases from asciidoc, in much more reasonable time. - Coradoc::Parser::Asciidoc::Base was changed from a module to a class, rules previously contained there were moved to module Coradoc::Parser::Asciidoc::Text Other improvements: - Blocks: added missing block types: listing, open. added missing properties in literal block. (based on things noticed with utils/round_trip.rb) - Grammar rules to be used inside of other rules e.g. line_start?, line_not_text?. Purpose of those rules is making sure rules using them are applied by parser only in places they should be applied. - Tests for blocks, paragraph, table, two parsing bugs to be fixed - Minor fixes in tests
- Loading branch information
Showing
36 changed files
with
1,027 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Coradoc | ||
module Element | ||
module Block | ||
class Listing < Core | ||
def initialize(_title, options = {}) | ||
@id = options.fetch(:id, nil) | ||
@anchor = @id.nil? ? nil : Inline::Anchor.new(@id) | ||
@lang = options.fetch(:lang, "") | ||
@attributes = options.fetch(:attributes, AttributeList.new) | ||
@lines = options.fetch(:lines, []) | ||
@delimiter_char = "-" | ||
@delimiter_len = options.fetch(:delimiter_len, 4) | ||
end | ||
|
||
def to_adoc | ||
"\n\n#{gen_anchor}#{gen_attributes}\n#{gen_delimiter}\n" << gen_lines << "\n#{gen_delimiter}\n\n" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Coradoc | ||
module Element | ||
module Block | ||
class Open < Core | ||
def initialize(title, options = {}) | ||
@title = title | ||
@id = options.fetch(:id, nil) | ||
@anchor = @id.nil? ? nil : Inline::Anchor.new(@id) | ||
@lang = options.fetch(:lang, "") | ||
@attributes = options.fetch(:attributes, AttributeList.new) | ||
@lines = options.fetch(:lines, []) | ||
@delimiter_char = "-" | ||
@delimiter_len = options.fetch(:delimiter_len, 2) | ||
end | ||
|
||
def to_adoc | ||
"\n\n#{gen_anchor}#{gen_attributes}#{gen_delimiter}\n" << gen_lines << "\n#{gen_delimiter}\n\n" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.