hplgit / doconce

Lightweight markup language - document once, include anywhere
http://hplgit.github.io/doconce/doc/web/index.html
Other
311 stars 60 forks source link

Add possibility to place caption below the figure in html #61

Closed ischurov closed 8 years ago

ischurov commented 8 years ago

Currently, there are two ways to place caption for figures in html: either caption is above the figure (default behaviour) or it is on the right side of the figure (with sidecap=True). It seems to be useful to add an option to place caption below the figure as it is standard way to do it in many typographic traditions (e.g. Russian).

How can we done this properly? I see at least two possible approaches:

  1. Add another option like bottomcap. Then if two options sidecap and bottomcap are True, one of them is ignored. (Which one?)
  2. Replace sidecap with another option caption_placement that can take one of the following values: top, bottom, side (or even left, right instead of just side)?
hplgit commented 8 years ago

The sidecap command is a bit special: it applies to individual figures and is a part of the FIGURE command.

What you want, is to let all html figure caption be placed at the bottom of figures rather than at the top. I introduced --html_figure_caption=bottom is an option for this. The default is top.

ischurov commented 8 years ago

Thanks, sounds good for my purposes. I'm still not sure, do we need the ability to control the behaviour of caption on per-figure basis (like sidecap do), overriding the defaults? It seems to be useful in some circumstances, but not critical. It seems the current issue can be closed as fixed now.

ischurov commented 8 years ago

There is a minor regression: an anchor for references is placed near the caption, so when captions are above the figure and I click on the reference link, I see the referenced figure at the top of my screen, but when captions are below the figure, clicking on the link scrolls browser window in such a way that figure (and even caption) is above the top border of the window and therefore invisible. I need to manually scroll down then to see my figure.

Unfortunately, I didn't manage how to solve it by myself because I can't find a place where anchors to images are placed.

hplgit commented 8 years ago

Thanks for pointing this out! The anchor is the label in the caption, so when the caption is at the bottom, the anchor is placed at the bottom of the figure instead of at the top. I have fixed this now such that the anchor is always at the top of the figure, before the optional horizontal rule (a bit tricky fix, but it seems to work).

ischurov commented 8 years ago

Great, thanks, works fine!