Converting Numbers to Footnotes

Dear Libre Office Community,

first of all - thank you for the amazing work. I am using LibreOffice for years and have enjoyed it a lot. Right now I have a rather tricky problem. I got an LibreOffice odt doument with the following plaintext content (check out example link and file below the comment). The part below “Footnotes” is formatted as a numbered list:

Some Text.[1]

Some more text …


  1. Footnote Content related to the [1] above

This text results from an export of a Mediawiki file from the german Wikibooks version. The export happened through a tool made for multi-format exporting. Everything works fine except for the footnotes.

Is there any way to fix this with a Libre Office Script? Could you please hint me to a place for initial research. I have no experience in writing Libre Office Scripts. We have also some project money from Wikimedia, which we could use to pay freelance coders.

To give you some background: We are a group of legal Open Science Researchers writing Open Educational Ressources at Wikibooks. In order to publish our material with publishers we need to send them manuscripts in odt-format.

I appreciate any help.



Example Website: Kapitel Export – Wikibooks, Sammlung freier Lehr-, Sach- und Fachbücher

Example Export-Data: example-odt-export-from-mediawiki.odt

I fear the answer is “No” or “Maybe” but with a very complicated macro.

The main reason for a negative answer is the “quality” of the export. I bet this export is done with direct formatting, i.e. without defining a template or at least a set of styles to apply to the initial HTML data. The initial HTML may itself be “low quality”, i.e. its CSS stylesheet not designed in the ODF-like style philosophy.

To be able to give more appropriate clues, edit your question to attach a small sample (max. 2 pages) of your exported .odt file. Depending on how the wiki page is marked up, it may be preferable to create a new exporter so as not to lose the footnote property.

As it appears from your description, footnotes have transformed into a numbered list and are no longer related to the anchor. Eventually, there may exist an hyperlink between the anchor and the “note” and this could be put to advantage by a macro.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

Please do not use Add Answer but edit your original question to enhance the details of your question (answers are reserved for solutions to a problem on this Q&A site).

Thank you for the quick answer. I added an example link and file below my initial comment.

“CSS stylesheet not designed in the ODF-like style philosophy”, does that mean, that we could fix the export issues with CSS properties?

“create a new exporter” - You mean tweaking the export-tool might be easier instead of using a macro afterwards?

CSS: no chance. I had a look at the HTML code of the link. The HTML is a real mess with formatting applied directly with attribute style="…", similar to direct-formatting in LO. Even class="…" are not put to a use similar to Writer styles. The CSS stylesheets only define fancy color/graphics decorations. No way to “retro-engineer” the HTML to some high-level meaning.

Using the Wiki mark up could be a better track. My suggestion is: copy the raw Wiki markup (from Bearbeiten editor window) into some text file. Use a macro generator to rework this text file, thus replacing the exporter, unless you find easier to patch the current exporter if it operates on the markup. The important thing is not to lose information about initial semantics.

The .odt file cannot be further processed because the note anchor [1] is now plain text and has no longer any relation to the bottom numbered list item. Worse, paragraphs are only Heading n or Text Body with direct-formatting.