emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ASCII export w/ citations
@ 2015-01-01 17:08 Ken Mankoff
  2015-01-01 18:36 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Ken Mankoff @ 2015-01-01 17:08 UTC (permalink / raw)
  To: Org-mode mailing list

Hi,

I have the following setup for citing in Org documents:

(org-add-link-type
 "textcite"  (lambda (key) (org-open-file cby-references-file t nil key))
 (lambda (path desc format)
   (cond
    ((eq format 'latex) (format "\\textcite{%s}" path))
    ((eq format 'ascii) (format "@%s" path))
    )))
(org-add-link-type
 "cite"  (lambda (key) (org-open-file cby-references-file t nil key))
 (lambda (path desc format)
   (cond
    ((eq format 'latex) (format "\\autocite{%s}" path))
    ((eq format 'ascii) (format "[@%s]" path))
    )))

When I export to ASCII, things look mostly great. Except, at the bottom
of every section, I have the "raw" Org citations repeated. That is, if I
[[cite:Foo2001]] somewhere in the text, at the bottom I'll see:

[(Foo, 2001)] cite:Foo2001

Can anyone explain why ASCII export is repeating the "raw" cite commands
at the bottom of each section and/or how to turn this off?

Thanks,

  -k.
  

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

* Re: ASCII export w/ citations
  2015-01-01 17:08 ASCII export w/ citations Ken Mankoff
@ 2015-01-01 18:36 ` Nicolas Goaziou
  2015-01-01 18:59   ` Ken Mankoff
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2015-01-01 18:36 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: Org-mode mailing list

Hello,

Ken Mankoff <mankoff@gmail.com> writes:

> I have the following setup for citing in Org documents:
>
> (org-add-link-type
>  "textcite"  (lambda (key) (org-open-file cby-references-file t nil key))
>  (lambda (path desc format)
>    (cond
>     ((eq format 'latex) (format "\\textcite{%s}" path))
>     ((eq format 'ascii) (format "@%s" path))
>     )))
> (org-add-link-type
>  "cite"  (lambda (key) (org-open-file cby-references-file t nil key))
>  (lambda (path desc format)
>    (cond
>     ((eq format 'latex) (format "\\autocite{%s}" path))
>     ((eq format 'ascii) (format "[@%s]" path))
>     )))
>
> When I export to ASCII, things look mostly great. Except, at the bottom
> of every section, I have the "raw" Org citations repeated. That is, if I
> [[cite:Foo2001]] somewhere in the text, at the bottom I'll see:
>
> [(Foo, 2001)] cite:Foo2001
>
> Can anyone explain why ASCII export is repeating the "raw" cite commands
> at the bottom of each section and/or how to turn this off?

See `org-ascii-links-to-notes'.


Regards,

-- 
Nicolas Goaziou

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

* Re: ASCII export w/ citations
  2015-01-01 18:36 ` Nicolas Goaziou
@ 2015-01-01 18:59   ` Ken Mankoff
  2015-01-01 19:32     ` Ken Mankoff
  2015-01-01 20:45     ` Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: Ken Mankoff @ 2015-01-01 18:59 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list


* On 2015-01-01 at 13:36, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>> When I export to ASCII, things look mostly great. Except, at the
>> bottom of every section, I have the "raw" Org citations repeated.
>> That is, if I [[cite:Foo2001]] somewhere in the text, at the bottom
>> I'll see:
>>
>> [(Foo, 2001)] cite:Foo2001
>>
>> Can anyone explain why ASCII export is repeating the "raw" cite
>> commands at the bottom of each section and/or how to turn this off?
>
> See `org-ascii-links-to-notes'.

OK. If I set that to nil then the links are not at the bottom of the
section, they are inline. But ASCII (in my opinion) shouldn't have
links. If I wanted links, I'd use Org or Markdown. Can you advise how I
get no links (or is it no notes?) at all?

  -k.

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

* Re: ASCII export w/ citations
  2015-01-01 18:59   ` Ken Mankoff
@ 2015-01-01 19:32     ` Ken Mankoff
  2015-01-01 20:45     ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Ken Mankoff @ 2015-01-01 19:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list


* On 2015-01-01 at 13:59, Ken Mankoff <mankoff@gmail.com> wrote:
> OK. If I set that to nil then the links are not at the bottom of the
> section, they are inline. But ASCII (in my opinion) shouldn't have
> links. If I wanted links, I'd use Org or Markdown. Can you advise how
> I get no links (or is it no notes?) at all?

I can get the behavior I want (I think) if I
redefine 'org-ascii--describe-links' to return nil:

> (defun org-ascii--describe-links (links width info)
>   nil)

Seems to work for me (for now). Is this a bad idea?

  -k.

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

* Re: ASCII export w/ citations
  2015-01-01 18:59   ` Ken Mankoff
  2015-01-01 19:32     ` Ken Mankoff
@ 2015-01-01 20:45     ` Nicolas Goaziou
  2015-01-02 14:58       ` Ken Mankoff
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2015-01-01 20:45 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: Org-mode mailing list

Ken Mankoff <mankoff@gmail.com> writes:

> OK. If I set that to nil then the links are not at the bottom of the
> section, they are inline. But ASCII (in my opinion) shouldn't have
> links.

I disagree. It is a bug to silently ignore every link in ASCII export.

> Can you advise how I get no links (or is it no notes?) at all?

You want links. Otherwise it is contradictory with your custom export
function.

Anyway, custom export functions during ASCII export are not supported in
8.2.10. I fixed it in 8.3. You may want to update Org to test the new
behaviour.

Regards,

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

* Re: ASCII export w/ citations
  2015-01-01 20:45     ` Nicolas Goaziou
@ 2015-01-02 14:58       ` Ken Mankoff
  2015-01-02 20:42         ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Ken Mankoff @ 2015-01-02 14:58 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list


* On 2015-01-01 at 15:45, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Anyway, custom export functions during ASCII export are not supported
> in 8.2.10. I fixed it in 8.3. You may want to update Org to test the
> new behaviour.

I don't see mention of custom export functions in the manual. Is there a
page describing how I would use these, or can you provide an example
that would stop printing of links in ASCII export?

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

* Re: ASCII export w/ citations
  2015-01-02 14:58       ` Ken Mankoff
@ 2015-01-02 20:42         ` Nicolas Goaziou
  2015-01-02 21:52           ` Ken Mankoff
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2015-01-02 20:42 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: Org-mode mailing list

Ken Mankoff <mankoff@gmail.com> writes:

> I don't see mention of custom export functions in the manual. Is there a
> page describing how I would use these, or can you provide an example
> that would stop printing of links in ASCII export?

In your initial mail, you wrote

  (org-add-link-type
   "cite"  (lambda (key) (org-open-file cby-references-file t nil key))
   (lambda (path desc format)
     (cond
      ((eq format 'latex) (format "\\autocite{%s}" path))
      ((eq format 'ascii) (format "[@%s]" path))
      )))

The second lambda is a custom export function for "cite" links.

Anyway, I think you should update Org as the behaviour is different than
in your initial mail.

BTW, if you want to remove all links from ASCII export, use an export
filter.

Regards,

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

* Re: ASCII export w/ citations
  2015-01-02 20:42         ` Nicolas Goaziou
@ 2015-01-02 21:52           ` Ken Mankoff
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Mankoff @ 2015-01-02 21:52 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list



* On 2015-01-02 at 15:42, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Ken Mankoff <mankoff@gmail.com> writes:
>
> In your initial mail, you wrote
>
>   (org-add-link-type
>    "cite"  (lambda (key) (org-open-file cby-references-file t nil key))
>    (lambda (path desc format)
>      (cond
>       ((eq format 'latex) (format "\\autocite{%s}" path))
>       ((eq format 'ascii) (format "[@%s]" path))
>       )))
>
> The second lambda is a custom export function for "cite" links.
>
> Anyway, I think you should update Org as the behaviour is different
> than in your initial mail.

Yes everything works well now with the updated (Git) Org.

Thanks,

  -k.

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

end of thread, other threads:[~2015-01-02 21:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01 17:08 ASCII export w/ citations Ken Mankoff
2015-01-01 18:36 ` Nicolas Goaziou
2015-01-01 18:59   ` Ken Mankoff
2015-01-01 19:32     ` Ken Mankoff
2015-01-01 20:45     ` Nicolas Goaziou
2015-01-02 14:58       ` Ken Mankoff
2015-01-02 20:42         ` Nicolas Goaziou
2015-01-02 21:52           ` Ken Mankoff

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