Oliver, I will start working my way down the list to see if I can find good ways to mitigate and attempt to develop common sense rules to automatically fix things.
QUESTION: Is there a nice list of "approved paragraph styles" that I can use to look for styles that are not on the approved list? I have been out of the documentation game for a while.
I randomly chose a small chapter to look and something longer.
To start, I do NOT want to fix things, but to understand what I am seeing. My first macro writes a summary of what it sees along with the document URL. The URL points to a file on my hard drive.
First, I looked at embedded figures:
Document 1. Everything is fine except that the LOGO is anchored to a paragraph with the wrong style. I am not sure that we want the Logo to follow the conventional naming convention. Perhaps I can assume that all logos are named "LibreOfficeLogo" and skip it. Here is my firs summary:
*********** START SUMMARY DOCUMENT 1 *******************
file:///andrew0/home/andy/Documents/OpenOffice/LibreOfficeDocumentation/WG7202-WorkingWithTextBasics.odt
Figure (LibreOfficeLogo) anchored to paragraph style New Chapter
Figures not anchored as character: 0
Figures anchored to the wrong paragraph style: 1
*********** END SUMMARY DOCUMENT 1 *******************
The next document was longer and had some more interesting issues:
It looks like every chapter has the logo anchored to a paragraph named New Chapter. Perhaps the rule is that I do NOT attempt to change paragraph style for "New Chapter" and I do NOT look for a caption. Note that I did not try to look at captions yet. For exporting purposes, we might want to still anchor these images as a character rather than "AT_PARAGRAPH". Note that "AT_PARAGRAPH" is an internal name to LO.
I do see a "Text Body" for Image2, which corresponds to the very last image, about "Writer Guide" on the last page. Another image that we probably do NOT want to change.
I see that this document has graphics50 and graphics39, which are in a table where the table paragraph style is "Figure" and there is no caption. So need to watch for that somehow rather than blindly modifying all tables to use styles "Table Heading" or "Table Contents"
I see that Table 27 is kind of like a caption for Figure 59 and all paragraphs are of style Caption. That can probably be changed with no problem.
*********** START SUMMARY DOCUMENT 2 *******************
file:///andrew0/home/andy/Documents/OpenOffice/LibreOfficeDocumentation/0312CG3-CalcMacros_ADP_JHW_CW_20100428.odt
Figured (Image1) is anchored AT_PARAGRAPH Anchored paragraph style name is: Guide Name
Figured (Image1) anchored to paragraph style Guide Name
Figured (LibreOfficeLogo) anchored to paragraph style New Chapter
Figured (Image3) anchored to paragraph style New Chapter
Figured (Image18) anchored to paragraph style New Chapter
Figured (Shape 1) is anchored AT_PARAGRAPH Anchored paragraph style name is: Figure
Figured (Image2) is anchored AT_PARAGRAPH Anchored paragraph style name is: Text body
Figured (Image2) anchored to paragraph style Text body
Figured (Image42) anchored to paragraph style New Chapter
Figured (Image60) anchored to paragraph style New Chapter
Figured (Image90) anchored to paragraph style New Chapter
Figured (Image102) is anchored AT_PARAGRAPH Anchored paragraph style name is: Caption
Figured (Image102) anchored to paragraph style Caption
Figured (Image113) anchored to paragraph style New Chapter
Figured (Image143) anchored to paragraph style New Chapter
Figured (Image168) anchored to paragraph style New Chapter
Figured (Image196) anchored to paragraph style New Chapter
Figured (Image213) anchored to paragraph style New Chapter
Figured (Image224) anchored to paragraph style New Chapter
Figured (Image253) anchored to paragraph style Text body
Figured (Image260) anchored to paragraph style New Chapter
Figured (Image282) is anchored AT_PARAGRAPH Anchored paragraph style name is: Caption
Figured (Image282) anchored to paragraph style Caption
Figured (Image288) anchored to paragraph style New Chapter
Figured (Image306) anchored to paragraph style New Chapter
Figured (Image335) anchored to paragraph style New Chapter
Figured (Image363) anchored to paragraph style New Chapter
Figured (Image387) anchored to paragraph style New Chapter
Figured (Image405) anchored to paragraph style New Chapter
Figured (Image424) anchored to paragraph style New Chapter
Figured (Object53) anchored to paragraph style Standard
Figured (Image431) anchored to paragraph style New Chapter
Figured (Image462) anchored to paragraph style New Chapter
Figures not anchored as character: 5
Figures anchored to the wrong paragraph style: 28
*********** END SUMMARY DOCUMENT 2 *******************
Hello Andrew
Thanks for the kind offer!!!
There are a set of scripts that we welcome for the LibreOffice Guides
sanity maintenance. Often we do this manually but automation hours of
work. Here is the list:
- Remove all direct formatting, but flag where it occurred, for later
inspection.
- Traverse the document and flag styles "not listed" in the official
template style (legacy styles, Cut&paste imported contents...)
+ paragraph, character, frame, pages
+ add a comment on the offending object for manual removal
- Clean lists: ensure paragraph with bullets and numbering are actually
a paragraph with the right list style.
+ Often I see "Text Body + direct bullet" rendered exactly as "List 1".
+ Bullet applied directly on "List 1" paragraphs (breaks list
alignment).
+ outlines applied directly on paragraph (breaks list alig't)
- As you noticed, ensure all images are anchored "as character"
+ Paragraph holding the image must have paragraph-style "Figure"
+ Caption must have paragraph style "Caption"
- Apply table style to table
+ AFAIK there is only one style for all tables, except
+ tables used to align objects in the page
Kind regards,
Olivier