* text color + highlight
@ 2010-08-05 20:42 Vinh Nguyen
2010-08-06 9:18 ` Bastien
2010-09-09 16:15 ` Vinh Nguyen
0 siblings, 2 replies; 33+ messages in thread
From: Vinh Nguyen @ 2010-08-05 20:42 UTC (permalink / raw)
To: emacs-orgmode
Dear list,
I was wondering if there is an easy way to markup the color of the
text for html output (and highlight as well). When I prepare meeting
minutes I'd like to color some things and highlight certain things.
Right now, I am using emphasizing a major portion of the text. It
would be great to have colors and highlights to draw attention to
certain items.
Thanks.
Vinh
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-05 20:42 text color + highlight Vinh Nguyen
@ 2010-08-06 9:18 ` Bastien
2010-08-06 16:47 ` Vinh Nguyen
2010-09-09 16:15 ` Vinh Nguyen
1 sibling, 1 reply; 33+ messages in thread
From: Bastien @ 2010-08-06 9:18 UTC (permalink / raw)
To: Vinh Nguyen; +Cc: emacs-orgmode
Hi Vinh,
Vinh Nguyen <vinhdizzo@gmail.com> writes:
> I was wondering if there is an easy way to markup the color of the
> text for html output (and highlight as well). When I prepare meeting
> minutes I'd like to color some things and highlight certain things.
> Right now, I am using emphasizing a major portion of the text. It
> would be great to have colors and highlights to draw attention to
> certain items.
I don't understand your request: what portion of org-mode buffer do you
want to highlight? based on what criteria?
--
Bastien
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 9:18 ` Bastien
@ 2010-08-06 16:47 ` Vinh Nguyen
2010-08-06 20:28 ` Seweryn
2010-08-06 21:51 ` Eric Schulte
0 siblings, 2 replies; 33+ messages in thread
From: Vinh Nguyen @ 2010-08-06 16:47 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
On Fri, Aug 6, 2010 at 2:18 AM, Bastien <bastien.guerry@wikimedia.fr> wrote:
> Hi Vinh,
>
> Vinh Nguyen <vinhdizzo@gmail.com> writes:
>
>> I was wondering if there is an easy way to markup the color of the
>> text for html output (and highlight as well). When I prepare meeting
>> minutes I'd like to color some things and highlight certain things.
>> Right now, I am using emphasizing a major portion of the text. It
>> would be great to have colors and highlights to draw attention to
>> certain items.
>
> I don't understand your request: what portion of org-mode buffer do you
> want to highlight? based on what criteria?
>
Apologies for the ambiguity. In the org, we can use *text* and the
word "text" would be bold in the html output. I was wondering if
there is a markup that would change the color, eg, \{red}[text], or
something of that sort. I don't think it exists. If I wanted to
implement this myself, what should I start with. Ditto with
highlights (say, highlight text yellow).
Something more on org-mode's line would be like setting a variable
#+ color=red
and with some new symbols, say ^text^, the color of "text" would be
red in the html output.
Hope this clears things up.
> --
> Bastien
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 16:47 ` Vinh Nguyen
@ 2010-08-06 20:28 ` Seweryn
2010-08-06 21:51 ` Eric Schulte
1 sibling, 0 replies; 33+ messages in thread
From: Seweryn @ 2010-08-06 20:28 UTC (permalink / raw)
To: emacs-orgmode
Vinh Nguyen <vinhdizzo <at> gmail.com> writes:
>
> Apologies for the ambiguity. In the org, we can use *text* and the
> word "text" would be bold in the html output. I was wondering if
> there is a markup that would change the color, eg, \{red}[text], or
> something of that sort. I don't think it exists. If I wanted to
> implement this myself, what should I start with. Ditto with
> highlights (say, highlight text yellow).
>
> Something more on org-mode's line would be like setting a variable
> #+ color=red
> and with some new symbols, say ^text^, the color of "text" would be
> red in the html output.
You can for example use *text* or /text/ in org buffers and customize
variables: `org-emphasis-alist' and/or `org-export-latex-emphasis-alist'.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 16:47 ` Vinh Nguyen
2010-08-06 20:28 ` Seweryn
@ 2010-08-06 21:51 ` Eric Schulte
2010-08-06 23:42 ` Vinh Nguyen
` (2 more replies)
1 sibling, 3 replies; 33+ messages in thread
From: Eric Schulte @ 2010-08-06 21:51 UTC (permalink / raw)
To: Vinh Nguyen; +Cc: emacs-orgmode, Bastien
[-- Attachment #1: Type: text/plain, Size: 676 bytes --]
Hi,
I've recently seen similar requests on this list.
The attached patch provides a first pass at this support implementing
both in-buffer coloring given the following syntax, and html export (I
don't know the correct LaTeX syntax, but it shouldn't be hard to extend
this to LaTeX as well). This uses something like the LaTeX Beamer
\color{}{} directive, for example...
My name is \color{red}{eric} schulte.
Would result in the word "eric" appearing in red. Even though I
implemented the syntax above, I'm *not* recommending this syntax, it
feels decidedly more like "latex" than "org", it was simply the only
obvious option for this initial implementation.
-- Eric
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-introduction-of-colorization-for-html-output.patch --]
[-- Type: text/x-diff, Size: 5116 bytes --]
From a488b43b66971b16f63141d29cb61f44b959abfa Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Fri, 6 Aug 2010 11:29:33 -0400
Subject: [PATCH] introduction of colorization for html output
* lisp/org-exp.el (org-export-with-color): new customization parameter
controlling the code colorization on export
* lisp/org-html.el (org-html-do-expand): conditional application of
string colorization in html
(org-export-html-colorize): apply html colorization to org-mode text
* lisp/org.el (org-fontify-colorized-text): add option to control
in-buffer colorization of the text
(org-do-colorize-faces): function which applies color to a buffer
(org-set-font-lock-defaults): add coloring to the org-mode
fontification loop
---
lisp/org-exp.el | 5 +++++
lisp/org-html.el | 18 ++++++++++++++++++
lisp/org.el | 27 +++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 6fc5109..991a555 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -445,6 +445,11 @@ This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
:group 'org-export-translation
:type 'boolean)
+(defcustom org-export-with-color t
+ "Non-nil means apply colors to exported text."
+ :group 'org-export-translation
+ :type 'boolean)
+
(defcustom org-export-with-footnotes t
"If nil, export [1] as a footnote marker.
Lines starting with [1] will be formatted as footnotes.
diff --git a/lisp/org-html.el b/lisp/org-html.el
index a12141f..3d3bdcb 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -2060,6 +2060,8 @@ If there are links in the string, don't modify these."
(setq s (replace-match "<\\1>" t nil s))))
(if org-export-with-emphasize
(setq s (org-export-html-convert-emphasize s)))
+ (if org-export-with-color
+ (setq s (org-export-html-colorize s)))
(if org-export-with-special-strings
(setq s (org-export-html-convert-special-strings s)))
(if org-export-with-sub-superscripts
@@ -2131,6 +2133,22 @@ If there are links in the string, don't modify these."
(setq s (1+ s))))
string))
+(defun org-export-html-colorize (string)
+ "Apply colors."
+ (replace-regexp-in-string
+ "\\\\color{\\(.+?\\)}{\\(.+?\\)}"
+ (lambda (text)
+ (let ((ind 7) (length (length text)))
+ (while (and (< ind length)
+ (not (string= (substring text ind (+ 2 ind)) "}{")))
+ (setq ind (+ 1 ind)))
+ (if (get-text-property (match-beginning 0) 'org-protected string)
+ text
+ (concat "<span style=\"color: " (substring text 7 ind)
+ ";\">" (substring text (+ 2 ind) (- length 1))
+ "</span>"))))
+ string))
+
(defun org-open-par ()
"Insert <p>, but first close previous paragraph if any."
(org-close-par-maybe)
diff --git a/lisp/org.el b/lisp/org.el
index d2c1fdf..fe98fb0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3282,6 +3282,12 @@ Changing this variable requires a restart of Emacs to take effect."
:group 'org-appearance
:type 'boolean)
+(defcustom org-fontify-colorized-text t
+ "Non-nil means colorize colored text.
+Changing this variable requires a restart of Emacs to take effect."
+ :group 'org-appearance
+ :type 'boolean)
+
(defcustom org-fontify-whole-heading-line nil
"Non-nil means fontify the whole line for headings.
This is useful when setting a background color for the
@@ -4920,6 +4926,21 @@ The time stamps may be either active or inactive.")
(backward-char 1))
rtn))
+(defun org-do-colorize-faces (limit)
+ "Run through the buffer and add overlays to colored text."
+ (let ((org-color-re "\\\\color{\\(.+?\\)}{\\(.+?\\)}"))
+ (while (re-search-forward org-color-re limit t)
+ ;; hide wrapper
+ (add-text-properties (match-beginning 0) (+ 2 (match-end 1))
+ '(invisible org-link))
+ (add-text-properties (- (match-end 0) 1) (match-end 0)
+ '(invisible org-link))
+ ;; color text
+ (font-lock-prepend-text-property (match-beginning 2) (match-end 2)
+ 'face
+ `((t (:foreground ,(match-string 1))))))
+ rtn))
+
(defun org-emphasize (&optional char)
"Insert or change an emphasis, i.e. a font like bold or italic.
If there is an active region, change that region to a new emphasis.
@@ -5367,6 +5388,7 @@ For plain list items, if they are matched by `outline-regexp', this returns
(defun org-set-font-lock-defaults ()
(let* ((em org-fontify-emphasized-text)
+ (co org-fontify-colorized-text)
(lk org-activate-links)
(org-font-lock-extra-keywords
(list
@@ -5429,6 +5451,11 @@ For plain list items, if they are matched by `outline-regexp', this returns
(if (featurep 'xemacs)
'(org-do-emphasis-faces (0 nil append))
'(org-do-emphasis-faces)))
+ ;; Color
+ (if co
+ (if (featurep 'xemacs)
+ '(org-do-colorize-faces (0 nil append))
+ '(org-do-colorize-faces)))
;; Checkboxes
'("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)"
2 'org-checkbox prepend)
--
1.7.0.4
[-- Attachment #3: Type: text/plain, Size: 1568 bytes --]
Vinh Nguyen <vinhdizzo@gmail.com> writes:
> On Fri, Aug 6, 2010 at 2:18 AM, Bastien <bastien.guerry@wikimedia.fr> wrote:
>> Hi Vinh,
>>
>> Vinh Nguyen <vinhdizzo@gmail.com> writes:
>>
>>> I was wondering if there is an easy way to markup the color of the
>>> text for html output (and highlight as well). When I prepare meeting
>>> minutes I'd like to color some things and highlight certain things.
>>> Right now, I am using emphasizing a major portion of the text. It
>>> would be great to have colors and highlights to draw attention to
>>> certain items.
>>
>> I don't understand your request: what portion of org-mode buffer do you
>> want to highlight? based on what criteria?
>>
>
> Apologies for the ambiguity. In the org, we can use *text* and the
> word "text" would be bold in the html output. I was wondering if
> there is a markup that would change the color, eg, \{red}[text], or
> something of that sort. I don't think it exists. If I wanted to
> implement this myself, what should I start with. Ditto with
> highlights (say, highlight text yellow).
>
> Something more on org-mode's line would be like setting a variable
> #+ color=red
> and with some new symbols, say ^text^, the color of "text" would be
> red in the html output.
>
> Hope this clears things up.
>> --
>> Bastien
>>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 21:51 ` Eric Schulte
@ 2010-08-06 23:42 ` Vinh Nguyen
2010-08-07 3:15 ` Eric Schulte
2010-08-07 4:52 ` Nick Dokos
2010-08-07 12:17 ` Sebastian Rose
2 siblings, 1 reply; 33+ messages in thread
From: Vinh Nguyen @ 2010-08-06 23:42 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode, Bastien
Thanks Eric, this works. I do agree that the implemented syntax is
not org-like but more latex-like. To be more org-like, could we use
parentheses or curly braces like how links are implemented? They
aren't taken, are they? For example,
((red)(this text is red))
{{yellow}{this text is highlighted yellow}} ## see
http://answers.yahoo.com/question/index?qid=20080316135432AANXSJc
What do you think? How hard would it be to change your code to this?
Can this be merged into the development branch?
Thanks,
Vinh
On Fri, Aug 6, 2010 at 2:51 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> Hi,
>
> I've recently seen similar requests on this list.
>
> The attached patch provides a first pass at this support implementing
> both in-buffer coloring given the following syntax, and html export (I
> don't know the correct LaTeX syntax, but it shouldn't be hard to extend
> this to LaTeX as well). This uses something like the LaTeX Beamer
> \color{}{} directive, for example...
>
> My name is \color{red}{eric} schulte.
>
> Would result in the word "eric" appearing in red. Even though I
> implemented the syntax above, I'm *not* recommending this syntax, it
> feels decidedly more like "latex" than "org", it was simply the only
> obvious option for this initial implementation.
>
> -- Eric
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 23:42 ` Vinh Nguyen
@ 2010-08-07 3:15 ` Eric Schulte
2010-08-07 3:57 ` Dan Davison
` (2 more replies)
0 siblings, 3 replies; 33+ messages in thread
From: Eric Schulte @ 2010-08-07 3:15 UTC (permalink / raw)
To: Vinh Nguyen; +Cc: emacs-orgmode, Bastien
Hi Vinh,
Vinh Nguyen <vinhdizzo@gmail.com> writes:
> Thanks Eric, this works.
Great,
> I do agree that the implemented syntax is not org-like but more
> latex-like. To be more org-like, could we use parentheses or curly
> braces like how links are implemented? They aren't taken, are they?
> For example,
>
> ((red)(this text is red))
> {{yellow}{this text is highlighted yellow}} ## see
> http://answers.yahoo.com/question/index?qid=20080316135432AANXSJc
>
yes, these would be equally easy to implement, and simpler than with the
\color prefix, but as someone who often leaves lisp snippets laying
around org-mode files, these options may be too dangerous. We'd have to
ensure that the syntax doesn't accidentally grab text which is not
intended for formatting.
also, color gives the option of other keyword attributes which we may
want to associate with text, e.g. "background" for background coloring
(highlighting), "font-type" for possibly different fonts, etc...
but again, I'm reticent to commit to any particular format, as Org-mode
does a good job of feeling consistent, and I'd not want to hurt that
consistency.
>
> What do you think? How hard would it be to change your code to this?
> Can this be merged into the development branch?
>
In playing with the patched code I sent out, I noticed that it may be
doing weird things to my headings (#+Title: etc...) in some Org-mode
files, so probably it could use some more tweaking before any merge,
also I'd not want to rush what could be a reasonably large change into
Org-mode without more discussion, but I agree I'd ultimately like to see
some form of this functionality appear in Org-mode.
Best -- Eric
>
> Thanks,
> Vinh
>
>
> On Fri, Aug 6, 2010 at 2:51 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>> Hi,
>>
>> I've recently seen similar requests on this list.
>>
>> The attached patch provides a first pass at this support implementing
>> both in-buffer coloring given the following syntax, and html export (I
>> don't know the correct LaTeX syntax, but it shouldn't be hard to extend
>> this to LaTeX as well). This uses something like the LaTeX Beamer
>> \color{}{} directive, for example...
>>
>> My name is \color{red}{eric} schulte.
>>
>> Would result in the word "eric" appearing in red. Even though I
>> implemented the syntax above, I'm *not* recommending this syntax, it
>> feels decidedly more like "latex" than "org", it was simply the only
>> obvious option for this initial implementation.
>>
>> -- Eric
>>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-07 3:15 ` Eric Schulte
@ 2010-08-07 3:57 ` Dan Davison
2010-08-08 14:59 ` Vinh Nguyen
2010-08-09 5:17 ` Jambunathan K
2 siblings, 0 replies; 33+ messages in thread
From: Dan Davison @ 2010-08-07 3:57 UTC (permalink / raw)
To: Eric Schulte; +Cc: Bastien, emacs-orgmode, Vinh Nguyen
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Hi Vinh,
>
> Vinh Nguyen <vinhdizzo@gmail.com> writes:
>
>> Thanks Eric, this works.
>
> Great,
>
>> I do agree that the implemented syntax is not org-like but more
>> latex-like. To be more org-like, could we use parentheses or curly
>> braces like how links are implemented? They aren't taken, are they?
>> For example,
>>
>> ((red)(this text is red))
>> {{yellow}{this text is highlighted yellow}} ## see
>> http://answers.yahoo.com/question/index?qid=20080316135432AANXSJc
>>
>
> yes, these would be equally easy to implement, and simpler than with the
> \color prefix, but as someone who often leaves lisp snippets laying
> around org-mode files, these options may be too dangerous. We'd have to
> ensure that the syntax doesn't accidentally grab text which is not
> intended for formatting.
>
> also, color gives the option of other keyword attributes which we may
> want to associate with text, e.g. "background" for background coloring
> (highlighting), "font-type" for possibly different fonts, etc...
This seems close to the ideas discussed in some threads started by
Samuel Wales, regarding introducing a new extensible syntax which could
handle applications like this
http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10240
http://thread.gmane.org/gmane.emacs.orgmode/11896
Dan
>
> but again, I'm reticent to commit to any particular format, as Org-mode
> does a good job of feeling consistent, and I'd not want to hurt that
> consistency.
>
>>
>> What do you think? How hard would it be to change your code to this?
>> Can this be merged into the development branch?
>>
>
> In playing with the patched code I sent out, I noticed that it may be
> doing weird things to my headings (#+Title: etc...) in some Org-mode
> files, so probably it could use some more tweaking before any merge,
> also I'd not want to rush what could be a reasonably large change into
> Org-mode without more discussion, but I agree I'd ultimately like to see
> some form of this functionality appear in Org-mode.
>
> Best -- Eric
>
>>
>> Thanks,
>> Vinh
>>
>>
>> On Fri, Aug 6, 2010 at 2:51 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>> Hi,
>>>
>>> I've recently seen similar requests on this list.
>>>
>>> The attached patch provides a first pass at this support implementing
>>> both in-buffer coloring given the following syntax, and html export (I
>>> don't know the correct LaTeX syntax, but it shouldn't be hard to extend
>>> this to LaTeX as well). This uses something like the LaTeX Beamer
>>> \color{}{} directive, for example...
>>>
>>> My name is \color{red}{eric} schulte.
>>>
>>> Would result in the word "eric" appearing in red. Even though I
>>> implemented the syntax above, I'm *not* recommending this syntax, it
>>> feels decidedly more like "latex" than "org", it was simply the only
>>> obvious option for this initial implementation.
>>>
>>> -- Eric
>>>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 21:51 ` Eric Schulte
2010-08-06 23:42 ` Vinh Nguyen
@ 2010-08-07 4:52 ` Nick Dokos
2010-08-07 12:17 ` Sebastian Rose
2 siblings, 0 replies; 33+ messages in thread
From: Nick Dokos @ 2010-08-07 4:52 UTC (permalink / raw)
To: Eric Schulte; +Cc: Bastien, emacs-orgmode, nicholas.dokos, Vinh Nguyen
Eric Schulte <schulte.eric@gmail.com> wrote:
> Hi,
>
> I've recently seen similar requests on this list.
>
> The attached patch provides a first pass at this support implementing
> both in-buffer coloring given the following syntax, and html export (I
> don't know the correct LaTeX syntax, but it shouldn't be hard to extend
> this to LaTeX as well). This uses something like the LaTeX Beamer
> \color{}{} directive, for example...
>
> My name is \color{red}{eric} schulte.
>
> Would result in the word "eric" appearing in red. Even though I
> implemented the syntax above, I'm *not* recommending this syntax, it
> feels decidedly more like "latex" than "org", it was simply the only
> obvious option for this initial implementation.
>
Having LaTeX syntax in an org file is not uncommon: you could view
it as a LaTeX fragment that happens to work in other exports (thanks to
your patch), as well as in the fontification of the buffer.
And it *almost* works in LaTeX as is: the only problem is that the LaTeX
\color command (in contrast to yours) is modal: its range extends to the
end of the current group; so unless some pains are taken, *everything*
after \color{red} would be red. But let's assume you chose a slightly
different designator, say \xcolor{red}. THen the following exports to
LaTeX just fine:
--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \usepackage{color}
#+LATEX_HEADER: \newcommand{\xcolor}[2]{{\color{#1}#2}}
* test
My name is \xcolor{red}{eric} schulte.
--8<---------------cut here---------------end--------------->8---
Note the inner braces in the definition of \xcolor: they delimit
the group in which the changed color is active.
So it might be a good idea to use a different designator
than \color and have the LaTeX exporter add the mods above.
The color package is part of the LaTeX core, so it wouldn't cost
anything but processing costs to always include it.
Alternatively, one can play renaming games in LaTeX and that might
free up \color for this use, but that's always a bit more complicated
and can be confusing.
Thanks,
Nick
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-06 21:51 ` Eric Schulte
2010-08-06 23:42 ` Vinh Nguyen
2010-08-07 4:52 ` Nick Dokos
@ 2010-08-07 12:17 ` Sebastian Rose
2010-08-08 17:46 ` Samuel Wales
2 siblings, 1 reply; 33+ messages in thread
From: Sebastian Rose @ 2010-08-07 12:17 UTC (permalink / raw)
To: Eric Schulte; +Cc: Bastien, emacs-orgmode, Vinh Nguyen
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Hi,
>
> I've recently seen similar requests on this list.
>
> The attached patch provides a first pass at this support implementing
> both in-buffer coloring given the following syntax, and html export (I
> don't know the correct LaTeX syntax, but it shouldn't be hard to extend
> this to LaTeX as well). This uses something like the LaTeX Beamer
> \color{}{} directive, for example...
>
> My name is \color{red}{eric} schulte.
>
> Would result in the word "eric" appearing in red. Even though I
> implemented the syntax above, I'm *not* recommending this syntax, it
> feels decidedly more like "latex" than "org", it was simply the only
> obvious option for this initial implementation.
Well, why not keep that syntax, but add another one:
--8<---------------cut here---------------start------------->8--
#+color: red
* This entired entry is in red color
The contents too.
* Back to normal
Some text.
#+color: green
This next something (a pragraph in this case) is in green color.
back to normal
--8<---------------cut here---------------end--------------->8--
Maybe it's easier to make the comment color the next line only?
How about
#+style: color=red weight=bold
Or
#+red
#+bold
I'm red and bold.
Something like this. It's easier to just add a comment, than to wrap a
region. Curly braces are hard to type on a german keyboard.
Just jump to the beginning of a line and type `#+red RET' seems easier
to me. To remove `#+red', `C-k C-k' is enough. No need to learn
another Shortcut.
Sebastian
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-07 3:15 ` Eric Schulte
2010-08-07 3:57 ` Dan Davison
@ 2010-08-08 14:59 ` Vinh Nguyen
2010-08-08 21:00 ` Eric Schulte
2010-08-09 5:17 ` Jambunathan K
2 siblings, 1 reply; 33+ messages in thread
From: Vinh Nguyen @ 2010-08-08 14:59 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode, Bastien
On Fri, Aug 6, 2010 at 8:15 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> In playing with the patched code I sent out, I noticed that it may be
> doing weird things to my headings (#+Title: etc...) in some Org-mode
> files, so probably it could use some more tweaking before any merge,
> also I'd not want to rush what could be a reasonably large change into
> Org-mode without more discussion, but I agree I'd ultimately like to see
> some form of this functionality appear in Org-mode.
>
> Best -- Eric
Eric, so are you tweaking the code to give it a more org-like syntax?
If not, I'll have to get dirty with your patch to figure out the lisp
code.
You're right the regular parentheses will probably be mixed up with
lisp code. Sebastian also brought up that curly braces are hard to
type on a German keyboard. Just googled up the layout -- don't even
seen them.
What syntax to use...
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-07 12:17 ` Sebastian Rose
@ 2010-08-08 17:46 ` Samuel Wales
0 siblings, 0 replies; 33+ messages in thread
From: Samuel Wales @ 2010-08-08 17:46 UTC (permalink / raw)
To: Sebastian Rose; +Cc: Vinh Nguyen, emacs-orgmode, Bastien
Hi all,
I do, very strongly, propose extensible syntax. Thanks for bringing it up, Dan.
I have much more on this but cannot type now.
Samuel
--
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.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-08 14:59 ` Vinh Nguyen
@ 2010-08-08 21:00 ` Eric Schulte
2010-08-09 6:28 ` Carsten Dominik
2010-08-09 6:58 ` Eric Schulte
0 siblings, 2 replies; 33+ messages in thread
From: Eric Schulte @ 2010-08-08 21:00 UTC (permalink / raw)
To: Vinh Nguyen; +Cc: emacs-orgmode, Bastien
Vinh Nguyen <vinhdizzo@gmail.com> writes:
> On Fri, Aug 6, 2010 at 8:15 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>> In playing with the patched code I sent out, I noticed that it may be
>> doing weird things to my headings (#+Title: etc...) in some Org-mode
>> files, so probably it could use some more tweaking before any merge,
>> also I'd not want to rush what could be a reasonably large change into
>> Org-mode without more discussion, but I agree I'd ultimately like to see
>> some form of this functionality appear in Org-mode.
>>
>> Best -- Eric
>
> Eric, so are you tweaking the code to give it a more org-like syntax?
> If not, I'll have to get dirty with your patch to figure out the lisp
> code.
>
> You're right the regular parentheses will probably be mixed up with
> lisp code. Sebastian also brought up that curly braces are hard to
> type on a German keyboard. Just googled up the layout -- don't even
> seen them.
>
> What syntax to use...
I've thought briefly about the following syntax
[color[red] text to be colored red]
- 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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-07 3:15 ` Eric Schulte
2010-08-07 3:57 ` Dan Davison
2010-08-08 14:59 ` Vinh Nguyen
@ 2010-08-09 5:17 ` Jambunathan K
2010-08-09 5:52 ` Noorul Islam K M
2 siblings, 1 reply; 33+ messages in thread
From: Jambunathan K @ 2010-08-09 5:17 UTC (permalink / raw)
To: emacs-orgmode
Eric> but again, I'm reticent to commit to any particular format, as
Eric> Org-mode does a good job of feeling consistent, and I'd not
Eric> want to hurt that consistency.
In an edit buffer, I would personally prefer to see the colour 'red'
visually rather than as a 'synctactic element'.
May be Org mode could be enhanced to honour (and coexist with) enriched
mode markups.
http://www.gnu.org/software/emacs/manual/html_node/emacs/Requesting-Formatted-Text.html#Requesting-Formatted-Text
Jambunathan K.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-09 5:17 ` Jambunathan K
@ 2010-08-09 5:52 ` Noorul Islam K M
0 siblings, 0 replies; 33+ messages in thread
From: Noorul Islam K M @ 2010-08-09 5:52 UTC (permalink / raw)
To: Jambunathan K; +Cc: emacs-orgmode
Jambunathan K <kjambunathan@gmail.com> writes:
> Eric> but again, I'm reticent to commit to any particular format, as
> Eric> Org-mode does a good job of feeling consistent, and I'd not
> Eric> want to hurt that consistency.
>
> In an edit buffer, I would personally prefer to see the colour 'red'
> visually rather than as a 'synctactic element'.
>
> May be Org mode could be enhanced to honour (and coexist with) enriched
> mode markups.
>
> http://www.gnu.org/software/emacs/manual/html_node/emacs/Requesting-Formatted-Text.html#Requesting-Formatted-Text
I think the very beauty of Org-Mode is that it manipulates pure
plain-text.
Thanks and Regards
Noorul
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-08 21:00 ` Eric Schulte
@ 2010-08-09 6:28 ` Carsten Dominik
2010-08-09 7:37 ` Robert Klein
2010-08-10 6:14 ` Christian Moe
2010-08-09 6:58 ` Eric Schulte
1 sibling, 2 replies; 33+ messages in thread
From: Carsten Dominik @ 2010-08-09 6:28 UTC (permalink / raw)
To: Eric Schulte; +Cc: Bastien, emacs-orgmode, Vinh Nguyen
On Aug 8, 2010, at 11:00 PM, Eric Schulte wrote:
> Vinh Nguyen <vinhdizzo@gmail.com> writes:
>
>> On Fri, Aug 6, 2010 at 8:15 PM, Eric Schulte
>> <schulte.eric@gmail.com> wrote:
>>> In playing with the patched code I sent out, I noticed that it may
>>> be
>>> doing weird things to my headings (#+Title: etc...) in some Org-mode
>>> files, so probably it could use some more tweaking before any merge,
>>> also I'd not want to rush what could be a reasonably large change
>>> into
>>> Org-mode without more discussion, but I agree I'd ultimately like
>>> to see
>>> some form of this functionality appear in Org-mode.
>>>
>>> Best -- Eric
>>
>> Eric, so are you tweaking the code to give it a more org-like syntax?
>> If not, I'll have to get dirty with your patch to figure out the lisp
>> code.
>>
>> You're right the regular parentheses will probably be mixed up with
>> lisp code. Sebastian also brought up that curly braces are hard to
>> type on a German keyboard. Just googled up the layout -- don't even
>> seen them.
>>
>> 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
>
> - 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
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-08 21:00 ` Eric Schulte
2010-08-09 6:28 ` Carsten Dominik
@ 2010-08-09 6:58 ` Eric Schulte
2010-08-09 7:05 ` Samuel Wales
1 sibling, 1 reply; 33+ messages in thread
From: Eric Schulte @ 2010-08-09 6:58 UTC (permalink / raw)
To: Vinh Nguyen; +Cc: emacs-orgmode, Bastien
[-- Attachment #1: Type: text/plain, Size: 896 bytes --]
Hi,
The attached patch implements in-buffer coloring and html export using
the syntax proposed below.
While I think this is an improvement over my previous patch, this idea
still has some shortcoming including the fact that
- nested color specifications aren't working for export (and could be
tricky to implement)
- when using a dark-background Emacs theme colors that look good in the
buffer generally don't look good in the html export and vise versa
The following Org-mode buffer demonstrates this patch
--8<---------------cut here---------------start------------->8---
#+Title: A Buffer with Color
* top
Some colors [color[green]are] green, and [color[red]also] red, and even html colors
like [color[#610B5E]these others] sometimes subtler colors.
These can also be [background[yellow]highlighted].
--8<---------------cut here---------------end--------------->8---
Cheers -- Eric
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-introduction-of-colorization-for-html-output.patch --]
[-- Type: text/x-diff, Size: 5717 bytes --]
From db9d463ce7d015de16fe768804d83132bc1780d2 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Fri, 6 Aug 2010 11:29:33 -0400
Subject: [PATCH] introduction of colorization for html output
* lisp/org-exp.el (org-export-with-color): new customization parameter
controlling the code colorization on export
* lisp/org-html.el (org-html-do-expand): conditional application of
string colorization in html
(org-export-html-colorize): apply html colorization to org-mode text
* lisp/org.el (org-fontify-colorized-text): add option to control
in-buffer colorization of the text
(org-do-colorize-faces): function which applies color to a buffer
(org-set-font-lock-defaults): add coloring to the org-mode
fontification loop
---
lisp/org-exp.el | 5 +++++
lisp/org-html.el | 22 ++++++++++++++++++++++
lisp/org.el | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index cd0a105..7c3d0dd 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -449,6 +449,11 @@ This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
:group 'org-export-translation
:type 'boolean)
+(defcustom org-export-with-color t
+ "Non-nil means apply colors to exported text."
+ :group 'org-export-translation
+ :type 'boolean)
+
(defcustom org-export-with-footnotes t
"If nil, export [1] as a footnote marker.
Lines starting with [1] will be formatted as footnotes.
diff --git a/lisp/org-html.el b/lisp/org-html.el
index a12141f..1b5665b 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -2060,6 +2060,8 @@ If there are links in the string, don't modify these."
(setq s (replace-match "<\\1>" t nil s))))
(if org-export-with-emphasize
(setq s (org-export-html-convert-emphasize s)))
+ (if org-export-with-color
+ (setq s (org-export-html-colorize s)))
(if org-export-with-special-strings
(setq s (org-export-html-convert-special-strings s)))
(if org-export-with-sub-superscripts
@@ -2131,6 +2133,26 @@ If there are links in the string, don't modify these."
(setq s (1+ s))))
string))
+(defun org-export-html-colorize (string)
+ "Apply colors."
+ (let ((s1 0) (length (length string)) s2 s3 parens)
+ (while (string-match "\\[\\([^\r\n]+?\\)\\[\\(.+?\\)\\]" string s1)
+ (setq s2 s1 s3 (match-beginning 0) s1 (match-end 0) parens 1)
+ (while (and (> parens 0) (<= s1 length))
+ ((lambda (h)
+ (cond ((string= h "[") (setq parens (+ parens 1)))
+ ((string= h "]") (setq parens (- parens 1)))))
+ (substring string s1 (setq s1 (+ 1 s1)))))
+ (when (<= s1 length)
+ (setq string
+ (concat (substring string 0 s3)
+ "<span style=\"" (match-string 1 string)
+ ":" (match-string 2 string) ";\">"
+ (substring string (match-end 0) (- s1 1)) "</span>"
+ (substring string s1))))
+ (setq length (+ length 20)))
+ string))
+
(defun org-open-par ()
"Insert <p>, but first close previous paragraph if any."
(org-close-par-maybe)
diff --git a/lisp/org.el b/lisp/org.el
index af4f793..772b31f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3294,6 +3294,12 @@ Changing this variable requires a restart of Emacs to take effect."
:group 'org-appearance
:type 'boolean)
+(defcustom org-fontify-colorized-text t
+ "Non-nil means colorize colored text.
+Changing this variable requires a restart of Emacs to take effect."
+ :group 'org-appearance
+ :type 'boolean)
+
(defcustom org-fontify-whole-heading-line nil
"Non-nil means fontify the whole line for headings.
This is useful when setting a background color for the
@@ -4932,6 +4938,30 @@ The time stamps may be either active or inactive.")
(backward-char 1))
rtn))
+(defun org-do-colorize-faces (limit)
+ "Run through the buffer and add overlays to colored text."
+ (let ((s1 0) parens rtn)
+ (while (and (re-search-forward "\\[\\([^\r\n]+?\\)\\[\\(.+?\\)\\]" limit t))
+ (setq s1 (match-end 0) parens 1)
+ (while (> parens 0)
+ ((lambda (h)
+ (cond ((string= h "[") (setq parens (+ parens 1)))
+ ((string= h "]") (setq parens (- parens 1)))))
+ (buffer-substring s1 (setq s1 (+ 1 s1)))))
+ (when (<= s1 limit) (setq rtn t))
+ ;; hide wrapper
+ (add-text-properties (match-beginning 0) (+ 1 (match-end 2))
+ '(invisible org-link))
+ (add-text-properties (- s1 1) s1 '(invisible org-link))
+ ;; color text
+ (font-lock-prepend-text-property
+ (match-end 0) s1
+ 'face `((t ,(list
+ (cond ((string= (match-string 1) "color") :foreground)
+ (t (intern (concat ":" (match-string 1)))))
+ (match-string 2))))))
+ rtn))
+
(defun org-emphasize (&optional char)
"Insert or change an emphasis, i.e. a font like bold or italic.
If there is an active region, change that region to a new emphasis.
@@ -5385,6 +5415,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
(defun org-set-font-lock-defaults ()
(let* ((em org-fontify-emphasized-text)
+ (co org-fontify-colorized-text)
(lk org-activate-links)
(org-font-lock-extra-keywords
(list
@@ -5447,6 +5478,11 @@ needs to be inserted at a specific position in the font-lock sequence.")
(if (featurep 'xemacs)
'(org-do-emphasis-faces (0 nil append))
'(org-do-emphasis-faces)))
+ ;; Color
+ (if co
+ (if (featurep 'xemacs)
+ '(org-do-colorize-faces (0 nil append))
+ '(org-do-colorize-faces)))
;; Checkboxes
'("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)"
2 'org-checkbox prepend)
--
1.7.0.4
[-- Attachment #3: Type: text/plain, Size: 220 bytes --]
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Vinh Nguyen <vinhdizzo@gmail.com> writes:
[...]
>> What syntax to use...
>
> I've thought briefly about the following syntax
>
> [color[red] text to be colored red]
>
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-09 6:58 ` Eric Schulte
@ 2010-08-09 7:05 ` Samuel Wales
0 siblings, 0 replies; 33+ messages in thread
From: Samuel Wales @ 2010-08-09 7:05 UTC (permalink / raw)
To: Eric Schulte; +Cc: Bastien, emacs-orgmode, Vinh Nguyen
Hi Eric,
Did you read my proposals in detail?
Samuel
On 2010-08-08, Eric Schulte <schulte.eric@gmail.com> wrote:
> Hi,
>
> The attached patch implements in-buffer coloring and html export using
> the syntax proposed below.
>
> While I think this is an improvement over my previous patch, this idea
> still has some shortcoming including the fact that
> - nested color specifications aren't working for export (and could be
> tricky to implement)
> - when using a dark-background Emacs theme colors that look good in the
> buffer generally don't look good in the html export and vise versa
>
> The following Org-mode buffer demonstrates this patch
> --8<---------------cut here---------------start------------->8---
> #+Title: A Buffer with Color
>
> * top
> Some colors [color[green]are] green, and [color[red]also] red, and even html
> colors
> like [color[#610B5E]these others] sometimes subtler colors.
>
> These can also be [background[yellow]highlighted].
> --8<---------------cut here---------------end--------------->8---
>
> Cheers -- Eric
>
>
--
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.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-09 6:28 ` Carsten Dominik
@ 2010-08-09 7:37 ` Robert Klein
2010-08-09 7:40 ` Robert Klein
2010-08-10 6:14 ` Christian Moe
1 sibling, 1 reply; 33+ messages in thread
From: Robert Klein @ 2010-08-09 7:37 UTC (permalink / raw)
To: Eric Schulte, Carsten Dominik; +Cc: Vinh Nguyen, emacs-orgmode, Bastien
Am 09.08.2010, 08:28 Uhr, schrieb Carsten Dominik
<carsten.dominik@gmail.com>:
> 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 "[".
I'd prefer this kind of syntax, too. Btw, shouldn't the syntax be:
$[face :color red :italic t the red italic text]
?? (i.e. the red following the :color keyword, not the ':italic t')
I didn't find a canonical way to make a paragraph or a longer text passage
italic
>
> 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
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-09 7:37 ` Robert Klein
@ 2010-08-09 7:40 ` Robert Klein
0 siblings, 0 replies; 33+ messages in thread
From: Robert Klein @ 2010-08-09 7:40 UTC (permalink / raw)
To: Eric Schulte, Carsten Dominik, Robert Klein
Cc: Bastien, emacs-orgmode, Vinh Nguyen
Am 09.08.2010, 09:37 Uhr, schrieb Robert Klein <roklein@roklein.de>:
Sorry dropped something on the keyboard and sent the message early :(
Am 09.08.2010, 08:28 Uhr, schrieb Carsten Dominik
<carsten.dominik@gmail.com>:
> 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 "[".
I'd prefer this kind of syntax, too. Btw, shouldn't the syntax be:
$[face :color red :italic t the red italic text]
?? (i.e. the red following the :color keyword, not the ':italic t')
I didn't find a canonical way to make a paragraph or a longer text
passage italic, so I'd love an easy way to get it.
BTW, if simply '$[' is free, why not use this for style, e.g.:
$[:italic t :bold nil :color teal My italic and teal text]
(sorry for the double mail)
Best regards
Robert
>
> 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
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-09 6:28 ` Carsten Dominik
2010-08-09 7:37 ` Robert Klein
@ 2010-08-10 6:14 ` Christian Moe
2010-08-10 7:06 ` Carsten Dominik
2010-08-10 23:14 ` Samuel Wales
1 sibling, 2 replies; 33+ messages in thread
From: Christian Moe @ 2010-08-10 6:14 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Vinh Nguyen, emacs-orgmode, Bastien
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 6:14 ` Christian Moe
@ 2010-08-10 7:06 ` Carsten Dominik
2010-08-10 9:30 ` Christian Moe
2010-08-11 6:48 ` Dan Davison
2010-08-10 23:14 ` Samuel Wales
1 sibling, 2 replies; 33+ messages in thread
From: Carsten Dominik @ 2010-08-10 7:06 UTC (permalink / raw)
To: mail; +Cc: Vinh Nguyen, emacs-orgmode, Bastien
Hi,
Can we please first read Samuels post about extensible syntax? Before
we invent 20 other new syntaxes?
http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10204
Thanks!
On Aug 10, 2010, at 8:14 AM, Christian Moe 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
- Carsten
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 7:06 ` Carsten Dominik
@ 2010-08-10 9:30 ` Christian Moe
2010-08-10 15:06 ` Eric Schulte
2010-08-11 6:48 ` Dan Davison
1 sibling, 1 reply; 33+ messages in thread
From: Christian Moe @ 2010-08-10 9:30 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Bastien, emacs-orgmode, Vinh Nguyen
Hi,
I'm sorry my point was buried in quoted text. I did read Samuel's post.
But my question was whether we couldn't *avoid inventing new syntaxes*,
by using the already existing link syntax with custom links and export
handlers (plus possibly some some new functionality to user-customize
the faces of different link types in Org-mode).
e.g.
: [[color:red][some text in red]]
: [[class:highlight][some highlighted text]]
It's already trivial to write one's own `color' and `class' custom link
types with export handlers to turn this into HTML such as:
: <span style="color: red;">some text in red</span>
: <span class="highlight">some highlighted text</span>
(where the latter example would be styled by CSS).
Doing this in exported text requires *no changes* to Org-mode. It also
does not require finding one solution that fits everybody.
If one wants Org text styled in these colors, highlights etc., I suppose
it would require changes in Org-mode: not just user-customizable faces
for different link types, as I wrote in the previous message, but a
function to define link faces on the fly from the PATH part of the link.
Christian
Carsten Dominik wrote:
> Hi,
>
> Can we please first read Samuels post about extensible syntax? Before
> we invent 20 other new syntaxes?
>
> http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10204
>
> Thanks!
>
> On Aug 10, 2010, at 8:14 AM, Christian Moe 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
>
> - Carsten
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
--
Christian Moe
E-mail: mail@christianmoe.com
Website: http://christianmoe.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 9:30 ` Christian Moe
@ 2010-08-10 15:06 ` Eric Schulte
2010-08-10 18:38 ` Christian Moe
0 siblings, 1 reply; 33+ messages in thread
From: Eric Schulte @ 2010-08-10 15:06 UTC (permalink / raw)
To: mail; +Cc: Bastien, emacs-orgmode, Vinh Nguyen, Carsten Dominik
Hi Christian,
Christian Moe <mail@christianmoe.com> writes:
> Hi,
>
> I'm sorry my point was buried in quoted text. I did read Samuel's
> post. But my question was whether we couldn't *avoid inventing new
> syntaxes*, by using the already existing link syntax with custom links
> and export handlers (plus possibly some some new functionality to
> user-customize the faces of different link types in Org-mode).
>
> e.g.
>
> : [[color:red][some text in red]]
> : [[class:highlight][some highlighted text]]
>
>
> It's already trivial to write one's own `color' and `class' custom
> link types with export handlers to turn this into HTML such as:
>
> : <span style="color: red;">some text in red</span>
> : <span class="highlight">some highlighted text</span>
>
Thanks for making this suggestion. This is a much better solution than
creating a new syntax out of whole cloth, I should have known that Org
would already have a working solution in place.
Just for completeness I'm adding an example of a color handler which can
be added to a users config to enable colorization of exported text to
html and latex.
--8<---------------cut here---------------start------------->8---
(org-add-link-type
"color" nil
(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)))))
--8<---------------cut here---------------end--------------->8---
it should be fairly straightforward to extend the above for background
or class link types
>
> (where the latter example would be styled by CSS).
>
> Doing this in exported text requires *no changes* to Org-mode. It also
> does not require finding one solution that fits everybody.
>
> If one wants Org text styled in these colors, highlights etc., I
> suppose it would require changes in Org-mode: not just
> user-customizable faces for different link types, as I wrote in the
> previous message, but a function to define link faces on the fly from
> the PATH part of the link.
>
I think in-buffer colorization is much less important than the export
behavior.
Cheers -- Eric
>
>
> Christian
>
> Carsten Dominik wrote:
>> Hi,
>>
>> Can we please first read Samuels post about extensible syntax?
>> Before we invent 20 other new syntaxes?
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10204
>>
>> Thanks!
>>
>> On Aug 10, 2010, at 8:14 AM, Christian Moe 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
>>
>> - Carsten
>>
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 15:06 ` Eric Schulte
@ 2010-08-10 18:38 ` Christian Moe
2010-08-10 21:39 ` David Maus
0 siblings, 1 reply; 33+ messages in thread
From: Christian Moe @ 2010-08-10 18:38 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
Hi, Eric,
Thanks for trying this out -- I should have taken the trouble to write
out sample code myself.
> Just for completeness I'm adding an example of a color handler which can
> be added to a users config to enable colorization of exported text to
> html and latex.
>
> --8<---------------cut here---------------start------------->8---
> (org-add-link-type
> "color" nil
> (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)))))
> --8<---------------cut here---------------end--------------->8---
>
A drawback with using links for markup is that the user sees things that
look like links, but do nothing when clicked, except give error messages.
So instead of setting the third argument -- the "follow" function -- to
nil, I'd flash the user an informative message, e.g.
--8<---------------cut here---------------start------------->8---
(org-add-link-type
"color"
(lambda (path)
(message
(format "This link adds %s color but goes nowhere" 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)))))
--8<---------------cut here---------------end--------------->8---
Yours,
Christian
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 18:38 ` Christian Moe
@ 2010-08-10 21:39 ` David Maus
2010-08-10 23:02 ` Christian Moe
0 siblings, 1 reply; 33+ messages in thread
From: David Maus @ 2010-08-10 21:39 UTC (permalink / raw)
To: mail; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1688 bytes --]
Christian Moe wrote:
>Hi, Eric,
>Thanks for trying this out -- I should have taken the trouble to write
>out sample code myself.
>> Just for completeness I'm adding an example of a color handler which can
>> be added to a users config to enable colorization of exported text to
>> html and latex.
>>
>> --8<---------------cut here---------------start------------->8---
>> (org-add-link-type
>> "color" nil
>> (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)))))
>> --8<---------------cut here---------------end--------------->8---
>>
>A drawback with using links for markup is that the user sees things that
>look like links, but do nothing when clicked, except give error messages.
It's not just a drawback but a more fundamental problem: This solution
abolishes the semantics of a fundamental entity, the link. color:red
/means/ something completely different than info:elisp.
I'll need some time to read the proposal about this topic but my
out-of-the-guts impression is, that the distinction between semantics
and markup (or visualization) is not drawn as sharp as it is. For Org
it's all about semantics: If we know what a special sequence of
characters means, we can provide appropriate actions. One possible
action is to provide special colors etc. as a visual aid.
So maybe don't focus on how to /implement/ visualization but on the
general purpose or meaning of what is /visualized/ (!) by distinct
colors.
Best,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 21:39 ` David Maus
@ 2010-08-10 23:02 ` Christian Moe
2010-08-10 23:47 ` Eric Schulte
0 siblings, 1 reply; 33+ messages in thread
From: Christian Moe @ 2010-08-10 23:02 UTC (permalink / raw)
To: David Maus; +Cc: emacs-orgmode
I wrote (against my own suggestion):
>> A drawback with using links for markup is that the user sees things that
>> look like links, but do nothing when clicked, except give error messages.
David Maus wrote:
> It's not just a drawback but a more fundamental problem: This solution
> abolishes the semantics of a fundamental entity, the link. color:red
> /means/ something completely different than info:elisp.
I certainly see that objection. I don't have a strong opinion, I just
hit on the idea of using custom links as a quick hack to do some inline
semantic tagging I wanted, then thought it might be worth considering in
the present discussion, as an alternative to complex new syntaxes.
Quibble: Note that =info:elisp= also means something rather different
from =shell: ls *org=, =elisp: org-agenda=, or
=elisp:(find-file-other-frame "Elisp.org")=.
Okay, so Org-babel might put these link types out of business (and
anyway they unfailingly crash my Emacs 23 for the Mac). But currently
they /are/ defined as Org links, even though "execute this code" does
not mean "follow this link". So the double-bracket syntax seems to have
a broader meaning.
Admittedly, though, all the currently defined link types mean "do
something when clicked", which a =color:red= link does not.
Christian
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 6:14 ` Christian Moe
2010-08-10 7:06 ` Carsten Dominik
@ 2010-08-10 23:14 ` Samuel Wales
2010-08-11 6:03 ` Jan Böcker
1 sibling, 1 reply; 33+ messages in thread
From: Samuel Wales @ 2010-08-10 23:14 UTC (permalink / raw)
To: mail; +Cc: Bastien, Vinh Nguyen, emacs-orgmode, Carsten Dominik
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."
(cond
((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."
(interactive)
;;fixme place point between them
(insert "$[color begin :face myface :label nil]$[color end]"))
On 2010-08-09, Christian Moe <mail@christianmoe.com> 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.
> Emacs-orgmode@gnu.org
> 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.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 23:02 ` Christian Moe
@ 2010-08-10 23:47 ` Eric Schulte
0 siblings, 0 replies; 33+ messages in thread
From: Eric Schulte @ 2010-08-10 23:47 UTC (permalink / raw)
To: mail; +Cc: emacs-orgmode
Christian Moe <mail@christianmoe.com> writes:
[...]
>
> Admittedly, though, all the currently defined link types mean "do
> something when clicked", which a =color:red= link does not.
>
well this may be trivial, but at least it's an action
--8<---------------cut here---------------start------------->8---
(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)))))
--8<---------------cut here---------------end--------------->8---
Best -- Eric
>
> Christian
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 23:14 ` Samuel Wales
@ 2010-08-11 6:03 ` Jan Böcker
0 siblings, 0 replies; 33+ messages in thread
From: Jan Böcker @ 2010-08-11 6:03 UTC (permalink / raw)
To: Samuel Wales; +Cc: Carsten Dominik, Vinh Nguyen, emacs-orgmode, mail, Bastien
On 08/11/2010 01:14 AM, Samuel Wales wrote:
> 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]
>
Why not allow both? If I want to highlight one or two words, maybe I
could use:
$[class :title animals "African swallow"]
Compare this to:
$[class begin :title animals]African swallow$[class end :title animals]
For a few sentences and to get support for nested formatting, I would
definitely want begin-end pairs, too, but if you want to highlight a few
words, being able to put text into the syntax itself makes things a lot
shorter.
As far as I understand it, once a framework for this extensible syntax
is in place, it would not be too hard to support both variants.
BTW, I really like the idea of having extensible syntax in general; this
could also make inline todos a lot less painful. I do not know enough
about elisp and Org to help with the implementation, but if someone
wants to implement this and needs help with testing, I'd be glad to
help. (I wrote my last exam today, so I will have a lot more time to
spare until October.)
Jan
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-10 7:06 ` Carsten Dominik
2010-08-10 9:30 ` Christian Moe
@ 2010-08-11 6:48 ` Dan Davison
2010-08-11 14:32 ` Samuel Wales
1 sibling, 1 reply; 33+ messages in thread
From: Dan Davison @ 2010-08-11 6:48 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Bastien, emacs-orgmode, mail, Vinh Nguyen
Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi,
>
> Can we please first read Samuels post about extensible syntax? Before
> we invent 20 other new syntaxes?
>
> http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10204
May I add this thread to the discussion as an example of another feature
that was suggested as a possible use case for extensible syntax:
http://thread.gmane.org/gmane.emacs.orgmode/24431
This is the feature I currently want most in org-mode: org mode blocks
that behave exactly like org-mode blocks, except that their content in
reality lies in a different file. This would allow org-mode to improve
on its claim of inobtrusiveness: one could collaborate on a code project
without the other people knowing you were using org-mode to manage your
access points into the shared files. Also, I like the corollary, that a
version control system will track the code content in separate files
from the org content.
A related idea is having links with both a start and an end point:
following them would end up in a buffer to the specified region ("window
links" if window wasn't already used for a different meaning).
Any ideas welcome! (there are also ideas in that thread)
Dan
> Thanks!
>
> On Aug 10, 2010, at 8:14 AM, Christian Moe 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
>
> - Carsten
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Re: text color + highlight
2010-08-11 6:48 ` Dan Davison
@ 2010-08-11 14:32 ` Samuel Wales
0 siblings, 0 replies; 33+ messages in thread
From: Samuel Wales @ 2010-08-11 14:32 UTC (permalink / raw)
To: Dan Davison; +Cc: Bastien, emacs-orgmode, mail, Vinh Nguyen, Carsten Dominik
Hi Dan,
I think you might have found the thread to which I had intented to
post my reply that now is in the thread, "extensible syntax example
using link features". Not sure though. The last few paragraphs have
comments on a topic related to this.
Samuel
On 2010-08-10, Dan Davison <davison@stats.ox.ac.uk> wrote:
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Hi,
>>
>> Can we please first read Samuels post about extensible syntax? Before
>> we invent 20 other new syntaxes?
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10204
>
> May I add this thread to the discussion as an example of another feature
> that was suggested as a possible use case for extensible syntax:
>
> http://thread.gmane.org/gmane.emacs.orgmode/24431
>
> This is the feature I currently want most in org-mode: org mode blocks
> that behave exactly like org-mode blocks, except that their content in
> reality lies in a different file. This would allow org-mode to improve
> on its claim of inobtrusiveness: one could collaborate on a code project
> without the other people knowing you were using org-mode to manage your
> access points into the shared files. Also, I like the corollary, that a
> version control system will track the code content in separate files
> from the org content.
>
> A related idea is having links with both a start and an end point:
> following them would end up in a buffer to the specified region ("window
> links" if window wasn't already used for a different meaning).
>
> Any ideas welcome! (there are also ideas in that thread)
>
> Dan
>
>
>> Thanks!
>>
>> On Aug 10, 2010, at 8:14 AM, Christian Moe 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
>>
>> - Carsten
>>
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> 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.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: text color + highlight
2010-08-05 20:42 text color + highlight Vinh Nguyen
2010-08-06 9:18 ` Bastien
@ 2010-09-09 16:15 ` Vinh Nguyen
1 sibling, 0 replies; 33+ messages in thread
From: Vinh Nguyen @ 2010-09-09 16:15 UTC (permalink / raw)
To: emacs-orgmode
I'd like to write a concluding email for this thread for future
searchers to find. This easy solution is brought to you by Eric
Schulte and Christian Moe.
Place the following in your .emacs or init.el file:
;; org-mode color
(org-add-link-type
"color" nil
(lambda (path desc format)p
(cond
((eq format 'html)
(format "<span style=\"color:%s;\">%s</span>" path desc))
((eq format 'latex)
(format "{\\color{%s}%s}" path desc)))))
;; org-mode highlight
(org-add-link-type
"hl" nil
(lambda (path desc format)
(cond
((eq format 'html)
(format "<font style=\"background-color:%s;\">%s</font>" path desc))
((eq format 'latex)
(format "\\colorbox{%s}{%s}" path desc))))) ;; require \usepackage{color}
Examples:
[[color:blue][test this out]]
[[hl:yellow][highlighted text]]
Remarks:
* Pros
- don't need to modify org-mode source (just edit your .emacs)
- use the existing links syntax
* Cons
- cannot be used concurrently or with other formatting
* To Do
- Hopefully it will be implemented via extensible syntax in the
future ($[options mytext])
- highlight and color paragraph or region
-- Vinh
On Thu, Aug 5, 2010 at 1:42 PM, Vinh Nguyen <vinhdizzo@gmail.com> wrote:
> Dear list,
>
> I was wondering if there is an easy way to markup the color of the
> text for html output (and highlight as well). When I prepare meeting
> minutes I'd like to color some things and highlight certain things.
> Right now, I am using emphasizing a major portion of the text. It
> would be great to have colors and highlights to draw attention to
> certain items.
>
> Thanks.
> Vinh
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2010-09-09 16:15 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-05 20:42 text color + highlight Vinh Nguyen
2010-08-06 9:18 ` Bastien
2010-08-06 16:47 ` Vinh Nguyen
2010-08-06 20:28 ` Seweryn
2010-08-06 21:51 ` Eric Schulte
2010-08-06 23:42 ` Vinh Nguyen
2010-08-07 3:15 ` Eric Schulte
2010-08-07 3:57 ` Dan Davison
2010-08-08 14:59 ` Vinh Nguyen
2010-08-08 21:00 ` Eric Schulte
2010-08-09 6:28 ` Carsten Dominik
2010-08-09 7:37 ` Robert Klein
2010-08-09 7:40 ` Robert Klein
2010-08-10 6:14 ` Christian Moe
2010-08-10 7:06 ` Carsten Dominik
2010-08-10 9:30 ` Christian Moe
2010-08-10 15:06 ` Eric Schulte
2010-08-10 18:38 ` Christian Moe
2010-08-10 21:39 ` David Maus
2010-08-10 23:02 ` Christian Moe
2010-08-10 23:47 ` Eric Schulte
2010-08-11 6:48 ` Dan Davison
2010-08-11 14:32 ` Samuel Wales
2010-08-10 23:14 ` Samuel Wales
2010-08-11 6:03 ` Jan Böcker
2010-08-09 6:58 ` Eric Schulte
2010-08-09 7:05 ` Samuel Wales
2010-08-09 5:17 ` Jambunathan K
2010-08-09 5:52 ` Noorul Islam K M
2010-08-07 4:52 ` Nick Dokos
2010-08-07 12:17 ` Sebastian Rose
2010-08-08 17:46 ` Samuel Wales
2010-09-09 16:15 ` Vinh Nguyen
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).