From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryan Thompson Subject: Re: Feature request: Allow export to convert broken links to plain text Date: Sun, 13 Jan 2019 13:33:47 -0800 Message-ID: References: <6DD23F17-400A-468E-B637-5E2A9C7995DD@ucsd.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a012fc057f5dafd8" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:56719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ginOM-000175-5v for emacs-orgmode@gnu.org; Sun, 13 Jan 2019 16:34:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ginOL-0006Uo-8Y for emacs-orgmode@gnu.org; Sun, 13 Jan 2019 16:34:02 -0500 Received: from mail-vs1-xe2c.google.com ([2607:f8b0:4864:20::e2c]:39293) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ginOK-0006TK-Tl for emacs-orgmode@gnu.org; Sun, 13 Jan 2019 16:34:01 -0500 Received: by mail-vs1-xe2c.google.com with SMTP id h78so12492648vsi.6 for ; Sun, 13 Jan 2019 13:33:59 -0800 (PST) In-Reply-To: <6DD23F17-400A-468E-B637-5E2A9C7995DD@ucsd.edu> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Berry, Charles" Cc: Org-Mode List --000000000000a012fc057f5dafd8 Content-Type: text/plain; charset="UTF-8" Hi, This sounds like a good idea, but unfortunately it seems that the `broken-links:mark' option doesn't preserve the text of the link. In fact, looking at the source, the code that handles broken link errors doesn't even have access to the link's text, only the link target, so it's already too late once the org-link-broken signal is thrown. This also means that the implementation I was considering won't work. So, it looks like I need to intercept execution earlier in the export process. Any ideas on how to do that? Thanks, Ryan On Sun, Jan 13, 2019 at 9:50 AM Berry, Charles wrote: > > > > On Jan 12, 2019, at 12:38 PM, Ryan Thompson > wrote: > > > > Hi all, > > > > I have a use case where I'd like for Org Mode to remove broken links > while preserving their text when exporting. In particular, I'm exporting > the same file multiple times with different sets of headlines excluded each > time, and as a result I have to be careful of linking to headlines that > might not be present in every export. It would be much easier if such links > could simply be converted back to plain text for that export, while > remaining as a link for any exports that *do* include the target headline. > None of the existing settings do quite what I want. The "mark" option comes > closest. > > > > I basically want "mark" but without adding any additional text around > the link's text. > > > Sounds like a good use case for a filter. See > > (info "(org) Advanced Export Configuration") > > and scroll down to the `Filters' section. > > Just use the `broken-links:mark' option and set up your link filter to > strip the `BROKEN LINK:' part. > > HTH, > > Chuck > > > > --000000000000a012fc057f5dafd8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

This sounds like a good idea, but u= nfortunately it seems that the `broken-= links:mark' option doesn't preserve the text of the link. In fact, = looking at the source, the code that handles broken link errors doesn't= even have access to the link's text, only the link target, so it's= already too late once the org-link-broken signal is thrown. This also mean= s that the implementation I was considering won't work.

So, it looks like I need to intercept execution earlie= r in the export process. Any ideas on how to do that?

Thanks,

Ryan

On Sun, Jan 13, 2019= at 9:50 AM Berry, Charles <ccberry@= ucsd.edu> wrote:


> On Jan 12, 2019, at 12:38 PM, Ryan Thompson <rct@thompsonclan.org> wrote:
>
> Hi all,
>
> I have a use case where I'd like for Org Mode to remove broken lin= ks while preserving their text when exporting. In particular, I'm expor= ting the same file multiple times with different sets of headlines excluded= each time, and as a result I have to be careful of linking to headlines th= at might not be present in every export. It would be much easier if such li= nks could simply be converted back to plain text for that export, while rem= aining as a link for any exports that *do* include the target headline. Non= e of the existing settings do quite what I want. The "mark" optio= n comes closest.


> I basically want "mark" but without adding any additional te= xt around the link's text.


Sounds like a good use case for a filter. See

=C2=A0 =C2=A0 =C2=A0 =C2=A0 (info "(org) Advanced Export Configuration= ")

and scroll down to the `Filters' section.

Just use the `broken-links:mark' option and set up your link filter to = strip the `BROKEN LINK:' part.

HTH,

Chuck



--000000000000a012fc057f5dafd8--