emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: mail@christianmoe.com
Cc: "François Pinard" <pinard@iro.umontreal.ca>, emacs-orgmode@gnu.org
Subject: Re: ATTR_HTML for a clickable image, howto?
Date: Tue, 10 Apr 2012 16:53:43 -0700	[thread overview]
Message-ID: <CAJcAo8vF5_oaHMokNQNA-f0y=DKbTMi-e3caDEj_8iZoMUFMCA@mail.gmail.com> (raw)
In-Reply-To: <4F803DDC.20808@christianmoe.com>

Hi Christian,

Thanks for your reply.

I left implicit the question of whether this can solve OP's problem
also, but believe it is potentially related.

However, if I understood CSS well enough to ask the question
precisely, I'd have the answer.  So bear with me.

More below:

On 2012-04-07, Christian Moe <mail@christianmoe.com> wrote:
>> Will CSS solutions described in this thread work if you always export
>> subtrees (not entire .org files) and never include style files?
>
> Yes, CSS styles apply to exported subtrees as well, whether from the
> default stylesheet, linked external stylesheets, or #+STYLE headers.

Hmm, I think I should have specified further.  I mean
org-export-region-as-html.  The raw HTML without any head section,
files, stylesheets, or anything else.

So for example, could the OP and I use styles that are specified with
div style= wrapping the entire output?  Seems a simple addition to the
exporter or even a defadvice, but I don't know if it would work as I
don't know what the CSS would look like well enough to try it.

The critical thing is to avoid all dependency on anything external
like a stylesheet.  The goal is to keep all information in your file
under Org control, including style.

> But this applies to the static html files as exported by Org. If I
> understand your drift, you're thinking about using it in a content
> management system (CMS) like Blogger. A CMS will typically store only
> the content of your document and substitute its own template for the
> HEAD section where style information goes. Then these solutions won't
> work without modifying CSS in your CMS.

Not even with wrapping the entire output in a div?

> You can edit the CSS template of your CMS to take advantage of the
> classes and ids Org applies to its HTML exports.

The idea is to avoid a dependency like that if possible.

> - You can use #+ATTR_HTML to add class, id or style attributes to
> /some/ elements, and my understanding is that the new exporter that is
> in the works will help do this more systematically.

Wondering if you can control this under my additional requirements
using inheritance from higher-level constructs like a div wrapper
around the whole export.

> - You can enclose blocks in custom block classes (<DIV CLASS="foo">)
> with org-special-blocks (#+BEGIN_FOO), or with verbatim HTML.

Yes, this is where I was leading.  But it's no good for my purposes if
you can't use CSS directly in your Org file without any header or
external files.

> Locally applying CSS to elements with the STYLE attribute, the very
> lowest level of the cascade, should be the last resort.

Right.  :)

> - You can simplify repeated use with macros. See the manual, section
> 11.6. Use the @ notation (section 12.5.3) for literal html tags within
> the macros. E.g.:
>
>     #+MACRO: mycolor @<span style="color: black; background-color:
> #f4a460">$1@</span>

I've tried macros for image specification, but ran into a variety of
issues getting it to work well.

>     {{{mycolor(Here I'd like some black text on an orange background.)}}}

For paragraphs and sections and quotes and so on, the #+ blocks would
work better.  Not sure if {{{}}} would nest?  Or be noticeable.  That
seems much better for spans of text, not so much for standalone images
and sections with more than one paragraph, lists, etc.

> - You could probably also use Eric Schulte's contributed
> org-exp-blocks.el, but you'd need to write some code, and it might be
> overkill for this purpose.

I was wondering if this would be useful too.

> Depends on your use case, I guess, but I think it would nearly always
> be a better, simpler, cleaner solution to modify your Blogger CSS.

OK.  But my desire not to depend on the cloud is large enough that I
have to go back to the raw HTML method.

I want this to work no matter who I give the HTML file (singular) to.

Assuming it's possible -- if not I will just keep using raw HTML.

This is not a critical issue, but I thought it could expand the OP's
conversation to include a general solution for everybody if it works.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

  reply	other threads:[~2012-04-11  0:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-01 21:27 ATTR_HTML for a clickable image, howto? François Pinard
2012-04-02  8:14 ` Bastien
2012-04-02 10:34   ` Christian Moe
2012-04-02 15:06     ` Bastien
2012-04-02 21:30       ` Samuel Wales
2012-04-03  5:42         ` Bastien
2012-04-05 23:34           ` Samuel Wales
2012-04-05 15:02   ` François Pinard
2012-04-06  8:52     ` Christian Moe
2012-04-06  9:29       ` Christian Moe
2012-04-06 18:41       ` Samuel Wales
2012-04-06 18:45         ` Samuel Wales
2012-04-07 13:15         ` Christian Moe
2012-04-10 23:53           ` Samuel Wales [this message]
2012-04-11  8:11             ` Christian Moe
2012-05-12  0:43               ` Samuel Wales
2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
2012-05-20  8:02                 ` Nicolas Goaziou
2012-05-20  8:34                   ` Yagnesh Raghava Yakkala
2012-05-20 10:24                     ` Nicolas Goaziou
2012-05-22 23:23                 ` Bastien
2012-07-05 14:40                 ` Bastien
2012-07-05 15:09                   ` Nicolas Goaziou
2012-07-05 15:51                     ` Sebastien Vauban
2012-07-05 20:44                       ` Nicolas Goaziou
2012-08-05  9:19                     ` Bastien
2012-05-20  0:39           ` ATTR_HTML for a clickable image, howto? François Pinard
2012-04-06  9:02     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJcAo8vF5_oaHMokNQNA-f0y=DKbTMi-e3caDEj_8iZoMUFMCA@mail.gmail.com' \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.com \
    --cc=pinard@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).