Styles in HTML guides

I am publishing the guides in Spanish in HTML format, but I am having some problems with the formatting.

For the publication of the Spanish guides, I started from a copy of the structure of the English guides.

Although the publication is correct and the headers of each chapter take the colors corresponding to the guide, I can’t get the styles of the titles of each section to have the correct color, they are always published in the green color of the titles in the ODT document.

What do I have to do to make it take the right colors? in which file are these colors configured? should I modify them before exporting to HTML?

On the other hand, I have noticed that when I do the export, the numbered lists are reset to 1 if they previously have some sub-level. How can I correct this? should I correct it by hand after the export?

HI Juan
You are right. Apologies for forgetting to tell you about that.

I applied a specific template just before exporting to HTML with the headings colors cin accordance to the Guide main color (blue for Writer, green for Calc, Gray for Getting Started…) . After applying the template I do the export with writer2html.oxt .

Process is: apply the template attached below on chapter, and then run the script. You also must remove the section COPYRIGHT before running the script.

The template I used for GS guides is attached (note that the Headings colors are changed) (244,1,KB)

For the numbered lists, I did a hack with a script: change the number list to a non-list style and prepend the list number to the paragraph.

Here is the code

Sub ConvertNumberedListToLabels
REM must remove all sub-sections before
REM MUST apply template before running this script to get extra styles
    oSection = ThisComponent.getTextSections().getByName("SEC_DISPLAYAREA")
    oParEnum = oSection.getAnchor().createEnumeration()
    vCursor = Thiscomponent.CurrentController.getViewCursor()

REM Pre-pend list number to paragraph contents
    Do While oParEnum.hasMoreElements()
       oPar = oParEnum.nextElement()
       If oPar.supportsService("") Then
          If oPar.NumberingIsNumber Then
          If ((oPar.NumberingStyleName = "Numbering 1") _
          or  (oPar.NumberingStyleName = "Numbering 2") _
          or  (oPar.NumberingStyleName = "Numbering 3")) Then
             oCurs = oPar.getText().createTextCursorbyRange(oPar.Anchor)
             oCurs.CharStyleName = "Strong Emphasis"
             labelString = oPar.ListLabelString & " "
             oCurs.getText().insertString(oCurs, labelString , False)
          End If
          End If
       End If

REM Change numbered paragraph to list-less paragraph style HNumbering1,2,3 available in template 
REM and remove list attached 
    oParEnum2 = oSection.getAnchor().createEnumeration()
    Do While oParEnum2.hasMoreElements()
       oPar = oParEnum2.nextElement()
       If oPar.supportsService("") Then 
       If oPar.NumberingIsNumber Then
          If (oPar.NumberingStyleName = "Numbering 1") Then
             vCursor.ParaStyleName = "HNumbering 1"
             oPar.NumberingIsNumber = False
             oPar.NumberingStyleName =""
          ElseIf (oPar.NumberingStyleName = "Numbering 2") Then
             vCursor.ParaStyleName = "HNumbering 2"
             oPar.NumberingIsNumber = False
             oPar.NumberingStyleName =""
          ElseIf (oPar.NumberingStyleName = "Numbering 3") Then
             vCursor.ParaStyleName = "HNumbering 3"
             oPar.NumberingIsNumber = False
             oPar.NumberingStyleName = ""
          End If
       End If
       End If
    Msgbox "List done"
End Sub


PS. I promise once I have time, to write better, less hacky, more professional scripts…

So, as far as I can see, you use the border color in guidecolors.css of every guide as the color of the titles in the, don’t you?


The first numbered list of each chapter file using paragraph style Numbering 1, 2, or 3 should be set to start at 1.
Go to Format > Paragraph on the Menu bar to open Paragraph dialog.
Select "Restart numbering at this paragraph” and "Start with:1”.

The heading color used in chapters is set to LibreOffice Green.

Hope that helps.

Peter Schofield
Technical Writer, LO Documentation Team