gramps icon indicating copy to clipboard operation
gramps copied to clipboard

Render reports with styled notes containing subscript and strikethrough

Open hgohel opened this issue 6 months ago • 10 comments

Fixes #13417

With this change all reports should be able to render styled notes using subscript or strikethrough without throwing exceptions.

  1. Add support for subscript and strikethough in DocBackend.
  2. Implement support for subscript and strikethrough in:
  • CairoBackend
  • LatexBackend Use package ulem for strikethrough support. ulem overrides rendering of emphasis, so specified normalel option to maintain the default. ~A bug in str_inc was being triggered during my testing. I used AI to fix the code and it seems to work. I haven't investigated whether this will change anything, but the code seems to work. Looking for review on the code change, ways to test, or other comments~ Update: AI generated code reverted as it is explicitly forbidden by Gramps contribution rules. Bug #13418 filed to track this issue separately as it is not the target of the bug being addressed by PR.
  • HTMLBackend
  • ODFBackend Add two new styles GSub and GStrikethrough to support subscript and strikethrough formatting, and implemented the two in odfdoc.py

Testing

  1. Create a note that includes subscript and strikethrough, and attach to a person
  2. Run any report which would include that note. Example: Complete Individual Report for that person
  3. Render report in all formats and verify that (1) no exceptions are thrown and (2) output is rendered appropriately for the format. For Text and RTF, these styles will not have any effect, other formats including PDF, HTML, LaTeX, ODT, PS you will see the style applied.

Todo

  1. Add methods similar to start[end]_superscript for subscript and strikethrough in each of the Doc classes so that plugins and addons can use the same functionality. For compatibility, this should be introduced in 5.3 so plugins can specify Gramps version required.
  2. Add similar API for italics since no API is available for that today. See thread on discourse: https://gramps.discourse.group/t/reports-normal-italic-and-bold-within-a-paragraph/5106/5

hgohel avatar Sep 03 '24 15:09 hgohel