Re: Second level before the first level headline?

David Goodger <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <CABiJP=+7KHG06C3oZ_Goa6o0k4VLBQ=Hqo9kFFFp3Drt=pegFg@mail.gmail.com>
On Tue, May 20, 2014 at 7:40 AM, Peter Funk <[email protected]> wrote:
> Matěj Cepl wrote 17.05.2014 at 13:35:
> ...
>> Is there way how to persuade pandoc (or other rST tools) that what I
>> want to be the level 2 heading (marked by single dashes underlining) is
>> really that, and that level 1 heading is marked by by both underlining
>> and overlining?

No. A document has to provide a consistent set of headers that follow
the structure of that document. The problem with the document in
question is that it's missing a level. You'll have to work around it
(examples below).

> Hmmm.... The internal model of docutils uses a tree to represent the
> hierarchical structure.  So I assume David thought that orphaned
> level-2 sections without a level-1 parent are normally not needed
> at all.

It's not that they're not needed (such cases are often seen, as in
books like this), it's that such a structure makes no sense. Documents
normally have hierarchical structure, but books are designed by
people, and people are not regular like data structures. So we end up
with a nonsensical tree-like structure where one of the nodes is
missing. How to deal with it? Either remove the inconsistency, or fake
the missing node.

> I would simply put an artificial Part 0 header into the
> text to solve this issue.  For example this one should work::
>
>   ----------------------------------------
>   PART 0. — PEPATORY NOTE AND INTRODUCTION
>   ----------------------------------------

I agree. That header could then be styled and processed specially.

A quick and dirty hack would be to have an empty title for the Part 0
header, like this:

-----
\
-----
.. The above is a level-1 header to give this document a reasonable structure.

That may be enough to produce a reasonable ePub document.

Another solution (cleaner, IMO) would be to make the preparatory note
and introduction sections the same level as the "parts" (or
vice-versa). In other words, remove the inconsistency. You could
assign a class to those sections and style or process them specially,
if desired.

-- 
David Goodger <http://python.net/~goodger>

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.