emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to convert/normalize plain footnotes into [fn:] ones
@ 2016-12-21 14:46 Gerald Wildgruber
  2016-12-21 15:47 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Gerald Wildgruber @ 2016-12-21 14:46 UTC (permalink / raw)
  To: org mode mailing list


Hi,

I'm trying to convert older orgmode documents which have plain,
"[1]"-like footnotes into the newer "[fn:]" format.

Can this be done automatically?

In

https://lists.gnu.org/archive/html/emacs-orgmode/2015-12/msg00435.html

Nicolas mentions "org-footnote-normalize" which would turn old footnotes
in new ones, but it does nothing in my case except adding a "*
Footnotes" entry.

Thanks

Gerald.

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

* Re: how to convert/normalize plain footnotes into [fn:] ones
  2016-12-21 14:46 how to convert/normalize plain footnotes into [fn:] ones Gerald Wildgruber
@ 2016-12-21 15:47 ` Nicolas Goaziou
  2016-12-21 16:48   ` Gerald Wildgruber
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2016-12-21 15:47 UTC (permalink / raw)
  To: Gerald Wildgruber; +Cc: org mode mailing list

Hello,

Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:

> I'm trying to convert older orgmode documents which have plain,
> "[1]"-like footnotes into the newer "[fn:]" format.
>
> Can this be done automatically?

You could use `query-replace-regexp' a.k.a. C-M-%.

> Nicolas mentions "org-footnote-normalize" which would turn old footnotes
> in new ones, but it does nothing in my case except adding a "*
> Footnotes" entry.

You misunderstood. `org-footnote-normalize' used to turn every footnote
into [1], [2], ... whereas it now turns them into [fn:1], [fn:2],... IOW
it cannot be used to convert from old syntax to new one.

Regards,

-- 
Nicolas Goaziou

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

* Re: how to convert/normalize plain footnotes into [fn:] ones
  2016-12-21 15:47 ` Nicolas Goaziou
@ 2016-12-21 16:48   ` Gerald Wildgruber
  2016-12-21 20:12     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Gerald Wildgruber @ 2016-12-21 16:48 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org mode mailing list


Hi Nicolas,

thanks:

I had actually tried that already and came up with the following regex:

\([^ ]\)\(\[\)\([0-9]\) --> \1\2fn:\3

i.e. three groupings: 1) no whitespace, 2) "[" and 3) a number, and then
introducing "fn:" between "[" and the number: but it is not perfect, as
it still gives false positives; do you have something better?

The problem unfortunately arises also by pandoc still using the now
obsolete syntax of plain footnotes when converting (e.g. latex) to org
mode!


Gerald.


On Mi, Dez 21 2016, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> Hello,
>
> Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
>
>> I'm trying to convert older orgmode documents which have plain,
>> "[1]"-like footnotes into the newer "[fn:]" format.
>>
>> Can this be done automatically?
>
> You could use `query-replace-regexp' a.k.a. C-M-%.
>
>> Nicolas mentions "org-footnote-normalize" which would turn old footnotes
>> in new ones, but it does nothing in my case except adding a "*
>> Footnotes" entry.
>
> You misunderstood. `org-footnote-normalize' used to turn every footnote
> into [1], [2], ... whereas it now turns them into [fn:1], [fn:2],... IOW
> it cannot be used to convert from old syntax to new one.
>
> Regards,


--
Dr.Gerald Wildgruber
eikones NFS Bildkritik
NCCR Iconic Criticism
Universität Basel
Rheinsprung 11
CH-4051 Basel
www.eikones.ch
T. +41 (0)61 267 18 02
F. +41 (0)61 267 18 11
---------------------
Sent with mu4e

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

* Re: how to convert/normalize plain footnotes into [fn:] ones
  2016-12-21 16:48   ` Gerald Wildgruber
@ 2016-12-21 20:12     ` Nicolas Goaziou
  2016-12-23 13:57       ` Gerald Wildgruber
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2016-12-21 20:12 UTC (permalink / raw)
  To: Gerald Wildgruber; +Cc: org mode mailing list

Hello,

Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:

> I had actually tried that already and came up with the following regex:
>
> \([^ ]\)\(\[\)\([0-9]\) --> \1\2fn:\3
>
> i.e. three groupings: 1) no whitespace, 2) "[" and 3) a number, and then
> introducing "fn:" between "[" and the number: but it is not perfect, as
> it still gives false positives; do you have something better?

I would use (and, in fact, used)

 \\[\\([0-9]+\\)\\] --> \\[fn:\\1\\]

and eyeballing the results.

> The problem unfortunately arises also by pandoc still using the now
> obsolete syntax of plain footnotes when converting (e.g. latex) to org
> mode!

I'm certain Pandoc importer will ultimately catch-up.

Regards,

-- 
Nicolas Goaziou

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

* Re: how to convert/normalize plain footnotes into [fn:] ones
  2016-12-21 20:12     ` Nicolas Goaziou
@ 2016-12-23 13:57       ` Gerald Wildgruber
  0 siblings, 0 replies; 5+ messages in thread
From: Gerald Wildgruber @ 2016-12-23 13:57 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org mode mailing list


Hi Nicolas,

thanks again!

On Mi, Dez 21 2016, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> I would use (and, in fact, used)
>
>  \\[\\([0-9]+\\)\\] --> \\[fn:\\1\\]
>
> and eyeballing the results.

That works quite well; but as I'm trying to convert a whole book I also
have lots of "\cite[NUMBER]{my_ref}" commands from TeX; and these all
give false positives with the regex above. Actually I couldn't figure
out what a regex would have to look like that excludes occurences of the
mentioned expression if they are preceded by "cite".

>> The problem unfortunately arises also by pandoc still using the now
>> obsolete syntax of plain footnotes when converting (e.g. latex) to org
>> mode!
>
> I'm certain Pandoc importer will ultimately catch-up.

Yes, I posted the problem on the pandoc mailing list and Albert
Krewinkel kindly fixed it immediately and pushed the code to the dev
version of pandoc:

https://github.com/jgm/pandoc/commit/d27188ad309feb9a76f6dc3d816ad78722078fe1

I checked out the haskell source, compiled it and it works perfectly
now! The org writer produces the correct footnote format.

Gerald.

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

end of thread, other threads:[~2016-12-23 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 14:46 how to convert/normalize plain footnotes into [fn:] ones Gerald Wildgruber
2016-12-21 15:47 ` Nicolas Goaziou
2016-12-21 16:48   ` Gerald Wildgruber
2016-12-21 20:12     ` Nicolas Goaziou
2016-12-23 13:57       ` Gerald Wildgruber

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