emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] ox-html HOWTO? exporting #+RESULTS inside div


From: Charles C. Berry
Subject: Re: [O] ox-html HOWTO? exporting #+RESULTS inside div
Date: Fri, 6 Nov 2015 13:01:03 -0800
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

On Fri, 6 Nov 2015, Cook, Malcolm wrote:

Charles, Thanks again for you suggestion.  Alas, using 'header-args
> >:wrap org-results-container' has the unforeseen (by me) side effect
> >of masking my use of `#+ATTR_HTML :class dataTable` on selected
> >exported tables (which I use to allow for search/sortable/scrollable
> >tables).  Now, the ':class dataTable' attribute is placed on the new
> ><div> instead of the <table> with undesired outcome.
>
> > Do you have any thoughts on how to accomplish both my goals (apply
> > :class table to selected results, and making ALL results be
> > addressable using javascript.  FYI - My application is to hide all
> > source blocks on html open.  Clicking on a source block caption
> > shows the source.  This provides an HTML view that hides the source
> > until desired.  My recipients of such analysis write-ups really like
> > this.
>
> [snip]
>
> > # #+PROPERTY: header-args :wrap org-results-container
> > #
>
> This creates a special block and attributes on the results will apply
> to it - not its contents.
>
> What you want can be obtained by creating a different special block
> and then applying a filter. So, wrap like this
>
> #+PROPERTY: header-args :wrap org-results-container-to-filter
>
> and add a filter to `org-export-filter-special-block-functions' that
> strips the 'to-filter' and adds the `dataTable' where it is needed.

Hi Charles - ok - you've got me looking at ox aspects I've not yet explored.... 
good!

If I understand your suggestion, the filter you propose would need to somehow "know" which tables I desire to be adorned with `class :dataTable`.


Make a really dumb filter that just wraps a special block with something like

`special-block>>>' ... `<<<special-block'

and export a document that has :wrap as above. Take a look at what you got. With luck you can fashion args for replace-regex-in-string and call it once or twice to convert whatever was between those markers to what you want. Then turn those calls into a filter.


How do you reckon I might declare that?

Upon reflection, I wonder if following source block header syntax might rather be considered "in the spirit of things" and worthy of implementation:

        #+begin_src R :exports value table :prefix '#+attr_html :class 
dataTable'

which would be interpreted by ob-sbe (somehow) to emit and
        #+attr_html :class dataTable
Immediately prior to the #+results, all of which might be further :wrapped.

The trouble is it will not be wrapped in the right place, and you are back to where you were when you started this thread.


Or am I putting the cart before the horse?


I'd say so.


Reminder (in part to self): my goal is two-fold (a) declare to the ox-html exporter a :class (i.e. dataTable) to adorn selected exported results tables

Of course there are other ways to solve this. You could create a derived backend and define a new kind of export block for it and a suitable transcoder. But that might seems like overkill to me.

(b) have a means of addressing the exported html results of a code block allowing to conditionally hide or expose it (i.e. toggle exposure when user click on the export source code. This is what "> #+PROPERTY: header-args :wrap org-results-container" provided for me, except that the introduction of the new <div> was blocking my means of doing (a)

Right. So you use replace-regex-in-string to fix that.

HTH,

Chuck




reply via email to

[Prev in Thread] Current Thread [Next in Thread]