From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id MKwWIRuznWblRAAAe85BDQ:P1 (envelope-from ) for ; Mon, 22 Jul 2024 01:17:15 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id MKwWIRuznWblRAAAe85BDQ (envelope-from ) for ; Mon, 22 Jul 2024 03:17:15 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=DqCRZY2f; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1721611035; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BHhK3F11byUW6KMYSKu2lfe6+eZ6bFtT5fjjyvni1h4=; b=iasKFJ5M4xKeiUywa82PN6F9+qZ2vRupdQoi40yUmxlxaH++r3CjXATQZ3Tx9TNe9d5xEg zm2CbAYgEe5ScTkdh9hXF7F7hmXHj2P3c25bNa1N9VAOnJ1YRQwHmYz/NmLNRl4cT9kkcE ZbyHR/V3BrRGJ5rZlpD+4ZB82etTptK+2smyPfXDGk5YfGfZxQwSCcZ3Vn6+zQsshjyrEm t4EEMkK3XXKvRSAp/8glnVaX7dZ7Z028OK/iI05/nmZ5DSsyCLDdcGwokGRcBd3ZxC5c1e Ejw13jBSzwwT9PHYrocM1eg8mh+l5cHU8t5g3FETJNqplGGSeHasm+CTy4puiQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=DqCRZY2f; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1721611035; a=rsa-sha256; cv=none; b=TBObPenJKZMUl5fBYWKjOLxeW/TvpHZx46sfYNkAdEmUA2jeqXzXCHJs0NfgEh1SYD6LT+ rpU5oQcUxCAmJfQ0Jh9WGY2t5OzEfUgdifSNaJcEyuFpEIUSkInOt58GJY0MXO10Tzt0cy BHspFrvDJw6snpCf7zuEbYWY6a3igTgHECOgRt2ZpcFe3miMmKBvQw6oXKAzUKQLM/L+vJ tjg7d+sMotZxK39hS6r+xb7HTvyD0xoua8+BmFG3dMlo6XopMqDBQYFM2IISmMw+Z7lflg iU2GvEuQ5FxLVfxvb5+VsakTy6e7DvuOrJgZ0fQ8n6OF3NAgiyPj/QKnevwqnA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7F82722BEC for ; Mon, 22 Jul 2024 03:17:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVhf7-0005d3-Sh; Sun, 21 Jul 2024 21:16:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVhf4-0005RU-UC for emacs-orgmode@gnu.org; Sun, 21 Jul 2024 21:16:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVhf4-00084y-Bu for emacs-orgmode@gnu.org; Sun, 21 Jul 2024 21:16:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=To:Subject:Date:From:In-Reply-To:References: MIME-Version; bh=BHhK3F11byUW6KMYSKu2lfe6+eZ6bFtT5fjjyvni1h4=; b=DqCRZY2fqNd0 rqanG9evxA7X+Ke57s3IO5jhplbggyQIjeHAxTdKsJiPx9rFqMm63mIwlK2+jSnHAU8CHU3uHe0FI INOfrGHpcTpUx5SoX5/FU7XN4nISt3ioXqZxh6tH2S/yG1KJZvwMayxBNwO1onpNzh4p1jJh493cd oOyayxjH4vgxJDdlWnTrhdqavv0nJSc4/T8kHXDONckGwbilxOmxWfQtrRkLyOqBwNomxaRZJfpHT 0qv9miTmpFJOlE0lMsXOvuXr0OtYszRZJpYwd2NIV68rBenxJliC5uf/tGZrZs8IdMk+nixoQWtVF rUC4uJ+mejSez7h4u91kzQ==; X-Gm-Message-State: AOJu0YwHmi49icGNBPzLd7yNgS9u7McItwnEPTITOjBNcAccEJQLTDMb Ve2Jkie00gT6M43HCFXvQaMU79vG1Cejckndpzy8NIs1y8byRPru+PDlJLoQKhO4/2YHDhk3itS 165ehp/nrkOJHll5xWM/mOGVgG8A= X-Google-Smtp-Source: AGHT+IGnKYhmRsjjjzxxPt6yjb/5zDw9ujlA06ZOzXXaLvrty8loDpjOCusZzea8kutIAKTmp3MHD2K97AhxjhPpg2U= X-Received: by 2002:a05:6102:549f:b0:48d:aced:abff with SMTP id ada2fe7eead31-49283e2d666mr2464594137.1.1721610981570; Sun, 21 Jul 2024 18:16:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Robert Weiner Date: Sun, 21 Jul 2024 21:16:10 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: How to fully control parsing of Org mode links during export To: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000ff87c1061dcbca4d" X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rswgnu@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -10.94 X-Migadu-Queue-Id: 7F82722BEC X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -10.94 X-TUID: 46EsU8pQDVXC --000000000000ff87c1061dcbca4d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks, so much, Orm. I=E2=80=99ll give this a try. It does indicate that = the expirt code and parser could use a simpler setup for debugging. =E2=80=94 = rsw On Sun, Jul 21, 2024 at 2:20=E2=80=AFPM Orm Finnendahl < orm.finnendahl@selma.hfmdk-frankfurt.de> wrote: > 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: > > Emacs#Section-One > > but instead Org export produces: > > Emacs#Section-One > > > > 2. When exporting from an Org file to html, I want this > > "[[One Testing]] Three" > > to be converted into this: > > "One Testing Three" > > but instead Org export produces: > > "One Testing > 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: > > MyLink > > Testing > > but instead Org export produces: > > MyLink.html">mytype: > href=3D"Testing.html">Testing > > > > 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 > > --000000000000ff87c1061dcbca4d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, so much, Orm.=C2=A0 I=E2=80=99ll give this a= try. It does indicate that the expirt code and parser could use a simpler = setup for debugging. =C2=A0=E2=80=94 rsw

On Sun, Jul 21, 202= 4 at 2:20=E2=80=AFPM Orm Finnendahl <orm.finnendahl@selma.hfmdk-frankf= urt.de> wrote:
Hi,

=C2=A0this 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
=C2=A0 of your liking (any buffer with the name .el should do).

- In that function add the line (setq info-debug info) just after the
=C2=A0 comment lines (Lines 2997/2998):

=C2=A0 ;; Eventually transcode TREE.=C2=A0 Wrap the resulting string into =C2=A0 ;; a template.
=C2=A0 (setq info-debug info)

- Evaluate the new definition of org-export-as and run the export from
=C2=A0 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
=C2=A0 (org-element-map (plist-get info-debug :parse-tree) 'link 'i= dentity))

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.=C2=A0 I have
> been trying to tweak export link parsing to do what I want
> without any success.=C2=A0 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
>=C2=A0 =C2=A0 =C2=A0 [[Emacs#Section-One]] or [[file:Emacs::Section-One= ]]
>=C2=A0 =C2=A0 to be converted into this:
>=C2=A0 =C2=A0 =C2=A0 <a href=3D"Emacs.html">Emacs</a= >#Section-One
>=C2=A0 =C2=A0 but instead Org export produces:
>=C2=A0 =C2=A0 =C2=A0 <a href=3D"Emacs.html">Emacs</a= >#Section-One
>
> 2. When exporting from an Org file to html, I want this
>=C2=A0 =C2=A0 =C2=A0 "[[One Testing]] Three"
>=C2=A0 =C2=A0 to be converted into this:
>=C2=A0 =C2=A0 =C2=A0 "<a href=3D"One Testing.html">= ;One Testing</a> Three"
>=C2=A0 =C2=A0 but instead Org export produces:
>=C2=A0 =C2=A0 =C2=A0 "<a href=3D"One.html">One<= /a> <a href=3D"Testing.html">Testing</a> Three&quo= t;
>
> 3. When exporting from an Org file and I have defined the html export<= br> >=C2=A0 =C2=A0 syntax for mytype: to html, I want this:
>=C2=A0 =C2=A0 =C2=A0 [[mytype:MyLink]]
>=C2=A0 =C2=A0 =C2=A0 [[Testing]]
>=C2=A0 =C2=A0 to be converted into this:
>=C2=A0 =C2=A0 =C2=A0 <a href=3D"MyLink.html">MyLink<= /a>
>=C2=A0 =C2=A0 =C2=A0 <a href=3D"Testing.html">Testing&l= t;/a>
>=C2=A0 =C2=A0 but instead Org export produces:
>=C2=A0 =C2=A0 =C2=A0 <a href=3D"<a href=3D"MyLink.html&= quot;>MyLink</a>.html">mytype:<a
> href=3D"Testing.html">Testing</a></a>
>
> My questions are:
>
> 1. How can I change `org-element-link-parser' in tandem with
>=C2=A0 =C2=A0 ox-html.el to output simple HTML links without any of the= text
>=C2=A0 =C2=A0 within double brackets bleeding outside of the HTML link?=
>
> 2. How can I get the exporter to run in my current Emacs process and >=C2=A0 =C2=A0 spawn a new Emacs so that I can easily debug in-process?= =C2=A0 I think I have
>=C2=A0 =C2=A0 turned off the async export option but it still runs asyn= c and I can't
>=C2=A0 =C2=A0 step through the exporter functions.
>
> Thanks very much for any help.
>
> -- rsw

--000000000000ff87c1061dcbca4d--