wf49670 / ppgen

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

Add cp parameter to .il statement (caption placement) #23

Closed davem2 closed 10 years ago

davem2 commented 10 years ago

Hi Roger,

In a recent project I wanted the ability to place an illustrations caption above it rather than below. This change allows that by adding a new flag to the .il statement, cp (caption placement or position). There are two possible values for this parameter (t)op and (b)ottom. If the parameter is not supplied it defaults to bottom (current behavior).

In the future, I was thinking about adding an additional possible value (s)plit that would allow for captions to be placed above and below an illustration like

                   Fig 1.
+----------------------------------------+
|                                        |
|                                        |
|                                        |
|                                        |
+----------------------------------------+
          This is an example of a
               split caption.
ghost commented 10 years ago

This seems to go against the philosophy of ppgen, which is presentational and linear. If the caption were needed above the illustration, I would expect:

.ca This is above the illustration .il This is the illustration.

The reason that the caption is below the illustration is because the .ca is below the .il line normally. In particular, the illustration has no knowledge of the caption (though the caption is aware of the width of the illustration).

I am all for captions above, but I'm not convinced a caption placement parameter is what we want. Walt, Nigel, any thoughts? David, could it be done using the order of the .ca and the .il and even ".ca -> .il -> .ca" for your split caption?

davem2 commented 10 years ago

I agree, that would be better representation in ppgen source (though the implementation may be a different story)

ghost commented 10 years ago

I don't think it would be too difficult to code. If ppgen runs into a .ca when scanning, it would move it to below the illustration in the preprocessing step and flag it as really being above. Then when it is building the illustration stanza in HTML it would put the caption before the <img line. In text it would be handled normally. This feels like less than 20 lines of code, tops. I have several higher priority coding projects to attend to but I think I could get to this before too long if you can't. (Question: since I am not going to merge this pull request, do I click on "Close and comment" at this time?)

davem2 commented 10 years ago

Yes