From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SHAfKM5//mC9VgAAgWs5BA (envelope-from ) for ; Mon, 26 Jul 2021 11:26:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uKW1I85//mBzKAAAbx9fmQ (envelope-from ) for ; Mon, 26 Jul 2021 09:26:38 +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 11E7C131A7 for ; Mon, 26 Jul 2021 11:26:38 +0200 (CEST) Received: from localhost ([::1]:51684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7wse-0000kf-EB for larch@yhetil.org; Mon, 26 Jul 2021 05:26:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7wrJ-0000kH-Ex for emacs-orgmode@gnu.org; Mon, 26 Jul 2021 05:25:13 -0400 Received: from mout02.posteo.de ([185.67.36.66]:46997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7wrG-0000RU-LA for emacs-orgmode@gnu.org; Mon, 26 Jul 2021 05:25:13 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 7BAD7240103 for ; Mon, 26 Jul 2021 11:25:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1627291506; bh=xAITsNcKfHgFJwB1gUo4CDdMQ3aghylzCaPmOBpZ1b0=; h=From:To:Subject:Date:From; b=S5KhfWtF6do9gbbUDwU2JGIyLRTYCGILqjc+NG5NxRtGyVP5SR4FtwyTt1AYlHHFm LxQG2uyDGyA+SHOktX1IujAihDGXhdju9rrRWRyrFSwHaoY+3b0Cbw2FfpFn23RpWo FG8a/bXO5FHO0O8hNU/sQskUZqPOfvc0bptD6CnrfjosvpIPTrREhIMdKvnBRjuIZe BiSAW8E/eZD0ujxnNtTc6ct+zps3h2ahyWl50TY7TP7RTlt+ZwUOCRQE8f7/eDfKHn OR9AxNrsiW31aTgYb0IScBChTUcFFKW74lefHqgPGuvNs2BufPuQNrgZzRF+lyBYK4 BpV+SIyt3O0hQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GYDzP68W1z9rxH for ; Mon, 26 Jul 2021 11:25:05 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Multilingual quotes inside paragraphs Date: Mon, 26 Jul 2021 09:25:04 +0000 Message-ID: <87mtq9zatr.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de 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, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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=1627291598; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=juIlTZRIhdW48BN+wVODZYq5cR86NDJEx5uXVk+c9TE=; b=tslPZttls1s/Ke3Puhgf6kbhofgjQTmpdcIXDzlDqarZF607wotCDQiS+sTiEbaGp85mq8 RF/5SDLOGc19cJzlg+74clt6cGCpT6tkwY5Hq/ryryYs+QIZqrI/mm4G/TtOkGe40klMS7 oaVbneKf8U2L72Y1cV3q0BuLmMnbuZPyvSIsDOluUDO51JsPP9jrVnf1ehk1Xar9Sb667P MQk9F2XAMzLdAdvf33SPEKVG8kGp10plpD5o1XYEffLrh9PT6k14robAIHrlcu5jzkRtCZ 5PDbqYt5XlR4YYAK8YUIm4qmpjgZd9V3G174r0/ktO76++QVzlKelVHyD9vN+A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627291598; a=rsa-sha256; cv=none; b=CJLzaaSpebpO40mDFgNiE+utZjdhfDD1DahkVWVLoXLv3i1d7vcsrQb1bm5+r2QdlsNoo8 shfD2gT0Jrh2wHca+6oWgqzWQrwtrKUdu8rkTWnnhCuDI3Q1EVxZs5QCtdbl08L1XE57tw 8EksPJDU7wUMrWpz9Te9Ha5DYHw/FBDTPCX8qxn2iK8iOSPMAxQFNggq3t+guxHI4EK94y FC4v6cHBVsQfE2WE1Nlvv6x/iT5MlkGdYm5ZUNmnB3btTYmz+aHJEE1SFzQsAMjuh+MRkl agpj3U4yfSvUPsSr/3f+VJo++5jA2psXRgqv7u1g4PzxKtQTdyN7F9zoME961A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=S5KhfWtF; dmarc=pass (policy=none) header.from=posteo.net; 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.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=S5KhfWtF; dmarc=pass (policy=none) header.from=posteo.net; 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: 11E7C131A7 X-Spam-Score: -2.62 X-Migadu-Scanner: scn1.migadu.com X-TUID: ieWobAhb37Cd Hi all, I'm experimenting with `org-link-set-parameters' to create multilingual quotes (chunks of text) inside paragraphs. Although I focus mainly on the export to LaTeX with babel and csquotes packages, I also want extend support for HTML and odt output. I leave here some sketches. For the `:face' parameter I use for laziness a face already defined in Magit :-). `:display' with the value 'full can be removed. First, we have the LaTeX babel command \foreignlanguage{lang}{chunk of text}. The language can be expressed by abbreviation ("de" for German; here I reuse `org-latex-babel-language-alist') or explicitly preceded by a "!": "!german" (the reason for the latter is that in babel we can define new languages): [[lang:de][some text in German]] or [[lang:!german][some text in German]] The code: (org-link-set-parameters "lang" :display 'full :face 'magit-header-line-key :export (lambda (target desc format) (cond ((eq format 'latex) (let ((langs org-latex-babel-language-alist)) (concat "\\foreignlanguage{" (if (string-match-p "!" target) (replace-regexp-in-string "!" "" target) (cdr (assoc target langs))) "}{" desc "}"))) ;; TODO ((or (eq format 'html) (eq format 'odt)) (format "%s" desc))))) We also have this command from the csquotes package for foreign quoted texts (loads only the hyphenation rules for the language and sets the text between quotation marks): \hyphentextquote{lang}{quoted text}. For this I have defined a new link "qlang": (org-link-set-parameters "qlang" :display 'full :face 'magit-header-line-key :export (lambda (target desc format) (cond ((eq format 'latex) (let ((langs org-latex-babel-language-alist)) (concat "\\hyphentextquote{" (if (string-match-p "!" target) (replace-regexp-in-string "!" "" target) (cdr (assoc target langs))) "}{" desc "}"))) ((or (eq format 'html) (eq format 'odt)) ;; TODO (use here the proper quotes) (format "=C2=AB%s=C2=BB" desc))))) We can even make the citations come out in color when we are in draft mode, thanks to the LaTeX ifdraft package: (org-link-set-parameters "qlang" :display 'full :face 'magit-header-line-key :export (lambda (target desc format) (cond ((eq format 'latex) (let ((langs org-latex-babel-language-alist)) (concat "{\\ifdraft{\\color{teal}}{}\\hyphentextquote{" (if (string-match-p "!" target) (replace-regexp-in-string "!" "" target) (cdr (assoc target langs))) "}{" desc "}}"))) ((or (eq format 'html) (eq format 'odt)) ;; TODO (format "=C2=AB%s=C2=BB" desc))))) Best regards, Juan Manuel=20