Contents

LibreOffice Logo

English

Español

Português

SanityCheck 1.0.6

Macros to unify the format and styles of LibreOffice guides.

Copyright

This document is copyright © 2024 by the LibreOffice Documentation Team. Contributors are listed below. It may be distributed and modified under the terms of the GNU General Public License version 3 or later or the Creative Commons Attribution License,version 4.0 or later.

All trademarks mentioned in this guide belong to their rightful owners.

Author

Contributors

B.Antonio Fernández

Olivier Hallot

Sources

The macros that make up the extension described here are the result of consulting different sources which I name in general terms since it is impossible for me to go into detail. These are:

Introduction

SanityCheck is a macro library for Writer that is intended to help unify the formatting and styles of LibreOffice chapters and guides.

Although some tasks can be performed with Writer's own tools, macros attempt to centralize options that are specific to the chapter format and automate some processes that can be tedious and time-consuming.

As a safety rule, work on a copy of the file you are going to review and save your work progressively.

Use macros preferably in chapters, before assembling the guide, as it will be easier to correct formatting errors and will reduce macro execution time.

Installation and features

Macros are packaged as an extension and are installed like any other extension, from the extension manager. If you encounter problems updating or installing a new version, uninstall the old version and install the new version.

Figure 1: SanityCheck toolbar

SanityCheck toolbar

Macros description

Toggle highlights

The macro highlight or unhighlight guide styles applied in the document to easily distinguish the styles and check their correct application. It is especially useful for checking if lists have direct formatting applied.

Link template

Link the document with the supplied template that contains the documentation's own styles.

Figure 2: Link template dialog box

Diálogo Asociar plantilla

Document fields

The macro opens a dialog where you configure most of the document properties and custom fields used in chapters.

Figure 3: Document fields dialog box

Document fields dialog box

- The Chapter X and Title fields are new fields. These fields are used to set the Title document property and also for the footer. Its use is recommended for the chapter name on the first page.
- New Contributor and Editor fields (introduced in version 24) will be automatically populated

Rename Objects

This macro allows you to rename sections, frames, table, images and the index with a standard pattern for each object and consecutive numbering according to the order of appearance in the document.

Figure 4: Rename objects dialog box

Rename objects dialog box

In the new version of the chapters, the COPYRIGHT section must be included within the DISPLAYAREA section.
- When renaming sections the SEC_COPYRIGHT section is automatically moved to the beginning of SEC_DISPLAYAREA

Check styles

Figure 5: Style Check dialog box

Style Check dialog box

Macros can't do everything. The reviewer's job is to replace the styles outside the template with the correct ones and eliminate them from the document

Direct Format Cleanup

Figure 6: Format Cleaning dialog box

Format Cleaning dialog box

For the macro to correctly reset numbering, every list must be preceded by the Body Text, List Intro paragraph style. In many cases the style before the lists is Body text. The macro changes the style of preceding paragraphs to Body Text, List Intro style after a confirmation message.

Review of tables

Using a dialog, this macro allows you to go through the tables of the document and apply the LO User Guides table style to tables with data or optimize the spacing in the content position tables. You can edit the document while the dialog box is open.

Figure 7: Tables Review dialog box

Tables Review dialog box

Figures adjust

Figure 8: Images Review Log dialog box

Images Review Log dialog box

This macro has no initial dialog, it runs with the optimal settings for the frames and images. From the log dialog (Figure 8) you can access the Browse Images macro.

- Images whose aspect ratio is disproportionate.

- Images that have been cropped with Writer.

- Poorly formed captions (possible errors in the modification of an already inserted caption).

Browse Images

As with tables, you can browse the images through a dialog that shows information about the images and you can edit the document and some properties of the images and frames to correct errors. Please note that it does not modify the caption of the frames, only their description.

Figure 9: Images Review dialog box

Images Review dialog box

Info

Opens a dialog with version information (figure 10)

Figure 10: Info dialog box

Diálogo Info

Limitations, known issues and tips

Templates

Macros for checking styles and cleaning up direct formatting are based directly on the styles of the supplied templates.

For macros to work correctly, chapters must have the appropriate template applied.

Templates are provided for the English, Spanish and Portuguese languages, but only the templates corresponding to the interface language will be seen.

Styles

Problems with Style Names:

In some documents, due to the rush to publish the new version, paragraph styles have been created with names similar (but not the same) as they should be. This occurs in some chapters of the Writer 24.2 guide. For example, instead of Body Text, List Intro has the Body Text List Intro style applied (note that this name is without the comma)

Solution:

The macro replaces some of those styles with the correct ones, but it cannot handle all errors. Manually correct the affected styles.

Problem with character styles:

When clearing custom character styles, Writer does not update their status, and they continue to appear as applied even though they are not actually applied.

Solution:

Once the document has been cleaned of a character style, It must be saved and reloaded so that Writer can update the style status and, since it is not in use, it can be deleted.

Cleaning direct formatting of Paragraphs

The macro cannot distinguish what type of direct formatting has been applied to a paragraph, so it eliminates all direct formatting: indentation, numbering, spacing, etc.

Advice:

Use the Toggle Highlight macro before clearing direct formatting of paragraphs for a visual check.

A comparison with a pdf of the chapter you are updating can be very helpful.

Cleaning direct format of Numbers (ordered lists)

The numbering sequence in ordered lists may be interrupted by images, notices, notes or suggestions.

When clearing the format, the numbering sequence is lost and the numbering becomes continuous. The macros try to reset the numbering but it is not easy to distinguish where to reset them. Although the macro warns of points where it could be restarted, The macro is not infallible.

Advice:

Use the Toggle Highlight macro before clearing direct paragraph formatting for a visual check, and review the numbering after running the macro.

Tables

Custom table styles do not apply or function like paragraph or character styles, so even if you apply the LO User Guides style, you will most likely need to adjust the table for page splitting, if necessary and apply more appropriate formatting using Writer's Table Properties dialog.

Frames

When figures are adjusted, the frames automatically adapt to the largest width of the text or image. In some cases, the frames fit the full width of the text on the page.

Problem:

The problem may be due to a corrupted format in the original file.

Solution:

  1. Create a new document using the supplied template.

  2. Select all the text in the affected document and copy it over the new document.

  3. Work on the new document.

Images

In some cases, the macro inserts a comment on images that is not understandable.

Problem:

LibreOffice uses many decimals for the aspect ratio of images, (it may use pixels) and macros use a rule of three based on the dimensions of the images and sometimes the operation performed by LibreOffice does not coincide with that performed by the macros.

You can find a comment warning of a scaling problem and the width and height percentage are the same on the Crops page of the Image Properties dialog,

Solution:

Increase both or one of the percentages by one unit and you will not receive the warning.

Captions of the figures

In some cases the macro inserts a poorly formed caption comment that is not understandable.

Problem:

The macro gets the text from the caption and removes the “Figure” text based on the colon and space of the sequence.

When editing the caption directly there are times when the space after the points is forgotten.

Solution:

Correct the legend and run the macro again.

Problem:

In isolated cases the notice of poorly formed caption can be found and the caption was well formed.

This may be due to strange formatting in the figure, for example images with a double frame (nested frames).

Solution:

  1. Reconstruct the figure by copying just the image and pasting it into another paragraph (be sure to copy only the image).

  2. Insert a new caption.

About the translation

If you have read this far, you will have seen many vocabulary and grammatical errors.

This document is translated from Spanish with Google (some corrections made by me).

I'm sorry my English is so bad but I hope this document was understandable.