From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2NalIzMN1WWY3QAA62LTzQ:P1 (envelope-from ) for ; Tue, 20 Feb 2024 21:36:03 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 2NalIzMN1WWY3QAA62LTzQ (envelope-from ) for ; Tue, 20 Feb 2024 21:36:03 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fyjBzZRg; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708461363; 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=e3aUHkhqj9Xfw22VEGM6GcpI/Jc2cxj2gpn1rm0aRfA=; b=RMeb0cuwBM4TobcdR7CLAdoK2Ob5OZJbRcPDl6FCN07GkLZDvYlhD0BLFv3sYwuCXrGwn+ ZphOqiCVXtQW58Sy02fpjisDLOK/Cj4HtAceMzfNqXdyucwDtTtwqhmeD7I8d9Cc8dgiz5 wuletuVfB/9L5+xqlt09Onb6FyIyuyeKA9VlnJi3fbC+E68FWFDkP0oX3vSjosPzRBQRuy CUkOWTLcNop7qhNSo6x5hZGtYSr5m1re00CL7uA/T4czXhfyx7qrJrVsXoAjtbCkrDUqJa IhHX2+1Vradie2u/55xfXFPXurwo74TtJcU8UyydgQQpTQp0kB+gUZfPksJEPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fyjBzZRg; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708461363; a=rsa-sha256; cv=none; b=fezwn0BRuLH+yettDPAjJczGBi1P3hxd4H/0icTggzm7p1tesR2OmRhk1AzVw9H7Xxaqnr B6obBOvs/6QzXknpKqWOW3gNVR9Z9Y+lofzVzTEoJVDzmGmMrY4WM/xS0pGk+KeUWS2SIy Ryr41VVCAe8ji09YJ1Qbmv1z/pOfmjt0bqa4Lq0+mJpiS9bSo4UNEPVaKuhqJHVjNdoY3C CqVV4W1yZy/q7jtE3DfpGoBfbxuxu0drUxtq0/P2JzXmeFbEAXWLa9PmgAVW3CF14z42lD MScyMetp1/e4V9+/85SdfA9QDevZrlSwvdvsFagRR/YSPg+TOHVxvu1g134+Wg== 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 77DAB241E0 for ; Tue, 20 Feb 2024 21:36:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcWph-0000Ju-AW; Tue, 20 Feb 2024 15:35:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcWpf-0000JX-C4 for emacs-orgmode@gnu.org; Tue, 20 Feb 2024 15:35:15 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcWpb-00021Y-DL for emacs-orgmode@gnu.org; Tue, 20 Feb 2024 15:35:15 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 08506240103 for ; Tue, 20 Feb 2024 21:35:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708461307; bh=lr99Brj4BZCD35myJ1TdoKK9UaIAW5F9CzZSne8VfFk=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=fyjBzZRg29vkd/XDMHxyQbeTgTwtI/aFmSya2RJvC2hZQkwlSGO5wyiZ1fvnkuzhd 6Yl7/W5zYBgJLy0YdyF5fnqXBT2AkHU78nynC4ry9ea5naFqUaF26vNWqH7vflFrzq pNAGUGTgHNiaqIUqBaof0DwXSRky0jBfFrCBvhUBY2gvWCVLbdunDxg1ieVHDGStU+ zkWpPvek0MdeKZpmqpv43yuaQGtMNaPPhIw+p6PEO9rpaamd86YCcTDF4+BWnw9ab1 eFyqOjeT7s214l5XSBqW+yrP16pts6OkQDU6liKNnGJcOuCzJ1FTAF3kxSM7AoMWo/ HWHGtPWi8/ihw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TfWP635msz9rxB for ; Tue, 20 Feb 2024 21:35:06 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: [proof of concept] inline language blocks Date: Tue, 20 Feb 2024 20:35:04 +0000 Message-ID: <87msrudgcn.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: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -10.19 X-Spam-Score: -10.19 X-Migadu-Queue-Id: 77DAB241E0 X-TUID: Ws81MBDotE0b Hi, I'm dedicating a local branch to developing this proof of concept and testing it in my workflow, so far with good results. The basic idea is to provide Org with multilingual features and various methods for selecting languages. The inline-language-block is intended for small segments of text in a language other than the main language. They can span several lines but not more than a paragraph. They can be used for in-line textual quotes, glosses, etc. They are constructions equivalent to, for example, LaTeX \foreignlanguage{french}{text} or HTML text. I have thought of a syntax that is as least intrusive as possible, so as not to make reading uncomfortable. I have tried the following: :fr{some text in French} :it{some text in Italian} :la{some text in Latin} You can also use a literal term instead of a language code: :klingon!{some text in Klingon} The blocks can be nested: :klingon!{Some text in Klingon with :it{some text in Italian}} And they may include other elements: :el{Some text in Greek with a {{{macro}}} and a [[link]]} To this end, I have defined the following element: #+begin_src emacs-lisp (defun org-element-inline-language-block-parser () "Parse inline language block at point. When at an inline language block, return a new syntax node of `inline-language-block' type containing `:begin', `:end', `:type', `:contents-begin', `:contents-end' and `:post-blank' as properties. Otherwise, return nil. Assume point is at the beginning of the block." (save-excursion (when (looking-at ":\\([A-Za-z!]+\\){") (goto-char (match-end 0)) (let* ((begin (match-beginning 0)) (contents-begin (match-end 0)) (type (org-element--get-cached-string (match-string-no-properties 1))) (contents-end (progn (goto-char (- contents-begin 1)) (org-element--parse-paired-brackets ?\{) (- (point) 1))) (post-blank (skip-chars-forward " \t")) (end (point))) (when contents-end (org-element-create 'inline-language-block (list :type type :contents-begin contents-begin :contents-end contents-end :begin begin :end end :post-blank post-blank))))))) (defun org-element-inline-language-block-interpreter (inline-language-block= contents) "Interpret INLINE LANGUAGE BLOCK object as Org syntax." (format ":%s{%s}" (org-element-property :type inline-language-block) contents)) #+end_src And, for now, this function for ox-latex: #+begin_src emacs-lisp (defun org-latex-inline-language-block (inline-language-block contents info) "Transcode an INLINE LANGUAGE BLOCK element from Org to LaTeX. CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let ((type (org-element-property :type inline-language-block))) (if (string-match-p "!" type) (format "\\foreignlanguage{%s}{%s}" (replace-regexp-in-string "!" "" type) contents) (let* ((plist (cdr (assoc type org-latex-language-alist))) (language (plist-get plist :babel)) (language-ini-only (plist-get plist :babel-ini-only)) (language-ini-alt (plist-get plist :babel-ini-alt)) (lang (or language language-ini-only language-ini-alt))) (format "\\foreignlanguage{%s}{%s}" lang contents))))) #+end_src Opinions, suggestions, feedback, ideas? Best regards, Juan Manuel -- Juan Manuel Mac=C3=ADas -- Composici=C3=B3n tipogr=C3=A1fica, tratamiento d= e datos, dise=C3=B1o editorial y ortotipograf=C3=ADa