melmothx / text-amuse

Text::Amuse parser
http://www.amusewiki.org
5 stars 2 forks source link

Multi-line heading titles extension #38

Open link2xt opened 6 years ago

link2xt commented 6 years ago

Tests check that lines immediately after headings are merged into the title: https://github.com/melmothx/text-amuse/blob/92c078bd13bbf4e3c06aff834416f60e3328038b/t/testfiles/packing.muse#L4

Emacs Muse produces different output in this case:

<h2>this title</h2>

<p class="first">will merge</p>

<h3>this title</h3>

<p class="first">will merge</p>

<h4>this title</h4>

<p class="first">will merge</p>

<h5>this title</h5>

<p>will merge</p>

<h5>this title</h5>

<p>will merge</p>

I stumbled upon this difference since I just added <br> tags to round-trip test in pandoc and have to deal with line breaks and soft breaks in headers. One solution is to filter them out, another solution is to implement this extension.

This extension makes sense, as it unifies parsing for paragraphs and headers. If you confirm it is not a bug and you are going to leave it this way in Text::Amuse, I will implement it in pandoc. It should probably also be documented in https://amusewiki.org/library/manual

There are Emacs Muse files that will break, quick GitHub search finds examples like this: https://github.com/happypeter/edocs/blob/d5f2675d387f0cf16f1074d05609d106628acf39/muse/resources.muse#L14

But these users will just keep using Emacs Muse anyway or expect to add some empty lines if they switch to Text::Amuse or pandoc (or hugo+pandoc or whatever), not an issue really.

melmothx commented 6 years ago

I confirm this is the intended behavior and I can think about many reasons to keep it this way. I think it's more likely a Emacs Muse bug. Who knows at this point?

link2xt commented 6 years ago

I don't think it is a bug, because both Outline mode and Org mode (which, like Muse, is influenced by Outline mode) don't merge lines into headings.

Ok, I will probably implement it for Text::Amuse variant in pandoc and keep Emacs Muse behaviour for Emacs mode.