-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#38 list continuations #126
base: main
Are you sure you want to change the base?
Conversation
d1f097d
to
ec037ce
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #126 +/- ##
=======================================
Coverage 97.02% 97.02%
=======================================
Files 3 3
Lines 168 168
=======================================
Hits 163 163
Misses 5 5 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be merged or is it still WIP?
- 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
ec037ce
to
76c1718
Compare
table = ast.first[:table] | ||
|
||
|
||
obj = {:table=> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this not a Ruby object tree? There should NOT be any hashes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coradoc does:
Coradoc text -> AST -> Ruby object tree
In particular, those tests are for the first step. And AST is represented with Ruby hashes.
@@ -30,7 +30,7 @@ | |||
generated_adoc = Coradoc::Generator.gen_adoc(doc) | |||
cleaned_adoc = Coradoc::Input::HTML.cleaner.tidy(generated_adoc) | |||
File.open("#{file_path}.roundtrip","w"){|f| f.write(cleaned_adoc)} | |||
`diff -B #{file_path} #{file_path}.roundtrip > #{file_path}.roundtrip.diff` | |||
`diff -BNaur #{file_path} #{file_path}.roundtrip > #{file_path}.roundtrip.diff` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better write a separate RSpec matcher that compares 2 Coradoc Document trees in addition to two string compares?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is just an utility at this point. It would make sense to make some roundtripping tests, but at the time we are not at 100% coverage.
is this revision related to this issue #139 ? |
thanks @webdev778 if you have time, #139 also describes lists that are being truncated, it could be similar. please discuss with @ronaldtse |
@ReesePlews This PR is for AsciiDoc parsing. You probably mean HTML conversion to AsciiDoc. So this is unrelated. |
#38 list continuations
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.
Other improvements:
Metanorma PR checklist