tallforasmurf / PPQT

A post-processing tool for PGDP written in Python, PyQt4, and Qt
GNU General Public License v3.0
4 stars 2 forks source link

html should allow subhead after chapter head #126

Closed tallforasmurf closed 11 years ago

tallforasmurf commented 11 years ago

Right now html convert requires for a subhead (h3markup) that

  1. it is not the first para in the document or selection being converted
  2. there be two blank lines before
  3. the preceding para did not have 4 blank lines before it (chapter head)

This is wrong on a couple of counts. Test 1 prevents proper html convert of a selection that starts with a subhead. It is only in there to avoid an index error in making test 3, of the preceding para.

But also, test 3 is there because the PG standard for a chapter head is 4 blanks, text, 2 blanks, so the first para of a chapter would look like a subhead if you didn't rule that out.

However some books do have:

CHAPTER TWO preceded by 4 blanks

SUBHEAD preceded and followed by 2 blank

Paragraph 1 of subhead section

So the proper test for a subhead is only that it is preceded AND followed by exactly two blank lines. So the if statement should check:

  1. not the LAST unit in the doc or selection (so valid to test the following unit)
  2. 2 blank lines before
  3. following unit has 2 blank lines before also
tallforasmurf commented 11 years ago

Commit 63be58b

However there is still ambiguity which results from the PGDP formatting rules:

<4 blank lines>
CHAPTER HEAD
<2 blank lines>
A paragraph of text...
<2 blank lines>
A SUBHEAD
<2 blank lines>
Another paragraph

2 blank lines are required after the chapter, and 2 are required before the subhead, which means: a SINGLE paragraph between a CHAPTER and a SUBHEAD will also be seen as a subhead. Two before, two after...

If there are zero or more than one paragraphs between the chapter and the subhead, no problem.