fix for #727; split up the list handling between base and LaTeX pu…#775
Open
opt12 wants to merge 1 commit into
Open
fix for #727; split up the list handling between base and LaTeX pu…#775opt12 wants to merge 1 commit into
opt12 wants to merge 1 commit into
Conversation
…and LaTeX publishing
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #727
Issue #727 Fix - Description of Changes
Summary
Fixed nested list handling in both LaTeX and HTML publishers. Lists with 2-space indentation and variable indentation depths now render correctly. Missing blank lines around lists are now quietly added so that it "just works".
Root Cause
Changes Made
1.
doorstop/core/publishers/base.pyAdded two new methods to BasePublisher:
_normalize_list_indentation(text):_fix_list_spacing(text):process_lists()and_check_for_list_end()were pulled todoorstop/core/publishers/latex.pyas it is not needed for Mrakdown and HTML publishing.Rationale: Central implementation in base class allows code reuse across all publishers.
2.
doorstop/core/publishers/html.pyModified
lines()method:_normalize_list_indentation()before markdown processing_fix_list_spacing()to ensure proper spacingRationale: HTML publisher relies on Python-Markdown which needs 4-space indentation. Normalization ensures compatibility.
3.
doorstop/core/publishers/latex.pyModified
process_lists()and_check_for_list_end():self.list["stack"]to track actual nesting levelsKey changes:
process_lists(): Uses stack to track indentation hierarchy instead of arithmetic_check_for_list_end(): Uses stack length to determine number of closing tags neededRationale: LaTeX publisher processes raw Markdown and must handle variable indentation common in user documents.
4. Tests
Added:
test_base_list_normalization.py: Tests for normalization and spacing functions (42 tests)test_html_list_handling.py: HTML-specific list rendering tests (9 tests)Modified:
test_publisher_latex_environments.py: Changedtest_missing_changing_list_indentationfrom expecting error to expecting success (flexible indentation is now allowed)test_flexible_indentation_complexfor complex nesting scenariosTechnical Details
Stack-Based Hierarchy Detection
Normalization Algorithm
Block Separation
Lists separated by non-list content (headings, paragraphs) are normalized independently, preventing incorrect merging.
Compatibility
Benefits