wf49670 / ppgen

Post-processing generator for DP
6 stars 4 forks source link

If .de statement is the last line of a source file ppgen crashes #84

Closed davem2 closed 9 years ago

davem2 commented 9 years ago

I noticed this minor issue where it appears that if a .de statement is the final line of a source file a list index out of range exception occurs. The example below causes ppgen to crash:

// Ancient chinese glyphs
.de .glyph { display: inline-block; height: 100%; vertical-align: middle; }
.sr h ~<il (.+?)>~<img class='glyph' src='images/\1' />~
.sr t ~<il (.+?)>~[Chinese: **]~

If a space if added after the .de statement, or some statements that are not stripped prior to .de processing are added to the bottom then the file builds ok.

wf49670 commented 9 years ago

On 3/1/2015 5:11 PM, davem2 wrote:

I noticed this minor issue where it appears that if a .de statement is the final line of a source file a list index out of range exception occurs. The example below causes ppgen to crash:

// Ancient chinese glyphs .de .glyph { display: inline-block; height: 100%; vertical-align: middle; } .sr h ~<il (.+?)>~~ .sr t ~<il (.+?)>~[Chinese: **]~

If a space if added after the .de statement, or some statements that are not stripped prior to .de processing are added to the bottom then the file builds ok.

Thanks. I'll take care of that.

By the way, thanks for the examples and other updates in the manual. Regarding this update, does the height: 100% really work well, especially in epub/mobi? I would have expected to see a height in "em" units so it would scale properly with the surrounding text, but as I'm not sure what book and image you're dealing with I can't see it to be sure.

Regards, Walt

wf49670 commented 9 years ago

On 3/1/2015 5:11 PM, davem2 wrote:

I noticed this minor issue where it appears that if a .de statement is the final line of a source file a list index out of range exception occurs. The example below causes ppgen to crash:

// Ancient chinese glyphs .de .glyph { display: inline-block; height: 100%; vertical-align: middle; } .sr h ~<il (.+?)>~~ .sr t ~<il (.+?)>~[Chinese: **]~

If a space if added after the .de statement, or some statements that are not stripped prior to .de processing are added to the bottom then the file builds ok.

Error is a missing line "continue" after line 4387 of 4.37i (current development version). I'll roll that in later tonight.

Thanks, Walt

wf49670 commented 9 years ago

On 3/1/2015 5:11 PM, davem2 wrote:

I noticed this minor issue where it appears that if a .de statement is the final line of a source file a list index out of range exception occurs. The example below causes ppgen to crash:

// Ancient chinese glyphs .de .glyph { display: inline-block; height: 100%; vertical-align: middle; } .sr h ~<il (.+?)>~~ .sr t ~<il (.+?)>~[Chinese: **]~

If a space if added after the .de statement, or some statements that are not stripped prior to .de processing are added to the bottom then the file builds ok.

Fixed in development 3.47j

davem2 commented 9 years ago

By the way, thanks for the examples and other updates in the manual. Regarding this update, does the height: 100% really work well, especially in epub/mobi? I would have expected to see a height in "em" units so it would scale properly with the surrounding text, but as I'm not sure what book and image you're dealing with I can't see it to be sure.

That code snippet is used to deal with this page: http://www.pgdp.net/projects/projectID4ba135692f8ea/009.jpg

I haven't tested how it works on ePub/mobi yet, but it works great in HTML (Firefox at least). The CSS is just a copy and paste from somewhere, I'm not 100% sure height needs to be specified. Once I test on other browsers/readers I will update the wiki if needed. I vaguely remember Roger reporting percent measurements being more widely supported than em when dealing with epub/mobi. But, for this specific case it would make sense to scale the images with the surrounding text

Thanks for adding the .sr command, it's really useful. I haven't tried it until just recently, it's been great for special cases that would be difficult (or impossible) to do with stock ppgen.

wf49670 commented 9 years ago

On 3/1/2015 8:08 PM, davem2 wrote:

By the way, thanks for the examples and other updates in the
manual. Regarding this update, does the height: 100% really work
well, especially in epub/mobi? I would have expected to see a
height in "em" units so it would scale properly with the
surrounding text, but as I'm not sure what book and image you're
dealing with I can't see it to be sure.

That code snippet is used to deal with this page: http://www.pgdp.net/projects/projectID4ba135692f8ea/009.jpg

I haven't tested how it works on ePub/mobi yet, but it works great in HTML (Firefox at least). The CSS is just a copy and paste from somewhere, I'm not 100% sure height needs to be specified. Once I test on other browsers/readers I will update the wiki if needed. I vaguely remember Roger reporting percent measurements being more widely supported than em when dealing with epub/mobi. But, for this specific case it would make sense to scale the images with the surrounding text

Thanks for adding the .sr command, it's really useful. I haven't tried it until just recently, it's been great for special cases that would be difficult (or impossible) to do with stock ppgen.

Glad you're finding .sr useful. It looks like your glyph usage may be a simpler implementation of inline images than kd came up with for his pottery books.

Nigel and I and someone (maybe kd) discussed sizing of inline images for odd characters recently, and decided that sizing in em worked better than px, and I'm pretty sure the PPer ended up going with em and was happy. It's in one of the ppgen-related forums within the past few weeks.

From looking at his source file, it was kd, and he ended up using a height of .75em but I don't remember the px height of his images. He went with width: auto and height:.75em

Walt