fletcher / MultiMarkdown-4

This project is now deprecated. Please use MultiMarkdown-6 instead!
https://github.com/fletcher/MultiMarkdown-5
Other
306 stars 59 forks source link

Rogue Bibliography on ODF output #90

Closed iandol closed 9 years ago

iandol commented 9 years ago

When I output (document written in Scrivener) to flat ODF, I notice in the Navigator there is a rogue bibliography section: screen shot 2014-11-23 at 10 33 53 I can't find any heading in the document that matches this rogue entry. I do see in the raw fodt file the following:

<office:master-styles>
  <style:master-page style:name="Endnote" >
    <style:header><text:h text:outline-level="2">Bibliography</text:h></style:header></style:master-page>
  <style:master-page style:name="Footnote" style:page-layout-name="pm2"/>
 </office:master-styles>

This is somehow leaking into the document structure, I don't understand odt format but I imagine this is a bug in Libreoffice. I don't understand what the master-style section does, but can I control removing it when MMD generates its output (simple deletion causes a loading error)? I have lots of other little things I'd like to change (which I currently do using regexes), and the MMD manual suggests I can customise ODT output but I don't know where to start.

fletcher commented 9 years ago

I'm not sure why it puts this at the top instead of the bottom in the navigator. But in my tests, the document itself is correct.

As for customizing ODT, you have to do this inside the MMD source.

iandol commented 9 years ago

The rogue Bibliography is also present in your MMD user guide: http://fletcher.github.io/MultiMarkdown-4/MMD_Users_Guide.fodt

Your document has no "real" Bibliography section at all (neither does mine). Can you think of any problems if I just delete this master-styles section? Thanks for all your hard work on an excellent tool BTW!

iandol commented 9 years ago

@fletcher — the rogue header is still being added to all FODT output. The problem is there is a text:h element (line 255 of you doc fodt) that is being read. Here is you MMD documentation with the rogue heading: screen shot 2015-09-08 at 15 10 09

Is this a bug with LibreOffice?

fletcher commented 9 years ago

This seems to be a problem with OpenOffice/LibreOffice, but I haven't looked into it since my original response.

iandol commented 9 years ago

Here is the part of the MMD code where the header element is inserted into the styles section:

https://github.com/fletcher/MultiMarkdown-4/blob/master/odf.c#L1231

Note, I remove the <text:h text:outline-level="2">Bibliography</text:h> manually from the FODT and this "fixes" the rogue header, but I don't understand what it is doing in styling XML in the first place. I'll post a bug on the LibreOffice bugzilla, perhaps they know why there is a text:h element in this styling code?

iandol commented 9 years ago

In a new FODT created by LibreOffice Writer, this is the master-styles section, it doesn't contain any text headers:

<office:master-styles>
  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
 </office:master-styles>
iandol commented 9 years ago

OK, so you're creating an endnote page style which has a "heading-2" in the page header with the text "Bibliography", I can recreate this denovo using V5.02 of LibreOffice, and the same thing happens in Navigator and PDF output, so I've created a LibreOffice bug for this behaviour: https://bugs.documentfoundation.org/show_bug.cgi?id=94345

The workaround is either to ignore it and all documents produced by MMD->ODT have this, or remove the header until this is fixed.