all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* apply attr_html to a whole figure?
@ 2016-09-22  1:11 Matt Price
  2016-09-22  7:09 ` Christian Moe
  2016-09-22  9:50 ` Eric Abrahamsen
  0 siblings, 2 replies; 5+ messages in thread
From: Matt Price @ 2016-09-22  1:11 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

When exporting images with captions, ox-html currently creates a strucuture
like this:


<div class="figure">
<p><img src="./images/hlevel.png" alt="hlevel.png">
</p>
<p><span class="figure-number">Figure 1:</span> "test"</p>
</div>

(I've tried setting org-html-html5-fancy" to t, but for whatever reason
this doesn't result in the useo f the <figure> tag. I tried with emacs -q
with no luck).

I would like to be able to give an additional class to the enclosing <div
class="figure">.  Any idea how i might be able to do that? As far as I can
see, org-html--wrap-image does not have access to the org link element and
so can't query for attributes.

I really appreciate any ideas! Thanks,
Matt

[-- Attachment #2: Type: text/html, Size: 1012 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: apply attr_html to a whole figure?
  2016-09-22  1:11 apply attr_html to a whole figure? Matt Price
@ 2016-09-22  7:09 ` Christian Moe
  2016-09-22 20:46   ` Matt Price
  2016-09-22  9:50 ` Eric Abrahamsen
  1 sibling, 1 reply; 5+ messages in thread
From: Christian Moe @ 2016-09-22  7:09 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode


I don't think Org syntax provides any way to do this at present, but
ignore the rest of this message if anyone knows better.

Possible workarounds:

1. Wrap your figure in a #+BEGIN_ADDITIONALCLASS...#+END_ADDITIONALCLASS
block, to wrap the div.figure in a div.additionalclass. Not exactly what
you wanted, and a pain in the neck if you have many such figures, but
gives you enough to work with in CSS.

2. Add javascript to move the extra class attribute from the img to
the containing div. 

3. Write an export filter.

Yours,
Christian


Matt Price writes:

> When exporting images with captions, ox-html currently creates a strucuture like this:
>
>
> &lt;div class=&quot;figure&quot;&gt;
> &lt;p&gt;&lt;img src=&quot;./images/hlevel.png&quot; alt=&quot;hlevel.png&quot;&gt;
> &lt;/p&gt;
> &lt;p&gt;&lt;span class=&quot;figure-number&quot;&gt;Figure 1:&lt;/span&gt; &quot;test&quot;&lt;/p&gt;
> &lt;/div&gt;
>
> (I&#39;ve tried setting org-html-html5-fancy&quot; to t, but for whatever reason this doesn&#39;t result in the useo f the &lt;figure&gt; tag. I tried with emacs -q with no luck).
>
> I would like to be able to give an additional class to the enclosing &lt;div class=&quot;figure&quot;&gt;. Any idea how i might be able to do that? As far as I can see, org-html--wrap-image does not have access to the org link element and so can&#39;t query for attributes. 
>
> I really appreciate any ideas! Thanks,
> Matt
>
>  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: apply attr_html to a whole figure?
  2016-09-22  1:11 apply attr_html to a whole figure? Matt Price
  2016-09-22  7:09 ` Christian Moe
@ 2016-09-22  9:50 ` Eric Abrahamsen
  2016-09-22 20:49   ` Matt Price
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2016-09-22  9:50 UTC (permalink / raw)
  To: emacs-orgmode

Matt Price <moptop99@gmail.com> writes:

> When exporting images with captions, ox-html currently creates a
> strucuture like this:
>
> <div class="figure">
> <p><img src="./images/hlevel.png" alt="hlevel.png">
> </p>
> <p><span class="figure-number">Figure 1:</span> "test"</p>
> </div>
>
> (I've tried setting org-html-html5-fancy" to t, but for whatever
> reason this doesn't result in the useo f the <figure> tag. I tried
> with emacs -q with no luck).

It looks like `org-html--wrap-image' should be responsible for using a
proper "figure" element, maybe try edebugging it and see what it's
doing? This may be obvious, but the document has to be exported as html5
before html5-fancy has any effect!

Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: apply attr_html to a whole figure?
  2016-09-22  7:09 ` Christian Moe
@ 2016-09-22 20:46   ` Matt Price
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Price @ 2016-09-22 20:46 UTC (permalink / raw)
  To: Christian Moe; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

On Thu, Sep 22, 2016 at 3:09 AM, Christian Moe <mail@christianmoe.com>
wrote:

>
> I don't think Org syntax provides any way to do this at present, but
> ignore the rest of this message if anyone knows better.
>
> Possible workarounds:
>
> 1. Wrap your figure in a #+BEGIN_ADDITIONALCLASS...#+END_ADDITIONALCLASS
> block, to wrap the div.figure in a div.additionalclass. Not exactly what
> you wanted, and a pain in the neck if you have many such figures, but
> gives you enough to work with in CSS.
>

This does it for me, and actually makes it easier to delimit css classes
appropriately, so it's great, thank you.

>
> 2. Add javascript to move the extra class attribute from the img to
> the containing div.
>

Yeah I thought about it but haven't gotten around to it.

>
> 3. Write an export filter.
>

THis feels like what I should learn to do, but, well, now that you've given
me a workaround it's hard to get up the motivation to learn...

Thank you!!

[-- Attachment #2: Type: text/html, Size: 1668 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: apply attr_html to a whole figure?
  2016-09-22  9:50 ` Eric Abrahamsen
@ 2016-09-22 20:49   ` Matt Price
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Price @ 2016-09-22 20:49 UTC (permalink / raw)
  Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

On Thu, Sep 22, 2016 at 5:50 AM, Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> Matt Price <moptop99@gmail.com> writes:
>
> > When exporting images with captions, ox-html currently creates a
> > strucuture like this:
> >
> > <div class="figure">
> > <p><img src="./images/hlevel.png" alt="hlevel.png">
> > </p>
> > <p><span class="figure-number">Figure 1:</span> "test"</p>
> > </div>
> >
> > (I've tried setting org-html-html5-fancy" to t, but for whatever
> > reason this doesn't result in the useo f the <figure> tag. I tried
> > with emacs -q with no luck).
>
> It looks like `org-html--wrap-image' should be responsible for using a
> proper "figure" element, maybe try edebugging it and see what it's
> doing? This may be obvious, but the document has to be exported as html5
> before html5-fancy has any effect!
>

It should have been obvious, but it wasn't to me! setting org-html-doctype
to "html5" fixed the problem. Thank you!
Matt

>
> Eric
>
>
>

[-- Attachment #2: Type: text/html, Size: 1810 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-22 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-22  1:11 apply attr_html to a whole figure? Matt Price
2016-09-22  7:09 ` Christian Moe
2016-09-22 20:46   ` Matt Price
2016-09-22  9:50 ` Eric Abrahamsen
2016-09-22 20:49   ` Matt Price

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.