From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UClBMUV+jGCXJgEAgWs5BA (envelope-from ) for ; Sat, 01 May 2021 00:01:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id aO/kLEV+jGAOBAAAB5/wlQ (envelope-from ) for ; Fri, 30 Apr 2021 22:01:41 +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 0A91027279 for ; Sat, 1 May 2021 00:01:41 +0200 (CEST) Received: from localhost ([::1]:34688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcbCe-0001On-6n for larch@yhetil.org; Fri, 30 Apr 2021 18:01:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcazb-0005nx-Lu for emacs-orgmode@gnu.org; Fri, 30 Apr 2021 17:48:11 -0400 Received: from mout-p-202.mailbox.org ([2001:67c:2050::465:202]:19086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1lcazW-00009W-U4 for emacs-orgmode@gnu.org; Fri, 30 Apr 2021 17:48:11 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4FX5Zl6qwKzQk17; Fri, 30 Apr 2021 23:47:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:date:date:message-id:from:from:references:subject :subject:received; s=mail20150812; t=1619819276; bh=4h2DTcLAatJI fW0AXtRT9DkGJfFlIwUZd83dmjGAiLI=; b=RsG38zmkUB7rrkg3u6mDYJkR614p blSypIgVYgX0027XQNftDLthmuE4YAcJvZtLg7p3a9JkppGGQs3PFmr5AzDYf+Nr wl66V2D1qIob7b5HKgTd91OpIB8nK3qLjFxfY3B8nJVENwYRGCMwjoc10mAfTfl3 kBFucqMzoicTYCAOunqpIs3LZUHEQeF1VZNh7mzmuew7PZFT0kXyT5QgxtDaJYAs ive1KyyjAlBxBc0kDwo4y447AUfUvwX/lHR9chI0Dhs5CPPviOXHFXuVZiuGn0Yy MA31RUwEMDrHqAR2tEJd/lPKFKKjclXLLnpcuX1bwphajNwfvNt2XLYVOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1619819278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c4cmCDYoBBjAWjaZNWTacMDTfZe8ypBJPq5Hdpr7wLo=; b=j+T+1ceEYi+hUUWNnU/fORHnsQA3v4TC5qw0Oj0MnhetF2as+Hc/8sK6Ga/oh7/L0GDlm2 85COeKQKeP03o5pB66+VLwXGeDllHqZ8IxSpN32kxFT99Yf+pE5lY3IjA7nWNNwdKIcDap 60zG7OG6xECTCIW1b6f1sdQPGURkQwysBXsm4nsfJBNcKjXlabPSo/ozOyXTL/eRhmKwP3 AFhZmEIx5tPnKzd9MLO6+geThWz2H1O7lFYvUf6TSfEtecv/6dW3CwhFs/horXo/6t8zCI 7xd/AmfgUQT3gmRR8p6iKjZWve+p5n6riDIlseTotWIgKXMpuc+S4NtQHlAopw== X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id 4sAdkRN3TQko; Fri, 30 Apr 2021 23:47:56 +0200 (CEST) Subject: Re: wip-cite status question and feedback To: Bruce D'Arcus , =?UTF-8?Q?Andr=c3=a1s_Simonyi?= , "emacs-orgmode@gnu.org" References: <874ktu8gr9.fsf@nicolasgoaziou.fr> <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> <87mttfuck9.fsf@nicolasgoaziou.fr> From: Denis Maier Message-ID: <897892c5-db81-af4e-f265-c89f9d4974b1@mailbox.org> Date: Fri, 30 Apr 2021 23:47:56 +0200 MIME-Version: 1.0 In-Reply-To: <87mttfuck9.fsf@nicolasgoaziou.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-MBO-SPAM-Probability: X-Rspamd-Score: -3.65 / 15.00 / 15.00 X-Rspamd-Queue-Id: ED70A243 X-Rspamd-UID: a3339e Received-SPF: pass client-ip=2001:67c:2050::465:202; envelope-from=denismaier@mailbox.org; helo=mout-p-202.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: , 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=1619820101; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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:dkim-signature; bh=c4cmCDYoBBjAWjaZNWTacMDTfZe8ypBJPq5Hdpr7wLo=; b=jUjyuuz2ycyiTSwSOFdJaF5V3I0wREd+1y/GZoyPU+HIk63G8c4ZVMhODeg1nw4VdPJKRZ wTQqQ2Ew6odm/AsoB6X3896xyhqb43D9WRrAhPjCpanao5RYxyKU7KP+0dNl9QnZL6Ag8y maJ8TilK8DQJ9eJw4y5Pa1MaphcFbveoxk+1NodUWcSwuyNB18zkrarAjFU+fJVwIzkxGD NACIeDoOxpOGd4bV6L7h/EbYbU7W62wmGKJ61ud4QLr6dqjGsUa02ro4mFgaoebvuOtap8 0cnwiXQ1e9aUmI8rNJ5hMLGB6IzJtRx3+hzJ7kCg5hJMlaGDhFy8chTt4rJgXg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619820101; a=rsa-sha256; cv=none; b=lnbhTz4nRC5JZDsMi9tGUvCt1j3U2izasWCM1NxpSw0Cv6/aSTXo6WUGMbkoXxkAJmTwnX sbfdmtXMjfpT8MIG5hyF5waqAtIwSDMj1mQeVGAEw99FlJ0S3n7C8Sdj6VDTptdX8axxo6 TU8hz4haLoK6glodfKLQvJOyFaEidIclFVZ/Xt9K6IsAwW0VJAixwC+OZ8EO1IqQnQQoYv N+xJEuRegdl/oA+RHto2PIRY0zTXsTx46EOsiWVzFaZGHNatPPiIXVhEGQn3br5DTYCd9t urgF9OIHyrqFflmmQokH5eP8YL2FuusRZMYOktyqeiuKlBf+wQ3Qm94w/ZNiQg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=RsG38zmk; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=j+T+1ceE; 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: -3.16 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=RsG38zmk; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=j+T+1ceE; dmarc=pass (policy=reject) header.from=mailbox.org; 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: 0A91027279 X-Spam-Score: -3.16 X-Migadu-Scanner: scn0.migadu.com X-TUID: UpD+FkG07Yg2 Hi Nicolas, thanks for all you work on this one. I don't have a setup where I can test this, but from what I can tell this looks quite good already. Am 30.04.2021 um 15:28 schrieb Nicolas Goaziou: [...] > > 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 "." "!" "?" "..." "…")) > (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 "." "!" "?" "…")))) > (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 tree. > > 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…[3] > > This is a « test. »[4] > > This is a « test. ».[5] > > This is a *« test. »*[6] > > This is a *some /covoluted/ « test. »*[7] > > This is a test[8] > > This is a test.[9] > > [10]. > > This is a « test »[11] > --8<---------------cut here---------------end--------------->8--- > > Is it what you had in mind? Yes, this should be equivalent to the behaviour in pandoc. However, as I've said before, this behaviour is only correct in American English. TO quuote the Chicago Manual of Style 6.9: "In an alternative system, sometimes called British Style (as described in the /New Oxford Style Manual ...) ... only those punctuation points that appeared in the original material are included within the quotation marks." The same would be correct for German. Do you have an idea if/how this could be implemented? > > Also, I have questions about punctuation. > > Currently, these changes only apply to terminal punctuation I could > think of: . ! ? ... … > > 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? Again the Chicago Manual, 6.10: "Colons and semicolons---unlike periods and commas---follow closing quotation marks; question marks and exclamation points follow closing quoation marks unless they belong within the quoted matter." I don't know if there is a general rule and how much of this should be configurable. How costly would that be? > > Regards, >