Re: [O] Feature request: Allow export to convert broken links to plain text

2019-01-13 Thread Berry, Charles



> On Jan 13, 2019, at 1:33 PM, Ryan Thompson  wrote:
> 
> 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?

Looks like your original idea to revise `org-export-data' might be best. 

IIUC, you need to add the link text to the SIGNAL-DATA in each of the places 
where `org-export-resolve-*-link' functions call `signal', then modify 
`org-export-data' to ignore the addition for `mark' and add it back for your 
new `mark-with-text' option.

HTH,

Chuck





Re: [O] Feature request: Allow export to convert broken links to plain text

2019-01-13 Thread Ryan Thompson
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
>
>
>
>


Re: [O] Feature request: Allow export to convert broken links to plain text

2019-01-13 Thread Berry, Charles



> 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






Re: [O] Feature request: Allow export to convert broken links to plain text

2019-01-12 Thread Ryan Thompson
(Apologies for the double post of this email; due to a misconfiguration of
my mailer, I believed my first email hadn't gone through until I remembered
to check the archives.)

On Sat, 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. Would the developers be willing to merge such a
> feature if I wrote it? I would implement it by adding another possible
> value to "org-export-with-broken-links", perhaps calling it something like
> "unlink" or "strip" (suggestions for a better name welcome). Alternatively,
> I could implement an option to dispatch broken link handling to an
> arbitrary function.
>
> Thanks,
>
> Ryan Thompson
>
>


[O] Feature request: Allow export to convert broken links to plain text

2019-01-12 Thread Ryan Thompson
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. Would the developers be willing to merge such a feature if I
wrote it? I would implement it by adding another possible value to
"org-export-with-broken-links", perhaps calling it something like "unlink"
or "strip" (suggestions for a better name welcome). Alternatively, I could
implement an option to dispatch broken link handling to an arbitrary
function.

Thanks,

Ryan Thompson


[O] Feature request: Allow export to convert broken links to plain text

2019-01-05 Thread Ryan Thompson
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. Would the developers be willing to merge such a feature if I
wrote it? I would add another possible value to
"org-export-with-broken-links", perhaps calling it something like "unlink"
or "strip".

Thanks,

Ryan Thompson