all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Arbitrary colouration of words/sentences etc. in HTML export?
@ 2012-08-21 15:38 Jos'h Fuller
  2012-08-21 16:05 ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Jos'h Fuller @ 2012-08-21 15:38 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi!

Is there any good quick and /simple/ way to drop an arbitrary colour on a sequence of characters that will show up in the exported HTML page?

I have introduced a colleague to org-mode for generating documentation, however they want to use multiple colours to highlight different terms. Adding a CSS style rule for *bold* is OK, but it would be nice to do other colours without rendering the other common styles (/i/, _underscore_, etc.) useless. Something like:

    #+HTML: <span class="greenish">
    Greenword
    #+HTML: </span>

or even this:

    @<span style="color: green"> Greenword @</span>

is far too clumsy. Especially since they're using it partly so they don't have to deal with HTML.

Any better way to do this?

Thanks very much!

_______________________________________________________________________________

Jos'h Fuller, Production Programmer

Arc Productions Ltd.     

p: 416.682.5237          | f: 416.682.5209     | http://www.arcproductions.com 
230 Richmond Street East | Toronto, ON M5A 1P4 |

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

* Re: Arbitrary colouration of words/sentences etc. in HTML export?
  2012-08-21 15:38 Arbitrary colouration of words/sentences etc. in HTML export? Jos'h Fuller
@ 2012-08-21 16:05 ` Eric Schulte
  2012-08-21 16:28   ` Jos'h Fuller
  2012-08-21 17:49   ` Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Schulte @ 2012-08-21 16:05 UTC (permalink / raw)
  To: Jos'h Fuller; +Cc: emacs-orgmode@gnu.org

Jos'h Fuller <Jos'h.Fuller@arcproductions.com> writes:

> Hi!
>
> Is there any good quick and /simple/ way to drop an arbitrary colour on a sequence of characters that will show up in the exported HTML page?
>
> I have introduced a colleague to org-mode for generating
> documentation, however they want to use multiple colours to highlight
> different terms. Adding a CSS style rule for *bold* is OK, but it
> would be nice to do other colours without rendering the other common
> styles (/i/, _underscore_, etc.) useless. Something like:
>
>     #+HTML: <span class="greenish">
>     Greenword
>     #+HTML: </span>
>
> or even this:
>
>     @<span style="color: green"> Greenword @</span>
>
> is far too clumsy. Especially since they're using it partly so they don't have to deal with HTML.
>
> Any better way to do this?
>

Hi Jos'h,

Add the following to your Emacs config,

    ;; -*- emacs-lisp -*-
    (org-add-link-type
     "color"
     (lambda (path)
       (message (concat "color "
                        (progn (add-text-properties
                                0 (length path)
                                (list 'face `((t (:foreground ,path))))
                                path) path))))
     (lambda (path desc format)
       (cond
        ((eq format 'html)
         (format "<span style=\"color:%s;\">%s</span>" path desc))
        ((eq format 'latex)
         (format "{\\color{%s}%s}" path desc)))))

and then you can use [[color:red][in red]] for colored export.

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

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

* Re: Arbitrary colouration of words/sentences etc. in HTML export?
  2012-08-21 16:05 ` Eric Schulte
@ 2012-08-21 16:28   ` Jos'h Fuller
  2012-08-21 17:49   ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Jos'h Fuller @ 2012-08-21 16:28 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode@gnu.org

Perfect! Thanks /very/ much!

_______________________________________________________________________________

Jos'h Fuller, Production Programmer

Arc Productions Ltd.     

p: 416.682.5237          | f: 416.682.5209     | http://www.arcproductions.com 
230 Richmond Street East | Toronto, ON M5A 1P4 |


> -----Original Message-----
> From: Eric Schulte [mailto:eric.schulte@gmx.com]
> Sent: Tuesday, August 21, 2012 12:06 PM
> To: Jos'h Fuller
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [O] Arbitrary colouration of words/sentences etc. in HTML
> export?
> 
> Jos'h Fuller <Jos'h.Fuller@arcproductions.com> writes:
> 
> > Hi!
> >
> > Is there any good quick and /simple/ way to drop an arbitrary colour
> on a sequence of characters that will show up in the exported HTML
> page?
> >
> > I have introduced a colleague to org-mode for generating
> > documentation, however they want to use multiple colours to highlight
> > different terms. Adding a CSS style rule for *bold* is OK, but it
> > would be nice to do other colours without rendering the other common
> > styles (/i/, _underscore_, etc.) useless. Something like:
> >
> >     #+HTML: <span class="greenish">
> >     Greenword
> >     #+HTML: </span>
> >
> > or even this:
> >
> >     @<span style="color: green"> Greenword @</span>
> >
> > is far too clumsy. Especially since they're using it partly so they
> don't have to deal with HTML.
> >
> > Any better way to do this?
> >
> 
> Hi Jos'h,
> 
> Add the following to your Emacs config,
> 
>     ;; -*- emacs-lisp -*-
>     (org-add-link-type
>      "color"
>      (lambda (path)
>        (message (concat "color "
>                         (progn (add-text-properties
>                                 0 (length path)
>                                 (list 'face `((t (:foreground ,path))))
>                                 path) path))))
>      (lambda (path desc format)
>        (cond
>         ((eq format 'html)
>          (format "<span style=\"color:%s;\">%s</span>" path desc))
>         ((eq format 'latex)
>          (format "{\\color{%s}%s}" path desc)))))
> 
> and then you can use [[color:red][in red]] for colored export.
> 
> Best,
> 
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte

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

* Re: Arbitrary colouration of words/sentences etc. in HTML export?
  2012-08-21 16:05 ` Eric Schulte
  2012-08-21 16:28   ` Jos'h Fuller
@ 2012-08-21 17:49   ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien @ 2012-08-21 17:49 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Jos'h Fuller, emacs-orgmode@gnu.org

Eric Schulte <eric.schulte@gmx.com> writes:

> Add the following to your Emacs config,

I added this to the Org FAQ.  Thanks!

-- 
 Bastien

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

end of thread, other threads:[~2012-08-21 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-21 15:38 Arbitrary colouration of words/sentences etc. in HTML export? Jos'h Fuller
2012-08-21 16:05 ` Eric Schulte
2012-08-21 16:28   ` Jos'h Fuller
2012-08-21 17:49   ` Bastien

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.