From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id Xq7OAAMJjGDVhAEAgWs5BA (envelope-from ) for ; Fri, 30 Apr 2021 15:41:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SOXwNgIJjGByLwAAB5/wlQ (envelope-from ) for ; Fri, 30 Apr 2021 13:41:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 38C132561F for ; Fri, 30 Apr 2021 15:41:17 +0200 (CEST) Received: from localhost ([::1]:38750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcTOO-00023L-2X for larch@yhetil.org; Fri, 30 Apr 2021 09:41:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcTBm-0006K8-GU for emacs-orgmode@gnu.org; Fri, 30 Apr 2021 09:28:18 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:46235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcTBj-000445-Dl for emacs-orgmode@gnu.org; Fri, 30 Apr 2021 09:28:14 -0400 X-Originating-IP: 185.131.40.67 Received: from localhost (40-67.ipv4.commingeshautdebit.fr [185.131.40.67]) (Authenticated sender: admin@nicolasgoaziou.fr) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E2C2520009; Fri, 30 Apr 2021 13:28:07 +0000 (UTC) From: Nicolas Goaziou To: "Bruce D'Arcus" Subject: Re: wip-cite status question and feedback References: <874ktu8gr9.fsf@nicolasgoaziou.fr> <87img81ad7.fsf@gnu.org> <20210324182751.GA8721@atlantis> <87czuzprmh.fsf@nicolasgoaziou.fr> <87sg3neo0k.fsf@nicolasgoaziou.fr> <87eef35h7n.fsf@nicolasgoaziou.fr> <87a6pr5g4m.fsf@nicolasgoaziou.fr> <877dkt2pce.fsf@nicolasgoaziou.fr> <878s57fubm.fsf@nicolasgoaziou.fr> Mail-Followup-To: "Bruce D'Arcus" , =?utf-8?Q?Andr?= =?utf-8?Q?=C3=A1s?= Simonyi , "emacs-orgmode@gnu.org" Date: Fri, 30 Apr 2021 15:28:06 +0200 In-Reply-To: (Bruce D'Arcus's message of "Sat, 24 Apr 2021 14:39:34 -0400") Message-ID: <87mttfuck9.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=217.70.183.200; envelope-from=mail@nicolasgoaziou.fr; helo=relay7-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "emacs-orgmode@gnu.org" , =?utf-8?Q?Andr=C3=A1s?= Simonyi Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619790078; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3DnaGni7wYc9HsNddGHAf5AjPUffNg1q8QpsJhlXMSk=; b=rc6Y0jkHqo0ZzzCuRtd9mD1VB6zFMLxRrqhzC8zqjia7oeqd1d4ztN2niB2vPrF8L996uu jwMmSpXcZECfridlAoh/Bjuj043AVGw2RFZznllYXrvB8zvXaKOQRlKyyhahG2dquv9lC0 F4L8SzdtfJWUgvbC/EsR3HgjoIAqraHadrXA88hisR5uU3NVUcbYSyFrcQqPKDd2y/3Vxp znvD02O5pwedgEPgrmTaqOKWJuqavy/GZY5iJjBPCcD5BfCvd9pVWjDIGF1o9GCNC12hrR 8L+r53PApwn2x05ruNDdKyY3XcOymM2onMxzwMoACbusIgyQzb9GOLOFnfNVHQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619790078; a=rsa-sha256; cv=none; b=h1S2etqFMSlXXUICU/MWiwIlnxbAInn/XtdfweWugBXNN8mfXbNpTf5j2yQpGA60+bLmv0 mOpESKoR3ySqfvzAL/TzdaTxmoUmrOpH9vL56GrkLx8D+pCX5lj4mVBSDbT4PWjUAfesAj jwZkU4LcgtRWwK4KqaM5otaRKQ7kXNqmigIHcwqrS185wb0O8by3IsHLaqYF7zXUuj0xbZ WG7xSt49wzj92dRdFN4YprOUaFZ9sYG2Wd5oXqAchSSYOCQ3c1bjru7+uQuI/K/yPgiOPz qgDBH6VLwFVG4vEiguC1f9Xujgvj1CVL/0G1dhT7cy1cBHBGkmBB7zhgMjpEXQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.46 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 38C132561F X-Spam-Score: -2.46 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4XkTY9p8UYTK Hello, "Bruce D'Arcus" writes: > But an example from American English for illustration, derived from > Denis' examples. > > "A simple quote" [cite:@doe]. > > When rendered, that should be this in an author-date style: > > "A simple quote" (Doe 2021). > > ... and this in a note style: > > "A simple quote."[^1] > > So that rule would suggest something like: > > - if a citation concludes a sentence, move the note mark and whatever > trailing quotation mark, outside the period. > > But, Denis continues, "While this is perfectly acceptable in American > English, it is not in German, or even in British English. Here we have > to know whether the final period is part of the original quotation. If > yes, it will be put inside the quotes, otherwise outside." I'll paste > the rest of his examples at the end. > > It's possible his rule here is more general, and would still be > acceptable in American English. > > Does that help explain? OK. I wrote a POC, and I would appreciate some feedback about it. In order to test it, one need to evaluate the following, from an up-to-date "wip-cite-new" branch: --8<---------------cut here---------------start------------->8--- (defun org-cite--swap-punctuation (object info) "Move punctuation following OBJECT before it, if applicable. When OBJECT is followed by some terminal punctuation character, such as a period or a question mark, and preceded by some text, move the punctuation at the end of the previous text. If that text ends with a double quote, move the punctuation before that quote, too. INFO is the export state, as a property list." (let ((next (org-export-get-next-element object info)) (previous (org-last (org-element-map (org-export-get-previous-element object info) 'plain-text #'identity info))) (punct-re (rx string-start (group (or "." "!" "?" "..." "=E2=80=A6")) (or eol (any " " "\t"))))) (when (and previous (stringp next) (string-match punct-re next)) (let* ((punct (match-string 1 next)) (new-next (substring next (match-end 1))) (quote-re (rx (opt (and (group (or string-start (not (any "." "!" "?" "= =E2=80=A6")))) (group "\""))) (group (0+ (any " " "\t"))) string-end)) (new-previous (replace-regexp-in-string quote-re (concat "\\1" punct "\\2\\3") previous))) (org-element-set-element next new-next) (org-element-set-element previous new-previous))))) (defun org-cite-wrap-citation (citation info &optional move-punctuation) "Wrap an anonymous inline footnote around CITATION object in the parse tr= ee. INFO is the export state, as a property list. When optional argument MOVE-PUNCTUATION is non-nil, move punctuation character following citation = before it, when applicable. If a quotation mark precedes the citation, move punctuation before it, too. The parse tree is modified by side-effect." (let ((footnote (list 'footnote-reference (list :label nil :type 'inline :contents-begin (org-element-property :begin citation) :contents-end (org-element-property :end citation) :post-blank (org-element-property :post-blank citation= ))))) ;; Remove any white space before citation. (org-cite--set-previous-post-blank citation 0 info) ;; Possibly swap punctuation around citation. (when move-punctuation (org-cite--swap-punctuation citation info)) ;; Footnote swallows citation. (org-element-insert-before footnote citation) (org-element-adopt-elements footnote (org-element-extract-element citation)))) ;; test citation processor (defun test-export-citation (citation nil nil info) (org-cite-wrap-citation citation info t) "...") (org-cite-register-processor 'test :export-citation #'test-export-citation) --8<---------------cut here---------------end--------------->8--- For example, the following document: --8<---------------cut here---------------start------------->8--- #+cite_export: test This is a test [cite:@a]. This is a test [cite:@a]? This is a test [cite:@a]... This is a "test" [cite:@a]. This is a "test." [cite:@a]. This is a *"test"* [cite:@a]. This is a *some /covoluted/ "test"* [cite:@a]. # Do nothing in the following cases. This is a test [cite:@a] This is a test. [cite:@a] [cite:@a]. This is a "test" [cite:@a] --8<---------------cut here---------------end--------------->8--- would become in ASCII export (without the uninteresting footnotes part): --8<---------------cut here---------------start------------->8--- This is a test.[1] This is a test?[2] This is a test=E2=80=A6[3] This is a =C2=AB=C2=A0test.=C2=A0=C2=BB[4] This is a =C2=AB=C2=A0test.=C2=A0=C2=BB.[5] This is a *=C2=AB=C2=A0test.=C2=A0=C2=BB*[6] This is a *some /covoluted/ =C2=AB=C2=A0test.=C2=A0=C2=BB*[7] This is a test[8] This is a test.[9] [10]. This is a =C2=AB=C2=A0test=C2=A0=C2=BB[11] --8<---------------cut here---------------end--------------->8--- Is it what you had in mind? Also, I have questions about punctuation.=20 Currently, these changes only apply to terminal punctuation I could think of: . ! ? ... =E2=80=A6 Should the above apply to any punctuation, i.e., [:punct:]? Should it be limited to a different set of elements instead? If so which one? Should it be configurable? Regards, --=20 Nicolas Goaziou