Skip to content

Definition list spacing#124

Open
rbfrank wants to merge 3 commits intodevelopfrom
definition-list
Open

Definition list spacing#124
rbfrank wants to merge 3 commits intodevelopfrom
definition-list

Conversation

@rbfrank
Copy link
Copy Markdown
Collaborator

@rbfrank rbfrank commented Dec 30, 2025

Fix description list wrapped line indentation to use dindent option

Summary

Modified description list (.dl) processing to make wrapped continuation line indentation configurable via the dindent option, replacing the hardcoded 2-space indent.

Changes

Text Output (ppgen.py)

  • wrap_def() method (lines 7960-7977): Changed hanging indent calculation to use dindent when specified
  • emit_paragraph() method (lines 7865-7872): Applied same logic for paragraph/combining mode
  • When dindent > 0: Uses dindent value as the hanging indent amount
  • When dindent = 0 (default): Maintains backward-compatible 2-space hanging indent

HTML Output (ppgen.py)

  • begin_dl() method (lines 11992-12063): Updated CSS generation for hanging indents
  • Fixed issue where dindent was shifting the entire definition (including first line) to the right
  • Now matches text output: first line position stays constant, only wrapped continuation lines are affected
  • Applies to both float=y and float=n modes

Leading Spaces in Descriptions

  • Fixed bug where leading spaces after | in descriptions weren't being converted to CSS in HTML output
  • Added CSS class generation (.dd_inN) for indent amounts
  • Classes now properly applied to both <dd> tags (style=d) and <p> tags (style=p)
  • Leading spaces stripped from HTML content and represented via CSS padding

Behavior

  • Backward compatible: Default dindent=0 preserves existing 2-space hanging indent
  • Configurable: Setting dindent=4 creates 4-space hanging indent for wrapped lines
  • Consistent: Text and HTML output now match visually
  • First line stable: Changing dindent only affects continuation lines, not first line position

Testing

Verified with multiple test cases:

  • Default dindent=0 maintains backward compatibility
  • Custom values (dindent=4, dindent=6) work correctly
  • Both combining (combine=y) and non-combining modes tested
  • Both hang=y and hang=n modes work as expected
  • HTML and text output match

@rbfrank rbfrank requested a review from wf49670 December 30, 2025 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant