* export to html, colored dates: org-mime export works but org to html does not
@ 2023-02-11 8:27 Uwe Brauer
2023-02-11 8:54 ` Bruno Barbier
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Brauer @ 2023-02-11 8:27 UTC (permalink / raw)
To: emacs-orgmode
Hi
The following drives me a bit crazy.
I have two functions, one for email.
(defun my-color-red-html ()
(interactive)
(while (re-search-forward "#\\([^#]*\\)#" nil t)
(replace-match "<span style=\"color:red\">\\1</span>")))
I put this function into two hooks
(add-hook 'org-mime-html-hook 'my-color-red-html)
(defun my-html-red (text backend info)
(when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string "#\\([^#]*\\)#"
"<span style=\"color:red\">\\1</span>"
text)))
(add-to-list 'org-export-filter-plain-text-functions 'my-html-red)
Now if I have
#<2023-02-11>#
in an email it gets replaced by
<span style="color:red"><span class="timestamp-wrapper"><span class="timestamp"> 11.02.2023 </span></span></span>
But if I have
#<2023-02-11>#
in an org file and export it to html, no color is added to the timestamp.
I don't know how to debug this.
Any idea?
Regards
Uwe Brauer
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 8:27 export to html, colored dates: org-mime export works but org to html does not Uwe Brauer
@ 2023-02-11 8:54 ` Bruno Barbier
2023-02-11 9:07 ` Uwe Brauer
0 siblings, 1 reply; 11+ messages in thread
From: Bruno Barbier @ 2023-02-11 8:54 UTC (permalink / raw)
To: Uwe Brauer, emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
..
> (add-to-list 'org-export-filter-plain-text-functions 'my-html-red)
..
> But if I have
> #<2023-02-11>#
> in an org file and export it to html, no color is added to the timestamp.
>
> I don't know how to debug this.
>
> Any idea?
In org, "<2023-02-11>" is a date, not plain text. Thus, your function
doesn't get called with a text matching your date.
Note that using macros, you could get almost what you want.
#+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
{{{IDATE(<2023-02-11>)}}}
And maybe ther is a way to also customize date format to get rid of the
brackets.
Bruno
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 8:54 ` Bruno Barbier
@ 2023-02-11 9:07 ` Uwe Brauer
2023-02-11 9:58 ` Ihor Radchenko
2023-02-11 10:05 ` Bruno Barbier
0 siblings, 2 replies; 11+ messages in thread
From: Uwe Brauer @ 2023-02-11 9:07 UTC (permalink / raw)
To: Bruno Barbier; +Cc: Uwe Brauer, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]
>>> "BB" == Bruno Barbier <brubar.cs@gmail.com> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
> ..
>> (add-to-list 'org-export-filter-plain-text-functions 'my-html-red)
> ..
>> But if I have
>> #<2023-02-11>#
>> in an org file and export it to html, no color is added to the timestamp.
>>
>> I don't know how to debug this.
>>
>> Any idea?
> In org, "<2023-02-11>" is a date, not plain text. Thus, your function
> doesn't get called with a text matching your date.
> Note that using macros, you could get almost what you want.
> #+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
> {{{IDATE(<2023-02-11>)}}}
> And maybe ther is a way to also customize date format to get rid of the
> brackets.
Thanks, did you test it?
I am asking because for me
#+LANGUAGE:
#+EXPORT_FILE_NAME: /home/oub/Desktop/testdate.html
#+OPTIONS: toc:nil
#+HTML_HEAD_EXTRA: <style> body {font-size:150%}</style>
#+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
* Title {{{<2023-02-11>}}}
{{{(<2023-02-11>)}}}
Does not work when exporting to html, and I have recent developer org
version installed
Uwe
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 9:07 ` Uwe Brauer
@ 2023-02-11 9:58 ` Ihor Radchenko
2023-02-11 10:16 ` Uwe Brauer
2023-02-11 10:05 ` Bruno Barbier
1 sibling, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-02-11 9:58 UTC (permalink / raw)
To: Uwe Brauer; +Cc: Bruno Barbier, emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
>> #+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
>
>> {{{IDATE(<2023-02-11>)}}}
> ...
> * Title {{{<2023-02-11>}}}
> {{{(<2023-02-11>)}}}
>
>
> Does not work when exporting to html, and I have recent developer org
> version installed
You forgot to specify IDATE macro name.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 9:07 ` Uwe Brauer
2023-02-11 9:58 ` Ihor Radchenko
@ 2023-02-11 10:05 ` Bruno Barbier
1 sibling, 0 replies; 11+ messages in thread
From: Bruno Barbier @ 2023-02-11 10:05 UTC (permalink / raw)
To: Uwe Brauer; +Cc: Uwe Brauer, emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
>>>> "BB" == Bruno Barbier <brubar.cs@gmail.com> writes:
>
>> Uwe Brauer <oub@mat.ucm.es> writes:
>> ..
>
>>> (add-to-list 'org-export-filter-plain-text-functions 'my-html-red)
>> ..
>
>>> But if I have
>>> #<2023-02-11>#
>>> in an org file and export it to html, no color is added to the timestamp.
>>>
>>> I don't know how to debug this.
>>>
>>> Any idea?
>
>> In org, "<2023-02-11>" is a date, not plain text. Thus, your function
>> doesn't get called with a text matching your date.
>
>> Note that using macros, you could get almost what you want.
>
>> #+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
>
>> {{{IDATE(<2023-02-11>)}}}
>
>> And maybe ther is a way to also customize date format to get rid of the
>> brackets.
>
> Thanks, did you test it?
> I am asking because for me
I even did! :-)
You need to call the macro named 'IDATE' like this:
* Title {{{IDATE(2023-02-11)}}}
{{{IDATE(2023-02-11)}}}
See:
(info "(org) Macro Replacement")
And it will work for you too.
Bruno
>
> #+LANGUAGE:
> #+EXPORT_FILE_NAME: /home/oub/Desktop/testdate.html
> #+OPTIONS: toc:nil
> #+HTML_HEAD_EXTRA: <style> body {font-size:150%}</style>
> #+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
>
> * Title {{{<2023-02-11>}}}
> {{{(<2023-02-11>)}}}
>
>
> Does not work when exporting to html, and I have recent developer org
> version installed
>
> Uwe
> --
> Warning: Content may be disturbing to some audiences
> I strongly condemn Putin's war of aggression against the Ukraine.
> I support to deliver weapons to Ukraine's military.
> I support the ban of Russia from SWIFT.
> I support the EU membership of the Ukraine.
> https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 9:58 ` Ihor Radchenko
@ 2023-02-11 10:16 ` Uwe Brauer
2023-02-11 10:34 ` Ihor Radchenko
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Brauer @ 2023-02-11 10:16 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Uwe Brauer, Bruno Barbier, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1134 bytes --]
>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>>> #+MACRO: IDATE @@html:<span style="color: red">$1</span>@@
>>
>>> {{{IDATE(<2023-02-11>)}}}
>> ...
>> * Title {{{<2023-02-11>}}}
>> {{{(<2023-02-11>)}}}
>>
>>
>> Does not work when exporting to html, and I have recent developer org
>> version installed
> You forgot to specify IDATE macro name.
Oops that is true. Sorry, Now it works, but it does not do what I expect
I obtain
<span style="color: red"><2023-02-11></span>
But I would like to having the same result org-mime obtains
Namely
<span style="color:green"><span class="timestamp-wrapper"><span class="timestamp"> 11.02.2023 </span></span></span>
Any chance to get that also?
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 10:16 ` Uwe Brauer
@ 2023-02-11 10:34 ` Ihor Radchenko
2023-02-11 11:08 ` Uwe Brauer
0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-02-11 10:34 UTC (permalink / raw)
To: Uwe Brauer; +Cc: Bruno Barbier, emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
> <span style="color: red"><2023-02-11></span>
>
> But I would like to having the same result org-mime obtains
>
> Namely
>
> <span style="color:green"><span class="timestamp-wrapper"><span class="timestamp"> 11.02.2023 </span></span></span>
>
> Any chance to get that also?
#+MACRO: IDATE @@html:<span style="color: red">@@$1@@html:</span>@@
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 10:34 ` Ihor Radchenko
@ 2023-02-11 11:08 ` Uwe Brauer
2023-02-11 11:41 ` Ihor Radchenko
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Brauer @ 2023-02-11 11:08 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Uwe Brauer, Bruno Barbier, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> <span style="color: red"><2023-02-11></span>
>>
>> But I would like to having the same result org-mime obtains
>>
>> Namely
>>
>> <span style="color:green"><span class="timestamp-wrapper"><span class="timestamp"> 11.02.2023 </span></span></span>
>>
>> Any chance to get that also?
> #+MACRO: IDATE @@html:<span style="color: red">@@$1@@html:</span>@@
Thanks but
,----
|
| #+LANGUAGE:
| #+EXPORT_FILE_NAME: /home/oub/Desktop/testdate.html
| #+OPTIONS: toc:nil
| #+HTML_HEAD_EXTRA: <style> body {font-size:150%}</style>
| #+MACRO: IDATE @@html:<span style="color: red">@@$1@@html:</span>@@
|
| * Title <{{{IDATE(2023-02-11)}}}> o {{{IDATE(<2023-02-11>)}}}
|
| Will this work?
| {{{IDATE(<2023-02-11>)}}}
`----
Does not work for me
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 11:08 ` Uwe Brauer
@ 2023-02-11 11:41 ` Ihor Radchenko
[not found] ` <8846480D-F028-4660-B3E8-26FF99F54F23@mat.ucm.es>
0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-02-11 11:41 UTC (permalink / raw)
To: Uwe Brauer; +Cc: Bruno Barbier, emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
> | #+MACRO: IDATE @@html:<span style="color: red">@@$1@@html:</span>@@
> |
> | * Title <{{{IDATE(2023-02-11)}}}> o {{{IDATE(<2023-02-11>)}}}
> |
> | Will this work?
> | {{{IDATE(<2023-02-11>)}}}
> `----
>
> Does not work for me
It does work. It's just that default css style for timestamps sets the
color of its own.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
[not found] ` <8846480D-F028-4660-B3E8-26FF99F54F23@mat.ucm.es>
@ 2023-02-11 14:13 ` Ihor Radchenko
2023-02-11 14:20 ` Uwe Brauer
0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-02-11 14:13 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
[ Adding Org ML back to CC ]
Uwe Brauer <oub@mat.ucm.es> writes:
>>> | Will this work?
>>> | {{{IDATE(<2023-02-11>)}}}
>>> `----
>>>
>>> Does not work for me
>>
>> It does work. It's just that default css style for timestamps sets the
>> color of its own.
>
> Well but then what should I do on a practical level, how can I convince org
> To export with colored time stamps
See "13.9.12 CSS support" section of Org manual.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: export to html, colored dates: org-mime export works but org to html does not
2023-02-11 14:13 ` Ihor Radchenko
@ 2023-02-11 14:20 ` Uwe Brauer
0 siblings, 0 replies; 11+ messages in thread
From: Uwe Brauer @ 2023-02-11 14:20 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
> [ Adding Org ML back to CC ]
> Uwe Brauer <oub@mat.ucm.es> writes:
> See "13.9.12 CSS support" section of Org manual.
Thanks!
#+OPTIONS: html-style:nil
Works, maybe is too blunt, but good enough for me
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-02-11 14:21 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-11 8:27 export to html, colored dates: org-mime export works but org to html does not Uwe Brauer
2023-02-11 8:54 ` Bruno Barbier
2023-02-11 9:07 ` Uwe Brauer
2023-02-11 9:58 ` Ihor Radchenko
2023-02-11 10:16 ` Uwe Brauer
2023-02-11 10:34 ` Ihor Radchenko
2023-02-11 11:08 ` Uwe Brauer
2023-02-11 11:41 ` Ihor Radchenko
[not found] ` <8846480D-F028-4660-B3E8-26FF99F54F23@mat.ucm.es>
2023-02-11 14:13 ` Ihor Radchenko
2023-02-11 14:20 ` Uwe Brauer
2023-02-11 10:05 ` Bruno Barbier
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).