emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [wip-cite-new] Adjust punctuation around citations


From: Nicolas Goaziou
Subject: Re: [wip-cite-new] Adjust punctuation around citations
Date: Sat, 15 May 2021 13:43:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello,

Denis Maier writes:

> Regarding French typography.
> With this example:
> ---------------------------------------------------
>
> #+language: fr
> #+cite_export: test
>
> "This is a complete sentence."[cite:@key]
>
> "This is an incomplete sentence" [cite:@key].

[...]

> I'm getting:
>
> ----------------------------------------------------
> "This is a complete sentence[1]."
>
> "This is an incomplete sentence[2]" .

[...]

> 2 is a bit odd.
> - there's the spurios space before the period.
> - I think in that case the footnote mark should be just before the 
> period, i.e. after the quotation mark. Basically like example 3.

[...]

> I don't know if that is feasible with the current parameters.

It is not. I added a `same' parameter for citation to achieve it. I also
fixed the space error.

You can try again with the following processor:

--8<---------------cut here---------------start------------->8---
(defun org-test--language-to-rule (info)
  (pcase (plist-get info :language)
    ("en-us" '(inside outside after))
    ((or "en" "de" "en-gb") '(static outside after))
    ("fr" '(static same before))
    (_ nil)))

(defun org-test-export-citation (citation style _backend info)
  (pcase style
    ("author-year"
     (org-cite-adjust-punctuation citation '(outside outside before) info nil t)
     "(John Doe, 1999)")
    (_
     (pcase (org-test--language-to-rule info)
       (`nil nil)
       (rule (org-cite-adjust-punctuation citation rule info)))
     (unless (org-cite-inside-footnote-p citation)
       (org-cite-wrap-citation citation info))
     "...")))

(org-cite-register-processor 'test
  :export-citation #'org-test-export-citation)
--8<---------------cut here---------------end--------------->8---

I'll comment further in another message.

Regards,
-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]