-
Notifications
You must be signed in to change notification settings - Fork 57
Having only one list item in the root that is not last creates invalid html #24
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2579ff0
refs #24: added a test showing that certain lists generate invalid ht…
cdaed19
refs #24: fixed the justification handler
371754a
refs #24: Early return if the first list element is also the last.
56c90d3
Merge branch 'master' into issue_24
1b6a086
Merge branch 'master' into issue_24
ca82b6c
refs #24: test cleanup
89584ed
Merge branch 'master' into issue_24
3a1f9f8
Merge branch 'master' into issue_24
aacf1ae
refs #24: added a comment
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -461,10 +461,32 @@ def parse_list(self, el, text): | |
return self.parse_table_cell_contents(el, parsed) | ||
return parsed | ||
|
||
def _build_list(self, el, text): | ||
# Get the list style for the pending list. | ||
lst_style = self.get_list_style( | ||
el.num_id.num_id, | ||
el.ilvl, | ||
) | ||
|
||
parsed = text | ||
# Create the actual list and return it. | ||
if lst_style == 'bullet': | ||
return self.unordered_list(parsed) | ||
else: | ||
return self.ordered_list( | ||
parsed, | ||
lst_style, | ||
) | ||
|
||
def _parse_list(self, el, text): | ||
parsed = self.parse_list_item(el, text) | ||
num_id = el.num_id | ||
ilvl = el.ilvl | ||
# Everything after this point assumes the first element is not also the | ||
# last. If the first element is also the last then early return by | ||
# building and returning the completed list. | ||
if el.is_last_list_item_in_root: | ||
return self._build_list(el, parsed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to see a comment here. Why do we want to just call |
||
next_el = el.next | ||
|
||
def is_same_list(next_el, num_id, ilvl): | ||
|
@@ -523,20 +545,7 @@ def should_parse_last_el(last_el, first_el): | |
if parsed == '': | ||
return parsed | ||
|
||
# Get the list style for the pending list. | ||
lst_style = self.get_list_style( | ||
el.num_id.num_id, | ||
el.ilvl, | ||
) | ||
|
||
# Create the actual list and return it. | ||
if lst_style == 'bullet': | ||
return self.unordered_list(parsed) | ||
else: | ||
return self.ordered_list( | ||
parsed, | ||
lst_style, | ||
) | ||
return self._build_list(el, parsed) | ||
|
||
def parse_p(self, el, text): | ||
if text == '': | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
And this actually makes the code cleaner, anyway. Nice