emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* List number resetting when using anchor tag in exported HTML
@ 2010-01-26 13:59 Jere McDevitt
  2010-01-26 16:01 ` Eric S Fraga
  0 siblings, 1 reply; 5+ messages in thread
From: Jere McDevitt @ 2010-01-26 13:59 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2900 bytes --]

I came across an odd behavior while using org-mode to create some web pages
where list numbers get reset if you insert anchor tags.  Consider the
following example document:

* This is the first header line

  1. This is line number 1
  2. This is line number 2
  3. This is line number 3
#<<Anchor1>>
  1. This should be line number 4, but is reset by the anchor tag
  2. This should be line number 5.

* This is the second header line

  1. This is line number 1
  2. This is line number 2
  3. This is line number 3
#+BEGIN_HTML
<a name='anchor2'>
#+END_HTML
  1. This stays line number 4
  2. This stays line number 5

The numbers associated with the list items are the numbers created as new
items are added automatically with ALT-ENTER.  After the #<<Anchor1>> entry
and the #+END_HTML, doing the Alt-Enter starts the list number back at 1.
However, when this is exported to HTML, something else occurs.  In the case
of the #<<Anchor1>> entry, the HTML also restarts the list number, whereas
with the #+BEGIN_HTML it does not.  The generated HTML looks like the
below.  Notice in the first section the <ol> tag is closed and the anchor is
wrapped with paragraph tags, then <ol> reopens, so there is a space as well
as re-starting number, but in the second case the anchor tag is inline.
Further down is the actual generated HTML text.

Shouldn't #<<anchor>> tags be treated in the same way as
BEGIN_HTML/END_HTML?


Table of Contents

   - 1 This is the first header line <file:///tmp/burl31927GCc.html#sec-1>
   - 2 This is the second header line <file:///tmp/burl31927GCc.html#sec-2>

  1 This is the first header line

   1. This is line number 1
   2. This is line number 2
   3. This is line number 3


   1. This should be line number 4, but is reset by the anchor tag
   2. This should be line number 5.

  2 This is the second header line

   1. This is line number 1
   2. This is line number 2
   3. This is line number 3
   4. This stays line number 4
   5. This stays line number 5






<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> This is the first
header line </h2>
<div class="outline-text-2" id="text-1">


<ol>
<li>
This is line number 1

</li>
<li>
This is line number 2

</li>
<li>
This is line number 3
</li>
</ol>

<p><a name="Anchor1" id="Anchor1"></a>
</p><ol>
<li>
This should be line number 4, but is reset by the anchor tag

</li>
<li>
This should be line number 5.

<ol>
</ol>
</li>
</ol>
</div>

</div>

<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> This is the second
header line </h2>
<div class="outline-text-2" id="text-2">


<ol>
<li>
This is line number 1

</li>
<li>
This is line number 2

</li>
<li>
This is line number 3
<a name='anchor2'>
</li>
<li>
This stays line number 4

</li>
<li>
This stays line number 5
</li>
</ol>
</div>
</div>

[-- Attachment #1.2: Type: text/html, Size: 4437 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: List number resetting when using anchor tag in exported HTML
  2010-01-26 13:59 List number resetting when using anchor tag in exported HTML Jere McDevitt
@ 2010-01-26 16:01 ` Eric S Fraga
  2010-01-27  7:29   ` Eric S Fraga
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2010-01-26 16:01 UTC (permalink / raw)
  To: Jere McDevitt; +Cc: emacs-orgmode

At Tue, 26 Jan 2010 08:59:37 -0500,
Jere McDevitt wrote:
> I came across an odd behavior while using org-mode to create some web pages
> where list numbers get reset if you insert anchor tags.  Consider the
> following example document:
> 
> * This is the first header line
> 
>   1. This is line number 1
>   2. This is line number 2
>   3. This is line number 3
> #<<Anchor1>>
>   1. This should be line number 4, but is reset by the anchor tag
>   2. This should be line number 5.

[...]

The following works just fine (at least for HTML export, not sure about anything else):

--8<---------------cut here---------------start------------->8---
* This is the first header line

  1. This is line number 1
  2. This is line number 2
  3. This is line number 3
     <<Anchor1>>
  1. This should be line number 4, but is reset by the anchor tag
  2. This should be line number 5.
--8<---------------cut here---------------end--------------->8---

Note the indentation in particular.

HTH,
eric

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

* Re: List number resetting when using anchor tag in exported HTML
  2010-01-26 16:01 ` Eric S Fraga
@ 2010-01-27  7:29   ` Eric S Fraga
  2010-01-28 13:20     ` Jere McDevitt
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2010-01-27  7:29 UTC (permalink / raw)
  To: Jere McDevitt, emacs-orgmode

At Tue, 26 Jan 2010 16:01:23 +0000,
Eric S Fraga wrote:

> The following works just fine (at least for HTML export, not sure about anything else):
> 
> --8<---------------cut here---------------start------------->8---
> * This is the first header line
> 
>   1. This is line number 1
>   2. This is line number 2
>   3. This is line number 3
>      <<Anchor1>>
>   1. This should be line number 4, but is reset by the anchor tag
>   2. This should be line number 5.
> --8<---------------cut here---------------end--------------->8---
> 
> Note the indentation in particular.

(responding to my own post... sorry!)

The above is a little misleading as it looks like org is confused with
respect to list numbering.  I should have said that the numbering
above was incorrect only because I hadn't given org a chance to update
the numbers.  Hitting, for instance, C-cC-c on the last line gives:

--8<---------------cut here---------------start------------->8---
* This is the first header line

  1. This is line number 1
  2. This is line number 2
  3. This is line number 3
     <<Anchor1>>
  4. This should be line number 4, but is reset by the anchor tag
  5. This should be line number 5.
--8<---------------cut here---------------end--------------->8---

Apologies for any confusion caused!

eric

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

* Re: List number resetting when using anchor tag in exported HTML
  2010-01-27  7:29   ` Eric S Fraga
@ 2010-01-28 13:20     ` Jere McDevitt
  2010-01-28 19:15       ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Jere McDevitt @ 2010-01-28 13:20 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2780 bytes --]

If I key in what you list below with the list numbers flush or indented only
1 space, then yes the line numbers reset to 4 & 5 in the org file, but if
you export that to HTML, because the <<Anchor1>> is not preceded by a
comment mark, it shows up in the generated HTML as text.  If the comment
marker is put in place, the numbering resets but the anchor does not have
any visible text, the generated <a> tag is wrapped in <p> tags and the
enumeration is stopped/started around it.

Is there a way to define the anchor so the numbering continues as desired in
both org and generated HTML, but no text is visible in the generated HTML?


--8<---------------cut here---------------start------------->8---
* This is the first header line

 1. This is line number 1
 2. This is line number 2
 3. This is line number 3
    <<Anchor1>>
  4. This should be line number 4, but is reset by the anchor tag
  5. This should be line number 5.
--8<---------------cut here---------------end--------------->8---


<ol>
<li>
List item 1
</li>
<li>

List item 2
</li>
<li>

List item 3
<a name="Anchor1" class="target">Anchor1</a>

</li>
<li>
List item 4
</li>
<li>
List item 5

</li>

</ol>




Table of Contents

   - 1 Header line 1

  1 Header line 1

   1. List item 1
   2. List item 2
   3. List item 3 Anchor1
   4. List item 4
   5. List item 5



On Wed, Jan 27, 2010 at 2:29 AM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:

> At Tue, 26 Jan 2010 16:01:23 +0000,
> Eric S Fraga wrote:
>
> > The following works just fine (at least for HTML export, not sure about
> anything else):
> >
> > --8<---------------cut here---------------start------------->8---
> > * This is the first header line
> >
> >   1. This is line number 1
> >   2. This is line number 2
> >   3. This is line number 3
> >      <<Anchor1>>
> >   1. This should be line number 4, but is reset by the anchor tag
> >   2. This should be line number 5.
> > --8<---------------cut here---------------end--------------->8---
> >
> > Note the indentation in particular.
>
> (responding to my own post... sorry!)
>
> The above is a little misleading as it looks like org is confused with
> respect to list numbering.  I should have said that the numbering
> above was incorrect only because I hadn't given org a chance to update
> the numbers.  Hitting, for instance, C-cC-c on the last line gives:
>
> --8<---------------cut here---------------start------------->8---
> * This is the first header line
>
>  1. This is line number 1
>  2. This is line number 2
>  3. This is line number 3
>     <<Anchor1>>
>   4. This should be line number 4, but is reset by the anchor tag
>   5. This should be line number 5.
> --8<---------------cut here---------------end--------------->8---
>
> Apologies for any confusion caused!
>
> eric
>

[-- Attachment #1.2: Type: text/html, Size: 4203 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: List number resetting when using anchor tag in exported HTML
  2010-01-28 13:20     ` Jere McDevitt
@ 2010-01-28 19:15       ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-01-28 19:15 UTC (permalink / raw)
  To: Jere McDevitt; +Cc: emacs-orgmode


On Jan 28, 2010, at 2:20 PM, Jere McDevitt wrote:

> If I key in what you list below with the list numbers flush or  
> indented only 1 space, then yes the line numbers reset to 4 & 5 in  
> the org file, but if you export that to HTML, because the  
> <<Anchor1>> is not preceded by a comment mark, it shows up in the  
> generated HTML as text.  If the comment marker is put in place, the  
> numbering resets but the anchor does not have any visible text, the  
> generated <a> tag is wrapped in <p> tags and the enumeration is  
> stopped/started around it.
>
> Is there a way to define the anchor so the numbering continues as  
> desired in both org and generated HTML, but no text is visible in  
> the generated HTML?
>
>
> --8<---------------cut here---------------start------------->8---
> * This is the first header line
>
>  1. This is line number 1
>  2. This is line number 2
>  3. This is line number 3
>     <<Anchor1>>
>  4. This should be line number 4, but is reset by the anchor tag
>  5. This should be line number 5.
> --8<---------------cut here---------------end--------------->8---
>


Hi Jere,

here is how to do this, but it is not creating links to that
anchor automatically.  You have to make these explicitly,
like [[#anchor2][A link to item 3]]

* This is the first header line

  1. This is line number 1
  2. This is line number 2
  3. This is line number 3
     #+HTML:<a name='anchor2'>
  4. This should be line number 4, but is reset by the anchor tag
  5. This should be line number 5.

>
> <ol>
> <li>
> List item 1
> </li>
> <li>
>
> List item 2
> </li>
> <li>
>
> List item 3
> <a name="Anchor1" class="target">Anchor1</a>
>
> </li>
> <li>
>
> List item 4
> </li>
> <li>
> List item 5
>
> </li>
>
> </ol>
>
>
>
> Table of Contents
> 	• 1 Header line 1
> 1 Header line 1
> 	• List item 1
> 	• List item 2
> 	• List item 3 Anchor1
> 	• List item 4
> 	• List item 5
>
>
> On Wed, Jan 27, 2010 at 2:29 AM, Eric S Fraga <ucecesf@ucl.ac.uk>  
> wrote:
> At Tue, 26 Jan 2010 16:01:23 +0000,
> Eric S Fraga wrote:
>
> > The following works just fine (at least for HTML export, not sure  
> about anything else):
> >
> > --8<---------------cut here---------------start------------->8---
> > * This is the first header line
> >
> >   1. This is line number 1
> >   2. This is line number 2
> >   3. This is line number 3
> >      <<Anchor1>>
> >   1. This should be line number 4, but is reset by the anchor tag
> >   2. This should be line number 5.
> > --8<---------------cut here---------------end--------------->8---
> >
> > Note the indentation in particular.
>
> (responding to my own post... sorry!)
>
> The above is a little misleading as it looks like org is confused with
> respect to list numbering.  I should have said that the numbering
> above was incorrect only because I hadn't given org a chance to update
> the numbers.  Hitting, for instance, C-cC-c on the last line gives:
>
> --8<---------------cut here---------------start------------->8---
> * This is the first header line
>
>  1. This is line number 1
>  2. This is line number 2
>  3. This is line number 3
>     <<Anchor1>>
>  4. This should be line number 4, but is reset by the anchor tag
>  5. This should be line number 5.
> --8<---------------cut here---------------end--------------->8---
>
> Apologies for any confusion caused!
>
> eric
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-01-28 23:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-26 13:59 List number resetting when using anchor tag in exported HTML Jere McDevitt
2010-01-26 16:01 ` Eric S Fraga
2010-01-27  7:29   ` Eric S Fraga
2010-01-28 13:20     ` Jere McDevitt
2010-01-28 19:15       ` Carsten Dominik

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