emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to export to the simplest possible HTML?
@ 2023-05-30  3:47 Marcin Borkowski
  2023-05-30  6:21 ` Ihor Radchenko
  2023-05-30 15:32 ` Max Nikulin
  0 siblings, 2 replies; 19+ messages in thread
From: Marcin Borkowski @ 2023-05-30  3:47 UTC (permalink / raw)
  To: Org-Mode mailing list

Hello everyone,

I'd like to export an Org buffer (or portion of it) to the simplest HTML
possible, prgrammatically.  For example, I only want the body, I don't
want any generated IDs, and I don't want the ToC.  I tried this:

(org-html-export-as-html nil nil nil t '(org-export-with-toc nil))

but the ToC still appears in the output.  Also, I'd prefer to do it
a bit "less interactively" - for example, setting the current buffer to
the one with export results is unnecessary for me, since I'm going to
call my exporting function in a loop over many elements.  I tried

(org-export-with-backend 'html (org-element-at-point (point)))

but it errored out:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  org-html-headline((headline (:raw-value ...)) ...)
  org-export-with-backend(html (headline (:raw-value ...)))

I also want to supply my custom formatting for italics & friends, so
that

This is /italic/.

can become e.g.

This is <span class="emphasize">italic</span>.

I'm considering writing a custom (derived) export backend, but maybe
that is an overkill?  Any ideas?

TIA,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-05-30  3:47 How to export to the simplest possible HTML? Marcin Borkowski
@ 2023-05-30  6:21 ` Ihor Radchenko
  2023-05-30 18:45   ` Marcin Borkowski
  2023-05-30 15:32 ` Max Nikulin
  1 sibling, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2023-05-30  6:21 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> ... I tried this:
>
> (org-html-export-as-html nil nil nil t '(org-export-with-toc nil))

You need (org-html-export-as-html nil nil nil t '(:with-toc nil))
See `org-export-options-alist'.

> but the ToC still appears in the output.  Also, I'd prefer to do it
> a bit "less interactively" - for example, setting the current buffer to
> the one with export results is unnecessary for me, since I'm going to
> call my exporting function in a loop over many elements.  I tried
>
> (org-export-with-backend 'html (org-element-at-point (point)))

Just use `org-export-as'.

> but it errored out:
>
> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>   org-html-headline((headline (:raw-value ...)) ...)
>   org-export-with-backend(html (headline (:raw-value ...)))

Because `org-element-at-point' does not return a parsed subtree. Just a
partial one without children.

> I also want to supply my custom formatting for italics & friends, so
> that
>
> This is /italic/.
>
> can become e.g.
>
> This is <span class="emphasize">italic</span>.
>
> I'm considering writing a custom (derived) export backend, but maybe
> that is an overkill?  Any ideas?

Derived backend will be the easiest. It is not even hard. Just a few
lines of code.

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

* Re: How to export to the simplest possible HTML?
  2023-05-30  3:47 How to export to the simplest possible HTML? Marcin Borkowski
  2023-05-30  6:21 ` Ihor Radchenko
@ 2023-05-30 15:32 ` Max Nikulin
  2023-05-30 18:48   ` Marcin Borkowski
  1 sibling, 1 reply; 19+ messages in thread
From: Max Nikulin @ 2023-05-30 15:32 UTC (permalink / raw)
  To: emacs-orgmode

On 30/05/2023 10:47, Marcin Borkowski wrote:
> since I'm going to
> call my exporting function in a loop over many elements.  I tried
> 
> (org-export-with-backend 'html (org-element-at-point (point)))

There is `org-export-string-as', but likely it is not suitable for you. 
My guess is that you are going to export headings (blog posts) to 
separate html files.

> This is /italic/.
> 
> can become e.g.
> 
> This is <span class="emphasize">italic</span>.

I am curious whether <em> is more friendly to screen readers
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em

> I'm considering writing a custom (derived) export backend, but maybe
> that is an overkill?  Any ideas?

I just have noticed

(defcustom org-html-text-markup-alist
   '((bold . "<b>%s</b>")
     (code . "<code>%s</code>")
     (italic . "<i>%s</i>")
     (strike-through . "<del>%s</del>")
     (underline . "<span class=\"underline\">%s</span>")
     (verbatim . "<code>%s</code>"))
   "Alist of HTML expressions to convert text markup.

You may look into ox-html customizations such as
(:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
(:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)

I have never tried ox-slimhtml:
Laszlo Elo. ox-slimhtml. Mon, 14 Dec 2020 00:48:27 -0500. 
https://list.orgmode.org/41D2E10D-BCFF-4604-8417-B499514AF904@bald.cat



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

* Re: How to export to the simplest possible HTML?
  2023-05-30  6:21 ` Ihor Radchenko
@ 2023-05-30 18:45   ` Marcin Borkowski
  2023-06-03  3:36     ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2023-05-30 18:45 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-05-30, at 08:21, Ihor Radchenko <yantar92@posteo.net> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> ... I tried this:
>>
>> (org-html-export-as-html nil nil nil t '(org-export-with-toc nil))
>
> You need (org-html-export-as-html nil nil nil t '(:with-toc nil))
> See `org-export-options-alist'.

Thanks.  So apparently I mixed "options" with "variables".

>> but the ToC still appears in the output.  Also, I'd prefer to do it
>> a bit "less interactively" - for example, setting the current buffer to
>> the one with export results is unnecessary for me, since I'm going to
>> call my exporting function in a loop over many elements.  I tried
>>
>> (org-export-with-backend 'html (org-element-at-point (point)))
>
> Just use `org-export-as'.

Thanks again, I didn't know about that function!

>> but it errored out:
>>
>> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>>   org-html-headline((headline (:raw-value ...)) ...)
>>   org-export-with-backend(html (headline (:raw-value ...)))
>
> Because `org-element-at-point' does not return a parsed subtree. Just a
> partial one without children.

I don't understand this distinction, but now that I know about
`org-export-as' it doesn't matter.

>> I also want to supply my custom formatting for italics & friends, so
>> that
>>
>> This is /italic/.
>>
>> can become e.g.
>>
>> This is <span class="emphasize">italic</span>.
>>
>> I'm considering writing a custom (derived) export backend, but maybe
>> that is an overkill?  Any ideas?
>
> Derived backend will be the easiest. It is not even hard. Just a few
> lines of code.

I know, I wrote one a few years ago, but I still think it might be a bit
overhead.  Well, I'll definitely consider that option.

Thanks,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-05-30 15:32 ` Max Nikulin
@ 2023-05-30 18:48   ` Marcin Borkowski
  2023-06-08 15:18     ` Thomas Redelberger
  0 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2023-05-30 18:48 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode


On 2023-05-30, at 17:32, Max Nikulin <manikulin@gmail.com> wrote:

> On 30/05/2023 10:47, Marcin Borkowski wrote:
>> since I'm going to
>> call my exporting function in a loop over many elements.  I tried
>> (org-export-with-backend 'html (org-element-at-point (point)))
>
> There is `org-export-string-as', but likely it is not suitable for
> you. My guess is that you are going to export headings (blog posts) to
> separate html files.

Correct, dear Holmes. ;-)

>> This is /italic/.
>> can become e.g.
>> This is <span class="emphasize">italic</span>.
>
> I am curious whether <em> is more friendly to screen readers
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em

Good point.  You're right, I'll probably go with `<em>' then.  (The
reason I wanted `<span>' was that I wan't somewhat atypical styling,
namely letterspace.  But of course css magic can make `<em>' do this,
too.)

>> I'm considering writing a custom (derived) export backend, but maybe
>> that is an overkill?  Any ideas?
>
> I just have noticed
>
> (defcustom org-html-text-markup-alist
>   '((bold . "<b>%s</b>")
>     (code . "<code>%s</code>")
>     (italic . "<i>%s</i>")
>     (strike-through . "<del>%s</del>")
>     (underline . "<span class=\"underline\">%s</span>")
>     (verbatim . "<code>%s</code>"))
>   "Alist of HTML expressions to convert text markup.
>
> You may look into ox-html customizations such as
> (:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
> (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
>
> I have never tried ox-slimhtml:
> Laszlo Elo. ox-slimhtml. Mon, 14 Dec 2020 00:48:27
> -0500. https://list.orgmode.org/41D2E10D-BCFF-4604-8417-B499514AF904@bald.cat

Ah, that looks interesting, too.

Thanks!

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-05-30 18:45   ` Marcin Borkowski
@ 2023-06-03  3:36     ` Marcin Borkowski
  2023-06-03  5:08       ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-03  3:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-05-30, at 20:45, Marcin Borkowski <mbork@mbork.pl> wrote:

>> Just use `org-export-as'.
>
> Thanks again, I didn't know about that function!

I tried playing around with it, but it has one drawback - I can't use it
to export a subtree containing a link to another subtree, and that is
something I will definitely need.  (I can see why it works that way -
for that to work, I have to somehow make sure that subtrees containing
targets of those links are also exported at some point in time - but
I need another behavior...)

My current idea is to go with a custom exporter derived from the HTML
one, indeed.  Is there a better approach?

Best,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-06-03  3:36     ` Marcin Borkowski
@ 2023-06-03  5:08       ` Ihor Radchenko
  2023-06-03  6:24         ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2023-06-03  5:08 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2023-05-30, at 20:45, Marcin Borkowski <mbork@mbork.pl> wrote:
>
>>> Just use `org-export-as'.
>>
>> Thanks again, I didn't know about that function!
>
> I tried playing around with it, but it has one drawback - I can't use it
> to export a subtree containing a link to another subtree, and that is
> something I will definitely need.  (I can see why it works that way -
> for that to work, I have to somehow make sure that subtrees containing
> targets of those links are also exported at some point in time - but
> I need another behavior...)

AFAIR, ox-hugo implements what you want here.

> My current idea is to go with a custom exporter derived from the HTML
> one, indeed.  Is there a better approach?

You can loop over links in the exported subtree and export any extra if
necessary. For example, in the `org-export-filter-parse-tree-functions'.

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

* Re: How to export to the simplest possible HTML?
  2023-06-03  5:08       ` Ihor Radchenko
@ 2023-06-03  6:24         ` Marcin Borkowski
  2023-06-03  8:37           ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-03  6:24 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-06-03, at 07:08, Ihor Radchenko <yantar92@posteo.net> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> On 2023-05-30, at 20:45, Marcin Borkowski <mbork@mbork.pl> wrote:
>>
>>>> Just use `org-export-as'.
>>>
>>> Thanks again, I didn't know about that function!
>>
>> I tried playing around with it, but it has one drawback - I can't use it
>> to export a subtree containing a link to another subtree, and that is
>> something I will definitely need.  (I can see why it works that way -
>> for that to work, I have to somehow make sure that subtrees containing
>> targets of those links are also exported at some point in time - but
>> I need another behavior...)
>
> AFAIR, ox-hugo implements what you want here.

I know, but after a long consideration and some experiments I decided
against Hugo - I want something (even) simpler and I plan to cook myself
a pure Elisp solution.

>> My current idea is to go with a custom exporter derived from the HTML
>> one, indeed.  Is there a better approach?
>
> You can loop over links in the exported subtree and export any extra if
> necessary. For example, in the `org-export-filter-parse-tree-functions'.

Interesting.  The main problem with it is that the docstring is rather
concise and I don't understand it well enough to use it.  I will perform
some experiments, but if they fail, I think a derived exporter with
a custom link-exporting function can also be helpful.

Thanks,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-06-03  6:24         ` Marcin Borkowski
@ 2023-06-03  8:37           ` Ihor Radchenko
  2023-06-24 13:25             ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2023-06-03  8:37 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

>> You can loop over links in the exported subtree and export any extra if
>> necessary. For example, in the `org-export-filter-parse-tree-functions'.
>
> Interesting.  The main problem with it is that the docstring is rather
> concise and I don't understand it well enough to use it.

Org export passes the actual parsed and filtered AST that will be
exported to `org-export-filter-parse-tree-functions'. You can modify and
traverse the parse tree as you need.

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

* Re: How to export to the simplest possible HTML?
  2023-05-30 18:48   ` Marcin Borkowski
@ 2023-06-08 15:18     ` Thomas Redelberger
  2023-06-24 15:04       ` Max Nikulin
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Redelberger @ 2023-06-08 15:18 UTC (permalink / raw)
  To: emacs-orgmode

Dear Marcin and everybody,

I had a similar requirement for "simplest HTML" and have documented how I tackled this under
  http://web222.webclient5.de/doc/swdev/emacs/orgmode/html

In summary, it is
- a few settings in init.el:
   + org-html-text-markup-alist similar to below
   + setting org-export-allow-bind-keywords to t
- seeting quite some org variables via in-buffer settings
- elisp to steer a final XSLT transformation of the generated HTML


I had coded a derived export back-end (for Emacs 25.1) and used it quite for some time. When I moved to Emacs 27.2, the derived back-end did not work any more, hence I changed to above aproach.

Best regards
Thomas


Am 2023-05-30 um 20:48 schrieb Marcin Borkowski:
> 
> On 2023-05-30, at 17:32, Max Nikulin <manikulin@gmail.com> wrote:
> 
>> On 30/05/2023 10:47, Marcin Borkowski wrote:
>>> since I'm going to
>>> call my exporting function in a loop over many elements.  I tried
>>> (org-export-with-backend 'html (org-element-at-point (point)))
>>
>> There is `org-export-string-as', but likely it is not suitable for
>> you. My guess is that you are going to export headings (blog posts) to
>> separate html files.
> 
> Correct, dear Holmes. ;-)
> 
>>> This is /italic/.
>>> can become e.g.
>>> This is <span class="emphasize">italic</span>.
>>
>> I am curious whether <em> is more friendly to screen readers
>> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em
> 
> Good point.  You're right, I'll probably go with `<em>' then.  (The
> reason I wanted `<span>' was that I wan't somewhat atypical styling,
> namely letterspace.  But of course css magic can make `<em>' do this,
> too.)
> 
>>> I'm considering writing a custom (derived) export backend, but maybe
>>> that is an overkill?  Any ideas?
>>
>> I just have noticed
>>
>> (defcustom org-html-text-markup-alist
>>    '((bold . "<b>%s</b>")
>>      (code . "<code>%s</code>")
>>      (italic . "<i>%s</i>")
>>      (strike-through . "<del>%s</del>")
>>      (underline . "<span class=\"underline\">%s</span>")
>>      (verbatim . "<code>%s</code>"))
>>    "Alist of HTML expressions to convert text markup.
>>
>> You may look into ox-html customizations such as
>> (:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
>> (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
>>
>> I have never tried ox-slimhtml:
>> Laszlo Elo. ox-slimhtml. Mon, 14 Dec 2020 00:48:27
>> -0500. https://list.orgmode.org/41D2E10D-BCFF-4604-8417-B499514AF904@bald.cat
> 
> Ah, that looks interesting, too.
> 
> Thanks!
> 


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

* Re: How to export to the simplest possible HTML?
@ 2023-06-10  8:25 Thomas Redelberger
  2023-06-24 13:16 ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Redelberger @ 2023-06-10  8:25 UTC (permalink / raw)
  To: emacs-orgmode

Dear Marcin and everybody,

I had a similar requirement for "simplest HTML" and have documented (incl. source code) how I tackled this under
  http://web222.webclient5.de/doc/swdev/emacs/orgmode/html

In summary, my solution is
- a few settings in init.el:
   + org-html-text-markup-alist similar to below
   + setting org-export-allow-bind-keywords to t
- setting quite some org variables in-buffer/in the org file
- elisp to steer a final XSLT transformation of the generated HTML


I had coded a derived HTML export back-end (for Emacs 25.1) and used it quite for some time.
When I moved to Emacs 27.2, the derived back-end did not work any more, hence I changed to above approach.

Best regards
Thomas


On 2023-05-30, at 20:48, Marcin Borkowski wrote:
>
> On 2023-05-30, at 17:32, Max Nikulin <manikulin@gmail.com> wrote:
>
>> On 30/05/2023 10:47, Marcin Borkowski wrote:
>>> since I'm going to
>>> call my exporting function in a loop over many elements.  I tried
>>> (org-export-with-backend 'html (org-element-at-point (point)))
>>
>> There is `org-export-string-as', but likely it is not suitable for
>> you. My guess is that you are going to export headings (blog posts) to
>> separate html files.
>
> Correct, dear Holmes. 😉
>
>>> This is /italic/.
>>> can become e.g.
>>> This is <span class="emphasize">italic</span>.
>>
>> I am curious whether <em> is more friendly to screen readers
>> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em
>
> Good point.  You're right, I'll probably go with `<em>' then.  (The
> reason I wanted `<span>' was that I wan't somewhat atypical styling,
> namely letterspace.  But of course css magic can make `<em>' do this,
> too.)
>
>>> I'm considering writing a custom (derived) export backend, but maybe
>>> that is an overkill?  Any ideas?
>>
>> I just have noticed
>>
>> (defcustom org-html-text-markup-alist
>>    '((bold . "<b>%s</b>")
>>      (code . "<code>%s</code>")
>>      (italic . "<i>%s</i>")
>>      (strike-through . "<del>%s</del>")
>>      (underline . "<span class=\"underline\">%s</span>")
>>      (verbatim . "<code>%s</code>"))
>>    "Alist of HTML expressions to convert text markup.
>>
>> You may look into ox-html customizations such as
>> (:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
>> (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
>>
>> I have never tried ox-slimhtml:
>> Laszlo Elo. ox-slimhtml. Mon, 14 Dec 2020 00:48:27
>> -0500. https://list.orgmode.org/41D2E10D-BCFF-4604-8417-B499514AF904@bald.cat
>
> Ah, that looks interesting, too.
>
> Thanks!
>


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

* Re: How to export to the simplest possible HTML?
  2023-06-10  8:25 Thomas Redelberger
@ 2023-06-24 13:16 ` Marcin Borkowski
  0 siblings, 0 replies; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-24 13:16 UTC (permalink / raw)
  To: Thomas Redelberger; +Cc: emacs-orgmode


On 2023-06-10, at 10:25, Thomas Redelberger <redetho@gmx.de> wrote:

> Dear Marcin and everybody,
>
> I had a similar requirement for "simplest HTML" and have documented (incl. source code) how I tackled this under
>  http://web222.webclient5.de/doc/swdev/emacs/orgmode/html
>
> In summary, my solution is
> - a few settings in init.el:
>   + org-html-text-markup-alist similar to below
>   + setting org-export-allow-bind-keywords to t
> - setting quite some org variables in-buffer/in the org file
> - elisp to steer a final XSLT transformation of the generated HTML
>
>
> I had coded a derived HTML export back-end (for Emacs 25.1) and used it quite for some time.
> When I moved to Emacs 27.2, the derived back-end did not work any more, hence I changed to above approach.

Thanks.

I settled for a custom (very simple) derived exporter and
`org-export-as` with `body-only' set to `t' (and I wrap the generated
HTML in tags like `<html>' and `<body>' myself then).

Best,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-06-03  8:37           ` Ihor Radchenko
@ 2023-06-24 13:25             ` Marcin Borkowski
  2023-06-24 13:34               ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-24 13:25 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-06-03, at 10:37, Ihor Radchenko <yantar92@posteo.net> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>>> You can loop over links in the exported subtree and export any extra if
>>> necessary. For example, in the `org-export-filter-parse-tree-functions'.
>>
>> Interesting.  The main problem with it is that the docstring is rather
>> concise and I don't understand it well enough to use it.
>
> Org export passes the actual parsed and filtered AST that will be
> exported to `org-export-filter-parse-tree-functions'. You can modify and
> traverse the parse tree as you need.

Yeah, that I do understand.  Problem is, I don't know how the AST is
structured, what functions operate on it etc.  I am aware that I could
learn all of that from the source and experimenting, but it would
probably be a bit time-consuming, and other ways turned out to be much
easier (which means better for me – I want something simple).

As an aside, inspecting deeply nested structures in Elisp seems a pain
in the neck.  Does anyone know a good method of interactively inspecting
them?  My usual approach (Edebug) is next to useless when the value
displayed in the minibuffer is a deeply nested list with dozens or
hundreds of elements at different levels...

TIA,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-06-24 13:25             ` Marcin Borkowski
@ 2023-06-24 13:34               ` Ihor Radchenko
  2023-06-24 13:48                 ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2023-06-24 13:34 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

>> Org export passes the actual parsed and filtered AST that will be
>> exported to `org-export-filter-parse-tree-functions'. You can modify and
>> traverse the parse tree as you need.
>
> Yeah, that I do understand.  Problem is, I don't know how the AST is
> structured, what functions operate on it etc.  I am aware that I could
> learn all of that from the source and experimenting, but it would
> probably be a bit time-consuming, and other ways turned out to be much
> easier (which means better for me – I want something simple).

I tried to provide a summary in my recent patch.
https://list.orgmode.org/874jnudps5.fsf@localhost/3-a.txt
You can also refer to https://orgmode.org/worg/dev/org-element-api.html

> As an aside, inspecting deeply nested structures in Elisp seems a pain
> in the neck.  Does anyone know a good method of interactively inspecting
> them?

https://github.com/mmontone/emacs-inspector

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

* Re: How to export to the simplest possible HTML?
  2023-06-24 13:34               ` Ihor Radchenko
@ 2023-06-24 13:48                 ` Marcin Borkowski
  0 siblings, 0 replies; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-24 13:48 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-06-24, at 15:34, Ihor Radchenko <yantar92@posteo.net> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>>> Org export passes the actual parsed and filtered AST that will be
>>> exported to `org-export-filter-parse-tree-functions'. You can modify and
>>> traverse the parse tree as you need.
>>
>> Yeah, that I do understand.  Problem is, I don't know how the AST is
>> structured, what functions operate on it etc.  I am aware that I could
>> learn all of that from the source and experimenting, but it would
>> probably be a bit time-consuming, and other ways turned out to be much
>> easier (which means better for me – I want something simple).
>
> I tried to provide a summary in my recent patch.
> https://list.orgmode.org/874jnudps5.fsf@localhost/3-a.txt

Thanks, this looks interesting, I'll take a look!

> You can also refer to
> https://orgmode.org/worg/dev/org-element-api.html

This one I know, of course, but it's a bit more high-level, I think.
>
>> As an aside, inspecting deeply nested structures in Elisp seems a pain
>> in the neck.  Does anyone know a good method of interactively inspecting
>> them?
>
> https://github.com/mmontone/emacs-inspector

Wow, this looks _great_!!!  I'll install it and try it out!

Thanks,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-06-08 15:18     ` Thomas Redelberger
@ 2023-06-24 15:04       ` Max Nikulin
  2023-06-25 19:56         ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Max Nikulin @ 2023-06-24 15:04 UTC (permalink / raw)
  To: emacs-orgmode

On 08/06/2023 22:18, Thomas Redelberger wrote:
> 
> I had a similar requirement for "simplest HTML" and have documented how 
> I tackled this under
>   http://web222.webclient5.de/doc/swdev/emacs/orgmode/html

At this page:

> #+BIND: org-html-viewport nil
> 
> I do not need viewport information in the HTML. 

 From my point of view it sounds strange. I do not see a real reason to 
intentionally make a site inconvenient for users of mobile devices.

Marcin, viewport is missed on your site as well.



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

* Re: How to export to the simplest possible HTML?
  2023-06-24 15:04       ` Max Nikulin
@ 2023-06-25 19:56         ` Marcin Borkowski
  2023-06-27 11:00           ` Max Nikulin
  0 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-25 19:56 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode


On 2023-06-24, at 17:04, Max Nikulin <manikulin@gmail.com> wrote:

> On 08/06/2023 22:18, Thomas Redelberger wrote:
>> I had a similar requirement for "simplest HTML" and have documented
>> how I tackled this under
>>  http://web222.webclient5.de/doc/swdev/emacs/orgmode/html
>
> At this page:
>
>> #+BIND: org-html-viewport nil
>> I do not need viewport information in the HTML. 
>
> From my point of view it sounds strange. I do not see a real reason to
> intentionally make a site inconvenient for users of mobile devices.
>
> Marcin, viewport is missed on your site as well.

Do you mean this?
https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag

I think the reason is that the site was designed (in terms of HTML and
CSS) well over 15 years ago...

Thanks,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to the simplest possible HTML?
  2023-06-25 19:56         ` Marcin Borkowski
@ 2023-06-27 11:00           ` Max Nikulin
  2023-06-28  9:03             ` Marcin Borkowski
  0 siblings, 1 reply; 19+ messages in thread
From: Max Nikulin @ 2023-06-27 11:00 UTC (permalink / raw)
  To: emacs-orgmode

>> On 08/06/2023 22:18, Thomas Redelberger wrote:
>>>   http://web222.webclient5.de/doc/swdev/emacs/orgmode/html
>>
>> At this page:
>>
>>> #+BIND: org-html-viewport nil
>>> I do not need viewport information in the HTML.

On 26/06/2023 02:56, Marcin Borkowski wrote:
> Do you mean this?
> https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag

Yes, I do. Browser development tools allows to test adaptive design (to 
simulate specific mobile devices).

I was surprised that somebody may intentionally disable the feature 
supported by Org on a site that at first glance does not require special 
viewport settings. Since you are in the process of refreshing your site, 
I decided to draw your attention to this setting of HTML pages.




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

* Re: How to export to the simplest possible HTML?
  2023-06-27 11:00           ` Max Nikulin
@ 2023-06-28  9:03             ` Marcin Borkowski
  0 siblings, 0 replies; 19+ messages in thread
From: Marcin Borkowski @ 2023-06-28  9:03 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode


On 2023-06-27, at 13:00, Max Nikulin <manikulin@gmail.com> wrote:

>>> On 08/06/2023 22:18, Thomas Redelberger wrote:
>>>>   http://web222.webclient5.de/doc/swdev/emacs/orgmode/html
>>>
>>> At this page:
>>>
>>>> #+BIND: org-html-viewport nil
>>>> I do not need viewport information in the HTML.
>
> On 26/06/2023 02:56, Marcin Borkowski wrote:
>> Do you mean this?
>> https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag
>
> Yes, I do. Browser development tools allows to test adaptive design
> (to simulate specific mobile devices).

Thanks.

> I was surprised that somebody may intentionally disable the feature
> supported by Org on a site that at first glance does not require
> special viewport settings. Since you are in the process of refreshing
> your site, I decided to draw your attention to this setting of HTML
> pages.

I did not plan to do anything with https://mbork.pl, but I'll look into
it.  (I'm working on another site.)

Thanks,

-- 
Marcin Borkowski
http://mbork.pl


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

end of thread, other threads:[~2023-06-28  9:05 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  3:47 How to export to the simplest possible HTML? Marcin Borkowski
2023-05-30  6:21 ` Ihor Radchenko
2023-05-30 18:45   ` Marcin Borkowski
2023-06-03  3:36     ` Marcin Borkowski
2023-06-03  5:08       ` Ihor Radchenko
2023-06-03  6:24         ` Marcin Borkowski
2023-06-03  8:37           ` Ihor Radchenko
2023-06-24 13:25             ` Marcin Borkowski
2023-06-24 13:34               ` Ihor Radchenko
2023-06-24 13:48                 ` Marcin Borkowski
2023-05-30 15:32 ` Max Nikulin
2023-05-30 18:48   ` Marcin Borkowski
2023-06-08 15:18     ` Thomas Redelberger
2023-06-24 15:04       ` Max Nikulin
2023-06-25 19:56         ` Marcin Borkowski
2023-06-27 11:00           ` Max Nikulin
2023-06-28  9:03             ` Marcin Borkowski
  -- strict thread matches above, loose matches on Subject: below --
2023-06-10  8:25 Thomas Redelberger
2023-06-24 13:16 ` Marcin Borkowski

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