Bug 161173 - Replace built-in STW templates with OTH generated from XML
Summary: Replace built-in STW templates with OTH generated from XML
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: target:25.2.0
Keywords:
Depends on:
Blocks: Templates
  Show dependency treegraph
 
Reported: 2024-05-19 10:28 UTC by Mike Kaganski
Modified: 2024-09-23 09:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-05-19 10:28:21 UTC
There are some STW templates in LibreOffice, packaged and distributed. One of them is share/template/common/internal/html.stw (generated using "StarOffice 6.1 BETA1 (Win32)"); it is loaded automatically when opening an HTML document using "HTML Document" filter (not "HTML Document (Writer)").

There are some problems here. Why would we use a really obsolete file format as a built-in template? Why would we keep it as a binary in the source, which makes it not obvious how to change e.g. curious peculiarity that HTML documents have first level of outline numbering unassigned to a heading paragraph style (unlike the other levels)?

The proposal is to replace this STW with the source XML files, which would be compiled into an OTT at build time, similar to how our other built-in templates are created.

I hope that this could be easyhackable - but I don't know much about the actual machinery used for our templates generated from XMLs. Heiko, could you please advise?
Comment 1 Mike Kaganski 2024-05-19 10:51:12 UTC
The correct WEB document template extension is not OTT, but OTH.
The code that creates the path of the template is HTMLReader::GetTemplateName (sw/source/filter/html/swhtml.cxx). It already tries to load OTH first (since commit 1ee901d4496b79d39fbffde8bce988a159dda74e), so the proposal would need no code changes beyond the way how the binary is generated and packaged.
Comment 2 Heiko Tietze 2024-05-21 07:15:28 UTC
Laurent has gained some mastery in this area, though mostly for Impress (see README in https://gerrit.libreoffice.org/c/core/+/140537 and https://gerrit.libreoffice.org/c/core/+/137159 for the actual conversion).
Comment 3 Laurent Balland 2024-05-22 08:58:15 UTC
I want to finish update of Impress templates bug 160712 before LibO 24.8 beta1.
Then this bug sounds interesting.
Comment 4 Commit Notification 2024-06-12 08:42:58 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c49da95942f456623e91ae1f5c1a68efd83fec6c

tdf#161173 Replace HTML template and idxexample

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.