View Single Post
Old 01-12-2026, 10:02 PM   #24
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,588
Karma: 6774048
Join Date: Nov 2009
Device: many
FWIW: all_caps will *always* be false in the new forced_titlecase code all the time so that entire block is not used when the new force_titlecase python replacement function is used.

I have attached a screenshot with your testcases set up in the xhtml, and a screenshot of the new force_titlecase function inside the Python Function Editor (just hit the cursive f 'for function' in the Find Replace dialog to access the Python Function Editor). And finally the results from hitting find followed by replace for each test case.

As you can see it works perfectly.

I have also attached a public domain junk_test.epub that has your test cases in chapter 1, in case you want to use it in your testing.

As an aside, when allcaps is true, a single word in all uppercase will always match the UC_INITIALS regex. It will not match mixed case, meaning it will pass it through unchanged.
Attached Thumbnails
Click image for larger version

Name:	your_testcase_before.png
Views:	63
Size:	286.5 KB
ID:	220269   Click image for larger version

Name:	python_function_editor.png
Views:	54
Size:	89.0 KB
ID:	220270   Click image for larger version

Name:	results_forced_titlecase.png
Views:	70
Size:	287.3 KB
ID:	220271  
Attached Files
File Type: epub junk_test.epub (5.93 MB, 64 views)

Last edited by KevinH; 01-12-2026 at 10:29 PM.
KevinH is offline   Reply With Quote