emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Anchors/targets in org-export/publish
@ 2008-11-13 16:36 Matthew Lundin
  2008-11-13 17:18 ` Matthew Lundin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthew Lundin @ 2008-11-13 16:36 UTC (permalink / raw)
  To: emacs-orgmode


Question about org-export:

I'd like to create invisible radio targets to html anchor links using
org-export.

E.g., 

# <<radiotarget>>

should become

<a name="radiotarget"></a>

Currently, however, there are a couple of behaviors of org-exp.el that
make this difficult.

1) Org-export does convert invisible targets, but it puts paragraph
tags around the anchor, thus creating an empty line in the html
export, which messes up the layout.

         <p>
         <a name="radiotarget">&nbsp;</a>
         </p>

2) If the commented radio target is directly beneath or above a
headline, it is not exported. I checked org-exp.el and this seems to
be an intentional behavior. I'm not sure I understand the reasons
behind this, as it prevents one from giving custom anchors to
headlines.

This is especially important if one wants to be able to create
permalinks to headlines from other pages.

Thanks. Any feedback would be greatly appreciated.

Matt

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

* Re: Anchors/targets in org-export/publish
  2008-11-13 16:36 Anchors/targets in org-export/publish Matthew Lundin
@ 2008-11-13 17:18 ` Matthew Lundin
  2008-11-16 20:29 ` Carsten Dominik
  2008-11-16 21:27 ` Carsten Dominik
  2 siblings, 0 replies; 6+ messages in thread
From: Matthew Lundin @ 2008-11-13 17:18 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode

Matthew Lundin <mdl@imapmail.org> writes:

> Question about org-export:
>
> I'd like to create invisible radio targets to html anchor links using
> org-export.
>
> E.g., 
>
> # <<radiotarget>>
>
> should become
>
> <a name="radiotarget"></a>
>
> Currently, however, there are a couple of behaviors of org-exp.el that
> make this difficult.
>
> 1) Org-export does convert invisible targets, but it puts paragraph
> tags around the anchor, thus creating an empty line in the html
> export, which messes up the layout.
>
>          <p>
>          <a name="radiotarget">&nbsp;</a>
>          </p>

Quick follow up to my previous message. Would it be possible to remove
the &nbsp above. That would prevent an extra line in the output, but
it might render the link useless in some browsers.

(I should also apologize for the strong phrase "messes up." Everything
works so wonderfully and magically in org-mode, so no expression of
frustration was intended here. Rather this is just a minor question
about tweaking html export.)

Thanks,

Matt

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

* Re: Anchors/targets in org-export/publish
  2008-11-13 16:36 Anchors/targets in org-export/publish Matthew Lundin
  2008-11-13 17:18 ` Matthew Lundin
@ 2008-11-16 20:29 ` Carsten Dominik
  2008-11-17 20:49   ` mdl
  2008-11-16 21:27 ` Carsten Dominik
  2 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2008-11-16 20:29 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode


On Nov 13, 2008, at 5:36 PM, Matthew Lundin wrote:

>
> Question about org-export:
>
> I'd like to create invisible radio targets to html anchor links using
> org-export.
>
> E.g.,
>
> # <<radiotarget>>
>
> should become
>
> <a name="radiotarget"></a>
>
> Currently, however, there are a couple of behaviors of org-exp.el that
> make this difficult.
>
> 1) Org-export does convert invisible targets, but it puts paragraph
> tags around the anchor, thus creating an empty line in the html
> export, which messes up the layout.
>
>         <p>
>         <a name="radiotarget">&nbsp;</a>
>         </p>

Hmmm, admittedly, this is not pretty.

>
>
> 2) If the commented radio target is directly beneath or above a
> headline, it is not exported. I checked org-exp.el and this seems to
> be an intentional behavior. I'm not sure I understand the reasons
> behind this, as it prevents one from giving custom anchors to
> headlines.
>
> This is especially important if one wants to be able to create
> permalinks to headlines from other pages.

Yes, can see that this application makes sense.  However, the reason  
why I am using the target of the headline instead is because I would  
like the anchor to match at the headline directly.  I could, probably,  
use the specified target instead of the sec-... id, but that also  
feels inconsistent.  Hmmm, I need to think more about this.

I just checked how Muse handles this.  When they have an anchor  
directly above a headline, the anchor is inserted into the definition  
of the headline.  Maybe we can do something like this.

- Carsten

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

* Re: Anchors/targets in org-export/publish
  2008-11-13 16:36 Anchors/targets in org-export/publish Matthew Lundin
  2008-11-13 17:18 ` Matthew Lundin
  2008-11-16 20:29 ` Carsten Dominik
@ 2008-11-16 21:27 ` Carsten Dominik
  2008-11-17 20:52   ` mdl
  2 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2008-11-16 21:27 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode


On Nov 13, 2008, at 5:36 PM, Matthew Lundin wrote:

>
> Question about org-export:
>
> I'd like to create invisible radio targets to html anchor links using
> org-export.
>
> E.g.,
>
> # <<radiotarget>>
>
> should become
>
> <a name="radiotarget"></a>
>
> Currently, however, there are a couple of behaviors of org-exp.el that
> make this difficult.
>
> 1) Org-export does convert invisible targets, but it puts paragraph
> tags around the anchor, thus creating an empty line in the html
> export, which messes up the layout.
>
>         <p>
>         <a name="radiotarget">&nbsp;</a>
>         </p>

This actually only happens if you surround the anchor by empty
lines.  Put it directly before a paragraph, or inside one, and
this will not happen.

> 2) If the commented radio target is directly beneath or above a
> headline, it is not exported. I checked org-exp.el and this seems to
> be an intentional behavior. I'm not sure I understand the reasons
> behind this, as it prevents one from giving custom anchors to
> headlines.
>
> This is especially important if one wants to be able to create
> permalinks to headlines from other pages.

This is now fixed, the invisible targets are added as empty anchors
to the headline that must be directly before or after the anchor.



On Nov 13, 2008, at 6:18 PM, Matthew Lundin wrote:
>>
>>         <p>
>>         <a name="radiotarget">&nbsp;</a>
>>         </p>
>
> Quick follow up to my previous message. Would it be possible to remove
> the &nbsp above. That would prevent an extra line in the output, but
> it might render the link useless in some browsers.

Fixed as well, thanks.  I guess when I implemented this a long time
ago, I did not realize that empty anchors are allowed.

> (I should also apologize for the strong phrase "messes up."

Don't worry, no offense taken.

- Carsten

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

* Re: Anchors/targets in org-export/publish
  2008-11-16 20:29 ` Carsten Dominik
@ 2008-11-17 20:49   ` mdl
  0 siblings, 0 replies; 6+ messages in thread
From: mdl @ 2008-11-17 20:49 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode


Carsten Dominik <dominik@science.uva.nl> writes:

> On Nov 13, 2008, at 5:36 PM, Matthew Lundin wrote:
[snip]
>>
>> 2) If the commented radio target is directly beneath or above a
>> headline, it is not exported. I checked org-exp.el and this seems to
>> be an intentional behavior. I'm not sure I understand the reasons
>> behind this, as it prevents one from giving custom anchors to
>> headlines.
>>
>> This is especially important if one wants to be able to create
>> permalinks to headlines from other pages.
>
> Yes, can see that this application makes sense.  However, the reason
> why I am using the target of the headline instead is because I would
> like the anchor to match at the headline directly.  I could, probably,
> use the specified target instead of the sec-... id, but that also
> feels inconsistent.  Hmmm, I need to think more about this.
>
> I just checked how Muse handles this.  When they have an anchor
> directly above a headline, the anchor is inserted into the definition
> of the headline.  Maybe we can do something like this.
>
> - Carsten

Thanks for considering this.

- Matt

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

* Re: Anchors/targets in org-export/publish
  2008-11-16 21:27 ` Carsten Dominik
@ 2008-11-17 20:52   ` mdl
  0 siblings, 0 replies; 6+ messages in thread
From: mdl @ 2008-11-17 20:52 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:

> On Nov 13, 2008, at 5:36 PM, Matthew Lundin wrote:
>
>>
>> Question about org-export:
>>
>> I'd like to create invisible radio targets to html anchor links using
>> org-export.
>>
>> E.g.,
>>
>> # <<radiotarget>>
>>
>> should become
>>
>> <a name="radiotarget"></a>
>>
>> Currently, however, there are a couple of behaviors of org-exp.el that
>> make this difficult.
>>
>> 1) Org-export does convert invisible targets, but it puts paragraph
>> tags around the anchor, thus creating an empty line in the html
>> export, which messes up the layout.
>>
>>         <p>
>>         <a name="radiotarget">&nbsp;</a>
>>         </p>
>
> This actually only happens if you surround the anchor by empty
> lines.  Put it directly before a paragraph, or inside one, and
> this will not happen.
>
>> 2) If the commented radio target is directly beneath or above a
>> headline, it is not exported. I checked org-exp.el and this seems to
>> be an intentional behavior. I'm not sure I understand the reasons
>> behind this, as it prevents one from giving custom anchors to
>> headlines.
>>
>> This is especially important if one wants to be able to create
>> permalinks to headlines from other pages.
>
> This is now fixed, the invisible targets are added as empty anchors
> to the headline that must be directly before or after the anchor.
>
>
>
> On Nov 13, 2008, at 6:18 PM, Matthew Lundin wrote:
>>>
>>>         <p>
>>>         <a name="radiotarget">&nbsp;</a>
>>>         </p>
>>
>> Quick follow up to my previous message. Would it be possible to remove
>> the &nbsp above. That would prevent an extra line in the output, but
>> it might render the link useless in some browsers.
>
> Fixed as well, thanks.  I guess when I implemented this a long time
> ago, I did not realize that empty anchors are allowed.
>
>> (I should also apologize for the strong phrase "messes up."
>
> Don't worry, no offense taken.
>
> - Carsten

Didn't see the fix before I sent my last message.

Thanks so much! This is fantastic.

- Matt

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

end of thread, other threads:[~2008-11-17 20:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-13 16:36 Anchors/targets in org-export/publish Matthew Lundin
2008-11-13 17:18 ` Matthew Lundin
2008-11-16 20:29 ` Carsten Dominik
2008-11-17 20:49   ` mdl
2008-11-16 21:27 ` Carsten Dominik
2008-11-17 20:52   ` mdl

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