emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ox-html] Why are dedicated targets automatically renamed?
@ 2016-01-21  6:45 Sébastien Brisard
  2016-01-31 21:52 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Brisard @ 2016-01-21  6:45 UTC (permalink / raw)
  To: emacs-orgmode

Hi,
I have noticed that org-mode now renames dedicated targets. More
precisely, the following org file

===== beginning of a.org =====
  - <<item1>>Item 1
  - <<item2>>Item 2
===== end of a.org =====

gets exported to html as

===== beginning of a.html (extract) =====
<body>
<div id="content">
<ul class="org-ul">
<li><a id="orgtarget1"></a>Item 1</li>
<li><a id="orgtarget2"></a>Item 2</li>
</ul>
</div>
<div id="postamble" class="status">
<p class="author">Author: Sébastien Brisard</p>
<p class="date">Created: 2016-01-21 Thu 07:38</p>
<p class="creator"><a
href="http://www.gnu.org/software/emacs/">Emacs</a> 24.5.1 (<a
href="http://orgmode.org">Org</a> mode 8.3.3)</p>
<p class="validation"><a
href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
===== end of a.html =====

Notice that the targets were renamed item1 -> orgtarget1 and item2 ->
orgtarget2. Why is that?  With org-publish, it messes up links across
files.
Is there an option that allows to preserve the user's target name on export?
I've tried to grep for "orgtarget" through all org files, and could
not find where this feature was defined.

Thanks for your help,
Sébastien

PS: org-mode 8.2.1 does not have this problem, while v 8.3.3 does.

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

* Re: [ox-html] Why are dedicated targets automatically renamed?
  2016-01-21  6:45 Sébastien Brisard
@ 2016-01-31 21:52 ` Nicolas Goaziou
  2016-02-01 19:59   ` Sébastien Brisard
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2016-01-31 21:52 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: emacs-orgmode

Hello,

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> I have noticed that org-mode now renames dedicated targets. More
> precisely, the following org file
>
> ===== beginning of a.org =====
>   - <<item1>>Item 1
>   - <<item2>>Item 2
> ===== end of a.org =====
>
> gets exported to html as
>
> ===== beginning of a.html (extract) =====
> <body>
> <div id="content">
> <ul class="org-ul">
> <li><a id="orgtarget1"></a>Item 1</li>
> <li><a id="orgtarget2"></a>Item 2</li>
> </ul>
> </div>
> <div id="postamble" class="status">
> <p class="author">Author: Sébastien Brisard</p>
> <p class="date">Created: 2016-01-21 Thu 07:38</p>
> <p class="creator"><a
> href="http://www.gnu.org/software/emacs/">Emacs</a> 24.5.1 (<a
> href="http://orgmode.org">Org</a> mode 8.3.3)</p>
> <p class="validation"><a
> href="http://validator.w3.org/check?uri=referer">Validate</a></p>
> </div>
> </body>
> ===== end of a.html =====
>
> Notice that the targets were renamed item1 -> orgtarget1 and item2 ->
> orgtarget2. Why is that?

It allows using any kind of character for a target without knowing
HTML's forbidden ones.

> With org-publish, it messes up links across files.

What do you mean? <<...>> are internal targets, and by no mean meant to
link across documents.

> Is there an option that allows to preserve the user's target name on
> export?

No, there isn't. "ox-latex" provides one, but not "ox-html". Note that
custom ID are always preserved, tho.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-html] Why are dedicated targets automatically renamed?
  2016-01-31 21:52 ` Nicolas Goaziou
@ 2016-02-01 19:59   ` Sébastien Brisard
  2016-02-02 16:38     ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Brisard @ 2016-02-01 19:59 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

thanks for your answer!

>
>> I have noticed that org-mode now renames dedicated targets. More
>> precisely, the following org file
>>
>> ===== beginning of a.org =====
>>   - <<item1>>Item 1
>>   - <<item2>>Item 2
>> ===== end of a.org =====
>>
>> gets exported to html as
>>
>> ===== beginning of a.html (extract) =====
>> <body>
>> <div id="content">
>> <ul class="org-ul">
>> <li><a id="orgtarget1"></a>Item 1</li>
>> <li><a id="orgtarget2"></a>Item 2</li>
>> </ul>
>> </div>
>> <div id="postamble" class="status">
>> <p class="author">Author: Sébastien Brisard</p>
>> <p class="date">Created: 2016-01-21 Thu 07:38</p>
>> <p class="creator"><a
>> href="http://www.gnu.org/software/emacs/">Emacs</a> 24.5.1 (<a
>> href="http://orgmode.org">Org</a> mode 8.3.3)</p>
>> <p class="validation"><a
>> href="http://validator.w3.org/check?uri=referer">Validate</a></p>
>> </div>
>> </body>
>> ===== end of a.html =====
>>
>> Notice that the targets were renamed item1 -> orgtarget1 and item2 ->
>> orgtarget2. Why is that?
>
> It allows using any kind of character for a target without knowing
> HTML's forbidden ones.
>

Yes, that's what I found on this ML, but I am not sure I follow the logics.

>> With org-publish, it messes up links across files.
>
> What do you mean? <<...>> are internal targets, and by no mean meant to
> link across documents.
>

Oh really? It does work, though. I use this feature on my blog to link
to bibrefs that are in another page. Links like

 [[file:../pages/references.org::#TARI2008][Tariel et al., 2008]]

get exported correctly. Only, the HTML target name is orgtargetXX.
Which means that if I add a new bibliographic reference in the
references.org file, I need to reexport the whole website, rather than
the pages that have changed.

But, if I understand correctly, I should not be using this kind of links anyway?

>> Is there an option that allows to preserve the user's target name on
>> export?
>
> No, there isn't. "ox-latex" provides one, but not "ox-html". Note that
> custom ID are always preserved, tho.
>
Yeah, I have explored a solution using custom IDs. They don't work
with lists, though (I use description lists for my references). Then I
need to define every new bib entry as a header. It's doable, and if
you confirm that what I do at the moment should not be working at all,
then I will switch to this option.

Best,
Sébastien

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

* Re: [ox-html] Why are dedicated targets automatically renamed?
  2016-02-01 19:59   ` Sébastien Brisard
@ 2016-02-02 16:38     ` Nicolas Goaziou
  2016-02-03  7:27       ` Sébastien Brisard
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2016-02-02 16:38 UTC (permalink / raw)
  To: Sébastien Brisard; +Cc: emacs-orgmode

Hello,

Sébastien Brisard <sebastien.brisard@m4x.org> writes:

> Oh really? It does work, though. I use this feature on my blog to link
> to bibrefs that are in another page. Links like
>
>  [[file:../pages/references.org::#TARI2008][Tariel et al., 2008]]
>
> get exported correctly. Only, the HTML target name is orgtargetXX.
> Which means that if I add a new bibliographic reference in the
> references.org file, I need to reexport the whole website, rather than
> the pages that have changed.
>
> But, if I understand correctly, I should not be using this kind of
> links anyway?

If you do, you're on your own. We cannot ensure this will always work.

> Yeah, I have explored a solution using custom IDs. They don't work
> with lists, though (I use description lists for my references). Then I
> need to define every new bib entry as a header. It's doable, and if
> you confirm that what I do at the moment should not be working at all,
> then I will switch to this option.

You could insert your own targets with #+HTML or @@html:...@@
directives, e.g.,

  #+HTML: <a id="myid"></a>
  Text

Another option is to implement `org-latex-prefer-user-labels' for HTML
back-end, if you want to.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-html] Why are dedicated targets automatically renamed?
  2016-02-02 16:38     ` Nicolas Goaziou
@ 2016-02-03  7:27       ` Sébastien Brisard
  0 siblings, 0 replies; 7+ messages in thread
From: Sébastien Brisard @ 2016-02-03  7:27 UTC (permalink / raw)
  To: emacs-orgmode

Hello again,

>
> > Oh really? It does work, though. I use this feature on my blog to link
> > to bibrefs that are in another page. Links like
> >
> >  [[file:../pages/references.org::#TARI2008][Tariel et al., 2008]]
> >
> > get exported correctly. Only, the HTML target name is orgtargetXX.
> > Which means that if I add a new bibliographic reference in the
> > references.org file, I need to reexport the whole website, rather than
> > the pages that have changed.
> >
> > But, if I understand correctly, I should not be using this kind of
> > links anyway?
>
> If you do, you're on your own. We cannot ensure this will always work.
>

Fair enough. I did not realize that, I will no longer this feature, then.

>
> > Yeah, I have explored a solution using custom IDs. They don't work
> > with lists, though (I use description lists for my references). Then I
> > need to define every new bib entry as a header. It's doable, and if
> > you confirm that what I do at the moment should not be working at all,
> > then I will switch to this option.
>
> You could insert your own targets with #+HTML or @@html:...@@
> directives, e.g.,
>
>   #+HTML: <a id="myid"></a>
>   Text
>

I'd rather use a "pure org" option. My solution is as follows. Replace
all description list items, like

  - <<BIGO1994>>
[[http://www.ing.unitn.it/~bigoni/paper/eigenvalues.pdf][Bigoni and
Zaccaria (1994)]] :: D. Bigoni and D. Zaccaria, /On the eigenvalues of
the acoustic tensor in elastoplasticity/, European Journal of
Mechanics - A/Solids 13(5):621-638, 1994

With headings

* [[http://www.ing.unitn.it/~bigoni/paper/eigenvalues.pdf][Bigoni and
Zaccaria (1994)]]
  :PROPERTIES:
  :CUSTOM_ID: BIGO1994
  :HTML_CONTAINER_CLASS: sb-bib
  :END:

The trick being to use HTML_CONTAINER_CLASS to tune the appearance of
these headings from the CSS file. Although a bit more verbose, this
solution exports links correctly.

>
> Another option is to implement `org-latex-prefer-user-labels' for HTML
> back-end, if you want to.
>

... Which is way beyond my elisp capabilities!!!

Anyway, thanks for this very helpful answer. Orgmode is great!

Best regards,
Sébastien

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

* Re: [ox-html] Why are dedicated targets automatically renamed?
@ 2016-10-18 15:46 D. C. Toedt
  2016-10-20 16:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: D. C. Toedt @ 2016-10-18 15:46 UTC (permalink / raw)
  To: mail, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]

I'm late to this thread but found it in researching a similar problem.  I
use designated targets to create a permanently-named internal HTML anchor
that I can use in providing a precisely-targeted complete URL that points
to a specific paragraph (as opposed to a section).  Example:  In the file
index.org, the org-mode dedicated target  <<ThisTarget>> should export to
HTML as: http://www.example.com/index.html#ThisTarget.  The name #ThisTarget
needs to be permanent because the document in question is a work in
progress.

Based on Nicolas's suggestion (downthread) about using #+HTML: or @@html: ,
I did a couple of quickie macros to create <a> anchors and links, but
that's a pain and clutters up the on-screen display in org-mode.
​​

​--D. C.​



D. C. Toedt III
Attorney & neutral arbitrator <http://www.OnContracts.com/arb-prefs>  —
tech contracts & IP
*(My last name is pronounced "Tate")*
O: +1 (713) 364-6545   C: +1 (713) 516-8968
​​

dc@toedt.com    @dctoedt <https://twitter.com/DCToedt>
​
Skype: dctoedt
​

www.OnContracts.com/About <http://www.oncontracts.com/About>
​​


Unless expressly stated otherwise,
this message is not intended to serve
as assent to an agreement or other document,
even if attached to this message.

[-- Attachment #2: Type: text/html, Size: 6761 bytes --]

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

* Re: [ox-html] Why are dedicated targets automatically renamed?
  2016-10-18 15:46 [ox-html] Why are dedicated targets automatically renamed? D. C. Toedt
@ 2016-10-20 16:51 ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2016-10-20 16:51 UTC (permalink / raw)
  To: D. C. Toedt; +Cc: emacs-orgmode

Hello,

"D. C. Toedt" <dc@toedt.com> writes:

> I'm late to this thread but found it in researching a similar problem.  I
> use designated targets to create a permanently-named internal HTML anchor
> that I can use in providing a precisely-targeted complete URL that points
> to a specific paragraph (as opposed to a section).  Example:  In the file
> index.org, the org-mode dedicated target  <<ThisTarget>> should export to
> HTML as: http://www.example.com/index.html#ThisTarget.  The name #ThisTarget
> needs to be permanent because the document in question is a work in
> progress.
>
> Based on Nicolas's suggestion (downthread) about using #+HTML: or @@html: ,
> I did a couple of quickie macros to create <a> anchors and links, but
> that's a pain and clutters up the on-screen display in org-mode.

For the record, any implementation of `org-html-prefer-user-labels',
similar to `org-latex-prefer-user-labels' is welcome, as long it is
isn't active by default.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-10-20 16:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18 15:46 [ox-html] Why are dedicated targets automatically renamed? D. C. Toedt
2016-10-20 16:51 ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2016-01-21  6:45 Sébastien Brisard
2016-01-31 21:52 ` Nicolas Goaziou
2016-02-01 19:59   ` Sébastien Brisard
2016-02-02 16:38     ` Nicolas Goaziou
2016-02-03  7:27       ` Sébastien Brisard

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