emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
@ 2023-06-07  2:40 dongdigua
  2023-06-14 12:22 ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: dongdigua @ 2023-06-07  2:40 UTC (permalink / raw)
  To: emacs-orgmode

look at this commit:
https://git.sr.ht/~bzg/org-mode/commit/8134e80bdfb55bbce9aecf3f5958a2bd43cc0b63
the document didn't catch up with source code

I encountered this problem in: 
https://emacs-china.org/t/org-emacs-script-org-publish-all/20782
and documented it in: https://dongdigua.github.io/org_export_highlight


--- a/org-faq.org
+++ b/org-faq.org
@@ -3793,7 +3793,7 @@
 options or via global variables. See 
[[https://orgmode.org/manual/Export-settings.html#Export-settings][this 
section]] of the manual for a
 full list.

-** How can I preserve faces when I export an agenda from the command 
line?
+** How can I preserve faces when I export an org file from the command 
line?
    :PROPERTIES:
    :CUSTOM_ID: preserving-faces-during-batch-export
    :END:
@@ -3821,18 +3821,18 @@
 definitions. If you'd like to use more complex styles, you'll have to
 make sure that the export process only assigns classes instead of
 direct color values. This can be done by binding the variable
-=org-export-htmlize-output-style= to =css= for the duration of the
+=org-html-htmlize-output-style= to =css= for the duration of the
 export, for example with

 : emacs -batch -l ~/.emacs
-: -eval '(let ((org-export-htmlize-generate-css (quote css)))
+: -eval '(let ((org-html-htmlize-generate-css (quote css)))
 : (org-batch-agenda "e"))'

 Then you can use a style file to make these classes look any way you
 like. To generate face definitions for a CSS file based on any faces
 you are currently using in Emacs, you can use the following command:

-: M-x org-export-htmlize-generate-css RET
+: M-x org-html-htmlize-generate-css RET

 This will generate a =<style>...</style>= section, the content of
 which you can add to your style file.
 ---
 https://dongdigua.github.io





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

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
  2023-06-07  2:40 dongdigua
@ 2023-06-14 12:22 ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2023-06-14 12:22 UTC (permalink / raw)
  To: dongdigua; +Cc: emacs-orgmode

dongdigua <dongdigua@outlook.com> writes:

> look at this commit:
> https://git.sr.ht/~bzg/org-mode/commit/8134e80bdfb55bbce9aecf3f5958a2bd43cc0b63
> the document didn't catch up with source code
>
> I encountered this problem in: 
> https://emacs-china.org/t/org-emacs-script-org-publish-all/20782
> and documented it in: https://dongdigua.github.io/org_export_highlight

Thanks for the patch! Looks good, but I cannot apply it.
May you please format the patch using git format-patch or git
send-email? See https://orgmode.org/worg/org-contribute.html#patches

-- 
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] 8+ messages in thread

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
@ 2023-06-28 15:29 dongdigua
  2023-06-28 17:06 ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: dongdigua @ 2023-06-28 15:29 UTC (permalink / raw)
  To: yantar92; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 44 bytes --]

sorry, my email client wrapped the lines




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-faq.org-rename-org-export-htmlize-to-org-html-ht.patch --]
[-- Type: text/x-patch, Size: 2295 bytes --]

From 0de831fb611c89c1a2be4825a8e28999fcf8e526 Mon Sep 17 00:00:00 2001
From: dongdigua <dongdigua@outlook.com>
Date: Wed, 28 Jun 2023 23:16:27 +0800
Subject: [PATCH] org-faq.org: rename org-export-htmlize-* to
 org-html-htmlize-*

look at this commit:
https://git.sr.ht/~bzg/org-mode/commit/8134e80bdfb55bbce9aecf3f5958a2bd43cc0b63
the document didn't catch up with source code

I encountered this problem in:
https://emacs-china.org/t/org-emacs-script-org-publish-all/20782
and documented it in: https://dongdigua.github.io/org_export_highlight
---
 org-faq.org | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/org-faq.org b/org-faq.org
index ab66139..3efebd1 100644
--- a/org-faq.org
+++ b/org-faq.org
@@ -3793,7 +3793,7 @@ There is a whole host of export options you can set with an in-buffer
 options or via global variables. See [[https://orgmode.org/manual/Export-settings.html#Export-settings][this section]] of the manual for a
 full list.
 
-** How can I preserve faces when I export an agenda from the command line?
+** How can I preserve faces when I export an org file from the command line?
    :PROPERTIES:
    :CUSTOM_ID: preserving-faces-during-batch-export
    :END:
@@ -3821,18 +3821,18 @@ does not have a display and therefore only rudimentary face
 definitions.  If you'd like to use more complex styles, you'll have to
 make sure that the export process only assigns classes instead of
 direct color values.  This can be done by binding the variable
-=org-export-htmlize-output-style= to =css= for the duration of the
+=org-html-htmlize-output-style= to =css= for the duration of the
 export, for example with
 
 : emacs -batch -l ~/.emacs
-:   -eval '(let ((org-export-htmlize-generate-css (quote css)))
+:   -eval '(let ((org-html-htmlize-generate-css (quote css)))
 :            (org-batch-agenda "e"))'
 
 Then you can use a style file to make these classes look any way you
 like.  To generate face definitions for a CSS file based on any faces
 you are currently using in Emacs, you can use the following command:
 
-: M-x org-export-htmlize-generate-css RET
+: M-x org-html-htmlize-generate-css RET
 
 This will generate a =<style>...</style>= section, the content of
 which you can add to your style file.
-- 
https://dongdigua.github.io


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

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
  2023-06-28 15:29 [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-* dongdigua
@ 2023-06-28 17:06 ` Ihor Radchenko
  2024-04-04 11:27   ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-06-28 17:06 UTC (permalink / raw)
  To: dongdigua; +Cc: emacs-orgmode

dongdigua <dongdigua@outlook.com> writes:

> sorry, my email client wrapped the lines

Thanks!
I looked into this again, and I can see that the FAQ entry is dubious.

> -** How can I preserve faces when I export an agenda from the command line?
> +** How can I preserve faces when I export an org file from the command line?

Note that the FAQ entry is talking both about exporting Org files and
also exporting agenda - two different code branches.

> @@ -3821,18 +3821,18 @@ does not have a display and therefore only rudimentary face
>  definitions.  If you'd like to use more complex styles, you'll have to
>  make sure that the export process only assigns classes instead of
>  direct color values.  This can be done by binding the variable
> -=org-export-htmlize-output-style= to =css= for the duration of the
> +=org-html-htmlize-output-style= to =css= for the duration of the

`org-html-htmlize-output-type', not "-style".

>  export, for example with
>  
>  : emacs -batch -l ~/.emacs
> -:   -eval '(let ((org-export-htmlize-generate-css (quote css)))
> +:   -eval '(let ((org-html-htmlize-generate-css (quote css)))
>  :            (org-batch-agenda "e"))'

And this example is talking specifically about agenda export, which is
relying on htmlize package. There, the css generation is controlled by
`htmlize-output-type', not by `org-html-htmlize-generate-css'.

So, we need a much more significant rewrite to make this FAQ entry up to
date.

[ org-faq is severely outdated, unfortunately. It would really be welcome
  if some kind soul could review it and update things as needed. ]

>  Then you can use a style file to make these classes look any way you
>  like.  To generate face definitions for a CSS file based on any faces
>  you are currently using in Emacs, you can use the following command:
>  
> -: M-x org-export-htmlize-generate-css RET
> +: M-x org-html-htmlize-generate-css RET
>  
>  This will generate a =<style>...</style>= section, the content of
>  which you can add to your style file.

And in agenda, it will be org-agenda-export-html-style variable that has
to be set.

-- 
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] 8+ messages in thread

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
  2023-06-28 17:06 ` Ihor Radchenko
@ 2024-04-04 11:27   ` Ihor Radchenko
  2024-04-04 19:55     ` Rudolf Adamkovič
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2024-04-04 11:27 UTC (permalink / raw)
  To: dongdigua; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

Ihor Radchenko <yantar92@posteo.net> writes:

> dongdigua <dongdigua@outlook.com> writes:
>
>> sorry, my email client wrapped the lines
>
> Thanks!
> I looked into this again, and I can see that the FAQ entry is dubious.
> ...
> So, we need a much more significant rewrite to make this FAQ entry up to
> date.

See the attached alternative version of the patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-faq.org-How-can-I-preserve-faces.-Update-answer.patch --]
[-- Type: text/x-patch, Size: 3951 bytes --]

From 3d6e938c09f896c9c55575b318829d2ef7d1c9ea Mon Sep 17 00:00:00 2001
Message-ID: <3d6e938c09f896c9c55575b318829d2ef7d1c9ea.1712229941.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Thu, 4 Apr 2024 14:22:01 +0300
Subject: [PATCH] org-faq.org (How can I preserve faces...): Update answer

* org-faq.org (How can I preserve faces when I export an agenda from
the command line?): Fix the answer, making sure that the instructions
actually work on the latest Org mode.

Link: https://list.orgmode.org/orgmode/PS2P216MB113830307EE638A1FF044F55A024A@PS2P216MB1138.KORP216.PROD.OUTLOOK.COM/
---
 org-faq.org | 51 +++++++++++++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/org-faq.org b/org-faq.org
index 3674165c..f2b7d510 100644
--- a/org-faq.org
+++ b/org-faq.org
@@ -3643,41 +3643,48 @@ ** How can I preserve faces when I export an agenda from the command line?
 #+index: Export!Agenda
 #+index: Export!Faces
 
-Normally, when you export an org file or an agenda view from within
-emacs, htmlize will convert your face definitions to direct color css
-styles inlined into each =<span>= object, resulting in an HTML output
-that preserves the general look of your Org buffers and agenda views.
+Normally, when you export an agenda view from within emacs, htmlize
+will convert your face definitions to direct color css styles inlined
+into each =<span>= object, resulting in an HTML output that preserves
+the general look of your Org buffers and agenda views.
 
 Let's say you generate an export from the command line, such as the
 following:
 
-: emacs -batch -l ~/.emacs -eval '(org-batch-agenda "e")'
-
-or
-
-: emacs -batch -l ~/.emacs -eval '(org-publish-all)'
+: emacs -batch -l ~/.emacs.d/init.el \
+: -eval '(progn \
+:         (org-agenda nil "a") \
+:         (org-agenda-write "~/agenda.html"))'
 
 In such an instance, the exported HTML will contain only very basic
 color styles. The reason is that when Emacs is run in batch mode, it
 does not have a display and therefore only rudimentary face
 definitions.  If you'd like to use more complex styles, you'll have to
-make sure that the export process only assigns classes instead of
-direct color values.  This can be done by binding the variable
-=org-export-htmlize-output-style= to =css= for the duration of the
-export, for example with
-
-: emacs -batch -l ~/.emacs
-:   -eval '(let ((org-export-htmlize-generate-css (quote css)))
-:            (org-batch-agenda "e"))'
+supply custom css styles to make these classes look any way you like.
+To generate face definitions for a CSS file based on any faces you are
+currently using in Emacs, you can use the following command:
 
-Then you can use a style file to make these classes look any way you
-like.  To generate face definitions for a CSS file based on any faces
-you are currently using in Emacs, you can use the following command:
+#+begin_src emacs-lisp
+(defun org-html-htmlize-generate-css-for-agenda ()
+  "Create the CSS for all font definitions in the current Emacs session.
+Unlike `org-html-htmlize-generate-css', do not prepend
+`org-html-htmlize-font-prefix' to face names."
+  (interactive)
+  (require 'ox-html)
+  (let ((org-html-htmlize-font-prefix ""))
+    (org-html-htmlize-generate-css)))
+#+end_src
 
-: M-x org-export-htmlize-generate-css RET
+: M-x org-html-htmlize-generate-css-for-agenda RET
 
 This will generate a =<style>...</style>= section, the content of
-which you can add to your style file.
+which you can manually copy to your style file:
+
+: emacs -batch -l ~/.emacs.d/init.el \
+: -eval '(let ((org-agenda-export-html-style \
+:               "<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">")) \
+:         (org-agenda nil "a") \
+:         (org-agenda-write "~/agenda.html"))'
 
 ** How can I avoid dark color background when exporting agenda to ps format?
    :PROPERTIES:
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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 related	[flat|nested] 8+ messages in thread

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
  2024-04-04 11:27   ` Ihor Radchenko
@ 2024-04-04 19:55     ` Rudolf Adamkovič
  2024-04-05 13:58       ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Rudolf Adamkovič @ 2024-04-04 19:55 UTC (permalink / raw)
  To: Ihor Radchenko, dongdigua; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

While you are on it, ...

> +Normally, when you export an agenda view from within emacs, htmlize
> +will convert your face definitions to direct color css styles inlined

emacs -> Emacs (per English, and to match Org in the same sentence)
css -> CSS (per English, and to match HTML in the same sentence)

> +supply custom css styles to make these classes look any way you like.
> +To generate face definitions for a CSS file based on any faces you are
> +currently using in Emacs, you can use the following command:

css -> CSS (per English, and to match CSS in the next sentence)

Rudy
-- 
"It is far better to have a question that can't be answered than an
answer that can't be questioned."  --- Carl Sagan

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
Studenohorská 25, 84103 Bratislava, Slovakia, European Union


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

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
  2024-04-04 19:55     ` Rudolf Adamkovič
@ 2024-04-05 13:58       ` Ihor Radchenko
  2024-04-12 18:00         ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2024-04-05 13:58 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: dongdigua, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Rudolf Adamkovič <rudolf@adamkovic.org> writes:

> While you are on it, ...
> ...

See the attached updated patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-org-faq.org-How-can-I-preserve-faces.-Update-answ.patch --]
[-- Type: text/x-patch, Size: 3954 bytes --]

From b4942ba19db7e7b2c250e3dc2c5b0c6b6b7346d0 Mon Sep 17 00:00:00 2001
Message-ID: <b4942ba19db7e7b2c250e3dc2c5b0c6b6b7346d0.1712325451.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Thu, 4 Apr 2024 14:22:01 +0300
Subject: [PATCH v2] org-faq.org (How can I preserve faces...): Update answer

* org-faq.org (How can I preserve faces when I export an agenda from
the command line?): Fix the answer, making sure that the instructions
actually work on the latest Org mode.

Link: https://list.orgmode.org/orgmode/PS2P216MB113830307EE638A1FF044F55A024A@PS2P216MB1138.KORP216.PROD.OUTLOOK.COM/
---
 org-faq.org | 51 +++++++++++++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/org-faq.org b/org-faq.org
index 3674165c..97c85c23 100644
--- a/org-faq.org
+++ b/org-faq.org
@@ -3643,41 +3643,48 @@ ** How can I preserve faces when I export an agenda from the command line?
 #+index: Export!Agenda
 #+index: Export!Faces
 
-Normally, when you export an org file or an agenda view from within
-emacs, htmlize will convert your face definitions to direct color css
-styles inlined into each =<span>= object, resulting in an HTML output
-that preserves the general look of your Org buffers and agenda views.
+Normally, when you export an agenda view from within Emacs, htmlize
+will convert your face definitions to direct color CSS styles inlined
+into each =<span>= object, resulting in an HTML output that preserves
+the general look of your Org buffers and agenda views.
 
 Let's say you generate an export from the command line, such as the
 following:
 
-: emacs -batch -l ~/.emacs -eval '(org-batch-agenda "e")'
-
-or
-
-: emacs -batch -l ~/.emacs -eval '(org-publish-all)'
+: emacs -batch -l ~/.emacs.d/init.el \
+: -eval '(progn \
+:         (org-agenda nil "a") \
+:         (org-agenda-write "~/agenda.html"))'
 
 In such an instance, the exported HTML will contain only very basic
 color styles. The reason is that when Emacs is run in batch mode, it
 does not have a display and therefore only rudimentary face
 definitions.  If you'd like to use more complex styles, you'll have to
-make sure that the export process only assigns classes instead of
-direct color values.  This can be done by binding the variable
-=org-export-htmlize-output-style= to =css= for the duration of the
-export, for example with
-
-: emacs -batch -l ~/.emacs
-:   -eval '(let ((org-export-htmlize-generate-css (quote css)))
-:            (org-batch-agenda "e"))'
+supply custom CSS styles to make these classes look any way you like.
+To generate face definitions for a CSS file based on any faces you are
+currently using in Emacs, you can use the following command:
 
-Then you can use a style file to make these classes look any way you
-like.  To generate face definitions for a CSS file based on any faces
-you are currently using in Emacs, you can use the following command:
+#+begin_src emacs-lisp
+(defun org-html-htmlize-generate-css-for-agenda ()
+  "Create the CSS for all font definitions in the current Emacs session.
+Unlike `org-html-htmlize-generate-css', do not prepend
+`org-html-htmlize-font-prefix' to face names."
+  (interactive)
+  (require 'ox-html)
+  (let ((org-html-htmlize-font-prefix ""))
+    (org-html-htmlize-generate-css)))
+#+end_src
 
-: M-x org-export-htmlize-generate-css RET
+: M-x org-html-htmlize-generate-css-for-agenda RET
 
 This will generate a =<style>...</style>= section, the content of
-which you can add to your style file.
+which you can manually copy to your style file:
+
+: emacs -batch -l ~/.emacs.d/init.el \
+: -eval '(let ((org-agenda-export-html-style \
+:               "<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">")) \
+:         (org-agenda nil "a") \
+:         (org-agenda-write "~/agenda.html"))'
 
 ** How can I avoid dark color background when exporting agenda to ps format?
    :PROPERTIES:
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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 related	[flat|nested] 8+ messages in thread

* Re: [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-*
  2024-04-05 13:58       ` Ihor Radchenko
@ 2024-04-12 18:00         ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2024-04-12 18:00 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: dongdigua, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Rudolf Adamkovič <rudolf@adamkovic.org> writes:
>
>> While you are on it, ...
>> ...
>
> See the attached updated patch.

Applied, onto master.
https://git.sr.ht/~bzg/worg/commit/dcb2c11c

-- 
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] 8+ messages in thread

end of thread, other threads:[~2024-04-12 18:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28 15:29 [PATCH] org-faq.org: rename org-export-htmlize-* options to org-html-htmlize-* dongdigua
2023-06-28 17:06 ` Ihor Radchenko
2024-04-04 11:27   ` Ihor Radchenko
2024-04-04 19:55     ` Rudolf Adamkovič
2024-04-05 13:58       ` Ihor Radchenko
2024-04-12 18:00         ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2023-06-07  2:40 dongdigua
2023-06-14 12:22 ` Ihor Radchenko

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).