Some of it is going to require CSS support anyway to do the layout.<div>If there's just a div with a CSS class, frontends can handle that as they require, and the indenting support shouldn't cause an issue.</div><div>
<br></div><div>BTW, with the Proverbs 28 issue, my guess is the opening <lg> is a few chapters earlier.</div><div><br></div><div>In the <l> handling code, I have these lines:</div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if not self.in_lg:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>dprint(WARNING, "l outside lg??? (or block doesn't contain lg)")</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>self.start_lg(None)</div>
<div><br></div><div>In other words, we always have an implicit <lg> if there wasn't one in the current chapter and we got to an <l>.</div><div>This seems to work very well. </div></div><div><br></div><div>
Looking forward to seeing poetry support in PocketSword...</div><div><br></div><div><div>God Bless,<br>Ben<br>-------------------------------------------------------------<br>
        <div>
        <div>For I have no pleasure in the death of anyone, <br>declares the Lord <span style="font-variant:small-caps">God</span>; so turn, and live.”<br>Ezekiel 18:32 (ESV)</div>
        </div>
        
<br></div>
<br><br><div class="gmail_quote">On Mon, Feb 4, 2013 at 12:25 AM, Nic Carter <span dir="ltr"><<a href="mailto:niccarter@mac.com" target="_blank">niccarter@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div>Thanks heaps for this, Ben :)<div><br></div><div>Appears I had a little bug in the previous patch I emailed around. When closing the div on line 379 of osishtmlhref.cpp I had added a "<br />" which shouldn't be there!</div>
<div><br></div><div>I like how you have BPBible displaying this stuff, and so it's inspired me to fix up some of the formatting in PS. :) I've even rewritten how I do highlighting to do it "properly" & not break the HTML badly so that this will work :P</div>
<div>I've had to have different css stuff for PS based on whether it's on a small iPhone screen or a larger iPad screen & after hacking this myself, I saw your 500px versions & incorporated them as well :)</div>
<div><br></div><div>All this to say, perhaps in the SWORD API we should have apps be able to flag whether they want poetry indenting on or off, cause it is quite possible that it will break formatting that the different front-ends do, and so if we have it off by default, front-ends will have to accommodate it and then manually switch it on, thereby not breaking how things look/work...? ;)</div>
<div>[or, at least, I've spent much more time fixing PS to work with the changes I made to SWORD than I did implementing the poetry indentation in SWORD!]</div><div><br></div><div>Thanks heaps, ybic</div><div><span class="HOEnZb"><font color="#888888"><span style="white-space:pre-wrap">        </span>nic... :)</font></span><div>
<div class="h5"><br>
<br><div><div>On 02/02/2013, at 10:14 PM, Ben Morgan <<a href="mailto:benpmorgan@gmail.com" target="_blank">benpmorgan@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div>Hi Nic,</div><div><br></div><div>Structural content in verse 0 is another good example why you shouldn't turn introductions off - I think they should always be on, just the headings inside them (when non-canonical) should be able to be turned off.</div>
<div><br></div>As for floating the whitespace around, this is a post-process and mostly done using regular expressions.<div>See SmartBody here: <a href="https://code.google.com/p/bpbible/source/browse/trunk/backend/verse_template.py#49" target="_blank">https://code.google.com/p/bpbible/source/browse/trunk/backend/verse_template.py#49</a></div>
<div><br></div><div>This allows the verse number to be put in at a logical point in the whitespace flow (e.g. If a paragraph starts at the start of a verse, you want the verse number to be inside the paragraph).</div><div>
<br></div><div>As to the floating the verse number in poetry it uses this CSS to put it in the left margin of the <lg>:</div><div><a href="https://code.google.com/p/bpbible/source/browse/trunk/css/bpbible_chapter_view.css" target="_blank">https://code.google.com/p/bpbible/source/browse/trunk/css/bpbible_chapter_view.css</a></div>
<div><div><div>.chapterview blockquote.lg > a.versenumber, </div><div>.chapterview blockquote.lg > span.had_highlight > a.versenumber</div><div>{</div><div><span style="white-space:pre-wrap">        </span>position: relative;</div>
<div><span style="white-space:pre-wrap">        </span>float: left;</div><div><span style="white-space:pre-wrap">        </span>left: -4em;</div><div><span style="white-space:pre-wrap">        </span>width: 3em;</div>
<div><span style="white-space:pre-wrap">        </span>text-align: center;</div><div><span style="white-space:pre-wrap">        </span>line-height: inherit;</div><div>}</div><div><br></div><div>.chapterview blockquote.lg a.chapternumber</div>
<div>{</div><div><span style="white-space:pre-wrap">        </span>width: 1.5em;</div><div><span style="white-space:pre-wrap">        </span>text-align: center;</div><div><span style="white-space:pre-wrap">        </span>-moz-margin-start: -2em;</div>
<div><span style="white-space:pre-wrap">        </span>line-height: 100%;</div><div><span style="white-space:pre-wrap">        </span>font-size: 150%;</div><div>}</div><div><br></div></div><div>Disclaimer on my CSS: </div>
<div>I put in what made it work - no guarantees that it is nice/efficient. It does appear to be mostly functional</div><div>It's specifically mozilla oriented, and may not work elsewhere.</div><div><br></div><div>That said, it can work elsewhere - I've got the poetry layout with verse numbers etc. working on my Kindle. I haven't checked in the code yet which generates the epub to be transformed for Kindle, but some of the CSS changes I made for that make it less mozilla oriented.</div>
<div><br clear="all"><div>God Bless,<br>Ben<br>-------------------------------------------------------------<br>
        <div>
        <div>For I have no pleasure in the death of anyone, <br>declares the Lord <span style="font-variant:small-caps">God</span>; so turn, and live.”<br>Ezekiel 18:32 (ESV)</div>
        </div>
        
<br></div>
<br><br><div class="gmail_quote">On Sat, Feb 2, 2013 at 4:49 PM, Nic Carter <span dir="ltr"><<a href="mailto:niccarter@mac.com" target="_blank">niccarter@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div>Thanks heaps for this :)<div>I'm getting there, but have encountered a few interesting bits. I'm using the ESV and something I just realised was that Psalm 1 only had a closing <lg> tag at the end of verse 6 & no opening tag:</div>
<div> <lg eID="w106"/> </div><div>I couldn't find the opening one anywhere in the chapter.</div><div><br></div><div>Until I looked at Psalm 1:0</div><div>& then I found it!</div><div><br></div><div>
Anyway, I have it mostly working (besides for cases like the above, where you _need_ to have the Introductions switched on for the formatting to work correctly).</div><div><br></div><div>However, the tricky thing for this to then work with PS is the verse numbers, where you talk about doing some "floating block whitespace" to make it "work more nicely". I'm gonna try to look at what BPBible does in regards to that, cause I'm a novice when it comes to HTML now-a-days...</div>
<div><br></div><div><br></div><div>Thanks, ybic</div><div><span style="white-space:pre-wrap">        </span>nic... :)<br>
<br><div><div>On 02/02/2013, at 12:02 AM, Ben Morgan <<a href="mailto:benpmorgan@gmail.com" target="_blank">benpmorgan@gmail.com</a>> wrote:</div><br><blockquote type="cite">I've found vertical whitespace can be problematic, and it's often around verse boundaries.<div>
<br></div><div>osis2mod often seems to put some of the whitespace in the previous verse/chapter, which I think I reported a long time ago and should be fixed. I remember we had trouble finding the right combination of when to start a verse. I have a vague feeling I had suggested some fixes which weren't ever put in - but I can't be sure, and it's possible there might have been some which caused other issues.</div>
<div><br></div><div>BPBible does some things like floating block whitespace before verse numbers etc. to make this work more nicely.</div><div><br></div><div>As for the two-level poetry layout (or 3 level - e.g. ESV 1 Tim 3:16), BPBible has done this for ages (e.g. try opening ESV in psalms). It's not particularly straightforward to implement well though. A brief overview of how it is done:</div>
<div><br></div><div>The start tag <l> gets handled something like so:</div><div><div><span style="white-space:pre-wrap">                </span>mapping = {</div><div><span style="white-space:pre-wrap">                        </span># usual poetry indent in ESV</div>
<div><span style="white-space:pre-wrap">                        </span>"x-indent": 2,</div><div><br></div><div><span style="white-space:pre-wrap">                        </span># extra indent - 1 Tim 3:16 (ESV) for example</div>
<div><span style="white-space:pre-wrap">                        </span>"x-indent-2": 4,</div><div><br></div><div><span style="white-space:pre-wrap">                        </span># declares lines - Declares the Lord, Says the Lord, etc.</div>
<div><span style="white-space:pre-wrap">                        </span>"x-declares": 6,</div><div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                        </span># doxology - Amen and Amen - Psalms 41:13, 72:19, 89:52 in ESV </div>
<div><span style="white-space:pre-wrap">                        </span>"x-psalm-doxology": 6,</div><div><br></div><div><span style="white-space:pre-wrap">                        </span># usual poetry indent in WEB</div>
<div><span style="white-space:pre-wrap">                        </span>"x-secondary": 2,</div><div><span style="white-space:pre-wrap">                </span>}</div><div><br></div><div><span style="white-space:pre-wrap">                </span>level = xmltag.getAttribute("level")</div>
<div><span style="white-space:pre-wrap">                </span>if level:</div><div><span style="white-space:pre-wrap">                        </span># the level defaults to 1 - i.e. no indent</div><div><span style="white-space:pre-wrap">                        </span>indent = 2 * (int(level) - 1)</div>
<div><span style="white-space:pre-wrap">                </span>else:</div><div><span style="white-space:pre-wrap">                        </span>indent = mapping.get(xmltag.getAttribute("type"), 0)</div><div><br>
</div></div><div><div><span style="white-space:pre-wrap">                </span>#if indent:</div><div><span style="white-space:pre-wrap">                </span>if self.in_indent:</div><div><span style="white-space:pre-wrap">                        </span>dprint(WARNING, "Nested indented l's", self.u.key.getText())</div>
<div><br></div><div><span style="white-space:pre-wrap">                </span>self.in_indent = True</div><div><span style="white-space:pre-wrap">                </span>if not self.in_copy_verses_mode:</div><div><span style="white-space:pre-wrap">                        </span>self.buf += '<div class="indentedline width-%d" source="l">' % indent</div>
<div><span style="white-space:pre-wrap">                </span>self.blocklevel_start()</div></div><div><br></div><div>and end tag like so:</div><div><div><span style="white-space:pre-wrap">        </span>def end_l(self, xmltag):</div>
<div><span style="white-space:pre-wrap">                </span>if self.in_indent:</div><div><span style="white-space:pre-wrap">                        </span>self.blocklevel_end()<span style="white-space:pre-wrap">                        </span></div>
<div><span style="white-space:pre-wrap">                        </span>self.buf += "<br>" if self.in_copy_verses_mode else "</div>"</div></div><div><br></div><div><lg> elements are also handled, turning them into blockquotes.</div>
<div><br></div><div>This is matched up with CSS like so (note, there's a lot more in it than this to handle floating verse numbers outside of poetry etc):</div><div><div>/* Poetry */</div><div>blockquote.lg</div><div>
{</div><div><span style="white-space:pre-wrap">        </span>margin: 0.5em 0em 0.5em 3em;</div><div>}</div></div><div><br></div><div><div>/* We want our indented lines to behave nicely - wrapped lines should be</div>
<div> * indented further. text-indent undoes the wide margin only for the first</div><div> * line */</div><div>div.indentedline.width-2 {</div><div><span style="white-space:pre-wrap">        </span>-moz-padding-start: 5em;</div>
<div><span style="white-space:pre-wrap">        </span>text-indent: -3em;</div><div>}</div><div>div.indentedline.width-4 {</div><div><span style="white-space:pre-wrap">        </span>-moz-padding-start: 5em;</div>
<div><span style="white-space:pre-wrap">        </span>text-indent: -1em;</div><div>}</div><div>div.indentedline.width-6 {</div><div><span style="white-space:pre-wrap">        </span>-moz-padding-start: 7em;</div>
<div><span style="white-space:pre-wrap">        </span>text-indent: -1em;</div><div>}</div><div><br></div><div>div.indentedline.width-0 {</div><div><span style="white-space:pre-wrap">        </span>-moz-padding-start: 5em;</div>
<div><span style="white-space:pre-wrap">        </span>text-indent: -5em;</div><div>}</div><div><br></div><div><div>God Bless,<br>Ben<br>-------------------------------------------------------------<br>
        <div>
        <div>For I have no pleasure in the death of anyone, <br>declares the Lord <span style="font-variant:small-caps">God</span>; so turn, and live.”<br>Ezekiel 18:32 (ESV)</div>
        </div>
        
<br></div>
<br><br><div class="gmail_quote">On Fri, Feb 1, 2013 at 9:32 PM, Nic Carter <span dir="ltr"><<a href="mailto:niccarter@mac.com" target="_blank">niccarter@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Is this caused by improperly formed modules that have fun with <l> poetry & <lb> ?<br>
[I think I have already emailed through what I do after the filter gives me it's result in order to try to reduce the vertical whitespace!]<br>
<br>
And while I'm on the topic of poetry, in Proverbs you often see couplets (altho are they termed that in the Bible?) where in a printed Bible the 2nd line is indented. Would we be able to do that to some degree? I don't know the OSIS tags that refer to this, but if someone were able to point me in the right direction, I may even be able to hack this together myself? I am looking around line 360 of osishtmlhref.cpp........<br>
<div><br>
On 20/01/2013, at 8:12 AM, DM Smith <<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>> wrote:<br>
<br>
> I've noticed that OSIS modules sometimes render with a lot of vertical whitespace (blank lines).<br>
><br>
> I'd like for this to be sorted as part of the next release. I don't think it'd be too hard. I've been in the osishtmlhref filter to see if I could figure it out, but it is beyond me.<br>
><br>
> So this is a suggestion for others.<br>
><br>
> Using the HTML notion of block and inline elements, I think we can classify OSIS elements as block or inline. Off the top of my head, <div>, <chapter>, <p>, <lb/>, <lg>, <l>, <title>, <table> and <row> are the block elements.<br>
> The key feature of a block element is that block elements that follow each other stack one on top of each other.<br>
> Some block elements allow nesting, such as <div>.<br>
><br>
> In HTML, an empty <div> occupies no vertical space. A nested div does not cause additional vertical space.<br>
><br>
> In HTML, a <p> has semantics as to whether it is preceded or followed by whitespace. A <p> at the beginning of a document is not preceded by a blank line. Nor is a </p> at the end of a document. This is also true after a heading element.<br>
><br>
> I think that the SWORD renderers always cause a <div> to occupy vertical whitespace.<br>
><br>
> The other issue with <div> is that we now have a "pre-verse" div, which is a great way of marking off what stands before a verse, but this <div> really shouldn't have any <div> semantic. It probably would have been better if we used <milestone> instead.<br>
><br>
> I seem to remember that there is a "swollow" flag for whitespace (I think it might be for horizontal whitespace.) I think something like this could be used for vertical whitespace.<br>
><br>
> The other part to this is when a chapter is shown verse-per-line. If because of rendering the pre-verse content the verse already starts on a new line, I don't think more vertical whitespace should be produced.<br>
><br>
><br>
> Together in His Service,<br>
> DM<br>
> _______________________________________________<br>
> sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
> <a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
> Instructions to unsubscribe/change your settings at above page<br>
<br>
<br>
_______________________________________________<br>
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page<br>
</div></blockquote></div><br></div></div>
_______________________________________________<br>sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page</blockquote></div><br></div></div><br>_______________________________________________<br>
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page<br></blockquote></div><br></div></div>
_______________________________________________<br>sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page<br></blockquote></div><br></div>