From: Orm Finnendahl <orm.finnendahl@selma.hfmdk-frankfurt.de>
To: emacs-orgmode@gnu.org
Subject: Re: How to fully control parsing of Org mode links during export
Date: Sun, 21 Jul 2024 20:19:18 +0200 [thread overview]
Message-ID: <Zp1RJo5SGiFsmmiu@orm-t14s> (raw)
In-Reply-To: <CA+OMD9hhWTcHiEC9gwNx-gJdUv_JxGJ3dfQepZ=N2jHkpus5TA@mail.gmail.com>
Hi,
this is how I currently do the debugging of html-export (there may be
more elegant ways, but it works well for me):
- Copy (defun org-export-as ...) from ox.el into a local elisp buffer
of your liking (any buffer with the name .el should do).
- In that function add the line (setq info-debug info) just after the
comment lines (Lines 2997/2998):
;; Eventually transcode TREE. Wrap the resulting string into
;; a template.
(setq info-debug info)
- Evaluate the new definition of org-export-as and run the export from
your org file once.
Now you can access the complete parse tree with
(plist-get info-debug :parse-tree)
(make sure just to use a small document, otherwise the output might be
pretty nasty as the parents of all elements are recursively fully
contained in the parse tree).
You can extract all links of your document with:
(setq all-links
(org-element-map (plist-get info-debug :parse-tree) 'link 'identity))
And you can check the output string of html with this:
(org-html-link (nth 0 all-links) "" info-debug)
You can then check what you have to do to make org-html-link output
the desired string, or redefine org-html-link to do what you need and
later make a derived backend from the html backend replacing the
org-html-link function or simply load the new definition of
org-html-link using a mechanism like #+SETUPFILE: in your header.
HTH,
Orm
Am Sonntag, den 21. Juli 2024 um 13:19:29 Uhr (-0400) schrieb Robert Weiner:
> Hi Org developers:
>
> I could really use some help from Org export experts. I have
> been trying to tweak export link parsing to do what I want
> without any success. Here is a summary of the issues and related
> questions I have.
>
> Usinf Org version "9.8-pre":
>
> 1. When exporting from an Org file to html, I want this
> [[Emacs#Section-One]] or [[file:Emacs::Section-One]]
> to be converted into this:
> <a href="Emacs.html">Emacs</a>#Section-One
> but instead Org export produces:
> <a href="Emacs.html">Emacs</a>#Section-One
>
> 2. When exporting from an Org file to html, I want this
> "[[One Testing]] Three"
> to be converted into this:
> "<a href="One Testing.html">One Testing</a> Three"
> but instead Org export produces:
> "<a href="One.html">One</a> <a href="Testing.html">Testing</a> Three"
>
> 3. When exporting from an Org file and I have defined the html export
> syntax for mytype: to html, I want this:
> [[mytype:MyLink]]
> [[Testing]]
> to be converted into this:
> <a href="MyLink.html">MyLink</a>
> <a href="Testing.html">Testing</a>
> but instead Org export produces:
> <a href="<a href="MyLink.html">MyLink</a>.html">mytype:<a
> href="Testing.html">Testing</a></a>
>
> My questions are:
>
> 1. How can I change `org-element-link-parser' in tandem with
> ox-html.el to output simple HTML links without any of the text
> within double brackets bleeding outside of the HTML link?
>
> 2. How can I get the exporter to run in my current Emacs process and
> spawn a new Emacs so that I can easily debug in-process? I think I have
> turned off the async export option but it still runs async and I can't
> step through the exporter functions.
>
> Thanks very much for any help.
>
> -- rsw
next prev parent reply other threads:[~2024-07-21 18:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-21 17:19 How to fully control parsing of Org mode links during export Robert Weiner
2024-07-21 18:19 ` Orm Finnendahl [this message]
2024-07-22 1:16 ` Robert Weiner
2024-07-22 4:01 ` Robert Weiner
2024-07-22 13:54 ` Ihor Radchenko
2024-08-16 5:26 ` Robert Weiner
2024-08-18 13:13 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zp1RJo5SGiFsmmiu@orm-t14s \
--to=orm.finnendahl@selma.hfmdk-frankfurt.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.