[Top][All Lists]

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

Re: [Orgmode] text color + highlight

From: Samuel Wales
Subject: Re: [Orgmode] text color + highlight
Date: Tue, 10 Aug 2010 16:14:25 -0700

i suggest begin-end pairs, not putting text in the syntax itself.
though you could, if you want, using quotes.

  $[class begin :title animals]Some text about animals$[class end
:title animals]

i wrote the following long ago, but never sent it to
the list.  it is not polished at all -- needs more work that
i cannot do on it now -- and not even capitalized.

this is just one example of many for extensible syntax.
note that the code i provide is for the /user/ to use if he
wants.  the following pretends that color is not a feature
of org and demonstrates that even a /user/, without
modifying any code in org, can actually implement a new
feature with its own "syntax" (actually extensible syntax,
which will never conflict with other features) -- if
extensible syntax becomes a feature of org.

i wrote it in response to somebody requesting color.

it needs work.  for example, s/color/face/g .


as far as i know, this is not a feature in org.

however, if extensible syntax were implemented, you could
add this feature to org yourself without touching org source
code or writing any regexps.

here is what it would look like (not what you normally see,
but what you would see if everything were visible).

  here is text in your normal face.  $[color begin :face
  myface :label nil]here is text in myface.  the extensible
  syntax at the beginning has :label nil, which means that
  both ends are invisible except when you are editing them
  or have specified that :label should be ignored.  to make
  them visible, remove or change :label.  you can also
  change the label of the end syntax separately if you want.
  $[color end]here is text in your normal face.

to implement this as a user, you would put something like
this into your .emacs.

  (define-org-syntax color
    ;;these are the quasiarguments to your feature.  they
    ;;use common lisp's keyword argument feature.  face
    ;;defaults to default-face and label defaults to nil,
    ;;which means to
    (begin-or-end &key (face default-face) label)
    "Implement my color feature in org."
      ((equal begin-or-end "begin")
       ;;fixme here you put the emacs code to start a color block
      ((equal begin-or-end "end")
       ;;fixme here you put the emacs code to end a color block
      (otherwise (error "needs to be begin or end"))))
  (define-key org-mode-map "\C-cc" 'my-insert-color-block)
  (defun my-insert-color-block ()
    "Insert a color block."
    ;;fixme place point between them
    (insert "$[color begin :face myface :label nil]$[color end]"))

On 2010-08-09, Christian Moe <address@hidden> wrote:
> Hi,
>  >>
>  >> - this would be extensible, e.g.
>  >>
>  >>  [background[yellow] highlighted text]
>  >>
>  >>  could export to the following html
>  >>
>  >>  <span "style=background:yellow;">highlighted text</span>
>  >>
>  >> - this would avoid "{}"s
>  >>
>  >> - this would look more "org-like" than the pure latex solution
>  >>
>  >> the only issue with the above is that it may conflate a new /markup/
>  >> syntax with org-mode's existing /link/ syntax.
>  >>
>  >> Thoughts? -- Eric
> I'd like an extensible inline markup construct (not primarily for coloring).
> Would it make sense to hijack custom links for this purpose, and use
> existing bracketed link syntax rather than add a new syntax?
> For semantic tagging (my chief interest), one might e.g. define a
> `class' link type and an HTML export handler to wrap the contents in
> <span class="kewyord"> tags.
> : [[class:animals][some text about animals]]
> As for color: If one is satisfied with getting colors on export,
> defining a `color' link type and appropriate export handlers will do.
> : [[color:red][some colored text]]
> If one also wants the text to appear in the right color within Org-mode,
> and does not want the pseudo-link markup to be underlined and look like
> links, it would require additional Org functionality (I think):
> User-defined custom faces for different link types.
>>>> What syntax to use...
>>> I've thought briefly about the following syntax
>>> [color[red] text to be colored red]
>> Nope, I am against this syntax.  If we introduce a more general syntax,
>> then it should be done in the way Samuel proposed.  WHich means
>> we firs get a keyword indtroducing the piece, and then properties.
>> Like
>>    $[style :color red the red text]
>> or
>>    $[face :color :italic t red the red text]
>> Something like the $ before "[" also would seem critical to disambiguate
>> from other uses of "[".
>> However, I am not too excited about extra syntax to get this kind of
>> thing.
>> Would not oppose it, but probably never use it.
>> - Carsten
> Those examples are not very readable IMO -- without a separator it's
> hard to see where the property values end and the marked up text begins.
> Yours,
> Christian
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly disease for 25 years]
Retrovirus: http://www.wpinstitute.org/xmrv/index.html -- PLEASE DONATE
PNAS must publish the original Lo and Alter NIH/FDA XMRV paper
verbatim along with the new paper.

reply via email to

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