marsmining / ox-twbs

Export org-mode docs as HTML compatible with Twitter Bootstrap.
302 stars 35 forks source link

derived backend #16

Open pank opened 8 years ago

pank commented 8 years ago

Hi,

The way your backend is written is rather duplicative. Perhaps, rather than defining a new backend you could define a derived backend, see the docstring of org-export-define-derived-backend, or ox-md, ox-beamer and ox-koma-letter for examples. You'd automatically inherit all keywords and the like from ox-html. Further, you would only need to provide new functions for the elements where you are actually unhappy with their current output (e.g. org-twbs-subscript is rather pointless). Also, you would not need to redefine every defcustom which is sort of pity (presumably if org-html-link-org-files-as-html is non-nil than org-html-twbs-org-files-as-html is non-nil). From a user perspective it's also nicer since my html filters will automatically apply.

If you'd follow sort of the "proper" way of creating a backend it would be cool to include it in contrib/lisp or lisp, as people occasionally ask for bootstrap'ed output. Paperwork is required for lisp.

edit: oh, incidentally, this is also a/the solution to #13.

Cheers, Rasmus

marsmining commented 8 years ago

Thanks for the thoughtful feedback!

When I began working on this, I was unaware of the proper way to create a backend, and by the time I ran across those docs, the horse was out of the barn! I've been surprised by the amount of changes to the org-mode API underneath me, so it is seeming to be liability.

In short I think it's something I, or another adventurous soul should embark on.

marsmining commented 8 years ago

For reference: http://orgmode.org/worg/dev/org-export-reference.html

pank commented 8 years ago

Hi,

Brandon van Beekum notifications@github.com writes:

When I began working on this, I was unaware of the proper way to create a backend, and by the time I ran across those docs, the horse was out of the barn!

OK.

I've been surprised by the amount of changes to the org-mode API underneath me, so it is seeming to be liability.

ox was first officially part of Org-8 (it lived a while in contrib before), so it's still fairly young. Things like the element definitions remain fairly stable over time. Likewise, the org-element API should remain fairly stable. But yes, Org-8.2 was big (1.5 years of work).

In short I think it's something I, or another adventurous soul should embark on.

Another approach, which I simply don’t know how feasible is, would be to have it be a theme add-on (i.e. I simply link to your CSS and JS). If features are missing from making this possible from upstream ‘ox-html.el‘, it’s likely they’d also be useful for other purposes. Note, I haven’t studied neither output nor the code of ox-twbs, so it might not be feasible at all.

For reference: http://orgmode.org/worg/dev/org-export-reference.html

In addition there's documentation in the comments throughout ox.el.

Thanks, Rasmus

With monopolies the cake is a lie!