* [RFC] Introduce ox-i18n.el
@ 2013-06-29 14:06 Nicolas Goaziou
2013-06-29 15:01 ` Bastien
` (3 more replies)
0 siblings, 4 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2013-06-29 14:06 UTC (permalink / raw)
To: Org Mode List
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
Hello,
I would like to move every variable and function related to
internationalization (i.e smart quotes and translations) in a dedicated
file ("ox-i18n.el") instead of "ox.el".
Considering "ox.el" is 6k lines long, I think it can be a bit tedious to
locate and modify internationalization entries. And since we are missing
quite a few translations, every little bit can help.
Patch follows.
Any objection?
Regards,
--
Nicolas Goaziou
[-- Attachment #2: 0001-ox-Move-internationalization-variables-and-functions.patch --]
[-- Type: text/x-diff, Size: 34047 bytes --]
From b78ba32530c8f45ad89fd4515a0f91bddb1b9017 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sat, 29 Jun 2013 15:55:45 +0200
Subject: [PATCH] ox: Move internationalization variables and functions to a
dedicated library
* lisp/ox-i18n.el: New file.
* lisp/ox.el (org-export-smart-quotes-alist,
org-export-smart-quotes-regexps, org-export-dictionary): Remove
variables.
(org-export-activate-smart-quotes, org-export-translate): Remove
functions.
---
lisp/ox-i18n.el | 411 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lisp/ox.el | 375 +--------------------------------------------------
2 files changed, 412 insertions(+), 374 deletions(-)
create mode 100644 lisp/ox-i18n.el
diff --git a/lisp/ox-i18n.el b/lisp/ox-i18n.el
new file mode 100644
index 0000000..8b7b102
--- /dev/null
+++ b/lisp/ox-i18n.el
@@ -0,0 +1,411 @@
+;;; ox-i18n.el --- Internationalization Bindings for Org Export Framework
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; Author: Nicolas Goaziou <n.goaziou gmail dot com>
+;; Keywords: outlines, hypermedia, calendar, wp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This library introduces variables and functions for
+;; internationalization of Org mode buffer during export. It
+;; comprises two parts: "Translations" and "Smart Quotes".
+
+;;; Code:
+
+\f
+;;; Translations
+;;
+;; `org-export-translate' translates a string according to language
+;; specified by LANGUAGE keyword or `org-export-language-setup'
+;; variable and a specified charset. `org-export-dictionary' contains
+;; the dictionary used for the translation.
+
+(defconst org-export-dictionary
+ '(("%e %n: %c"
+ ("fr" :default "%e %n : %c" :html "%e %n : %c"))
+ ("Author"
+ ("ca" :default "Autor")
+ ("cs" :default "Autor")
+ ("da" :default "Ophavsmand")
+ ("de" :default "Autor")
+ ("eo" :html "Aŭtoro")
+ ("es" :default "Autor")
+ ("fi" :html "Tekijä")
+ ("fr" :default "Auteur")
+ ("hu" :default "Szerzõ")
+ ("is" :html "Höfundur")
+ ("it" :default "Autore")
+ ("ja" :html "著者" :utf-8 "著者")
+ ("nl" :default "Auteur")
+ ("no" :default "Forfatter")
+ ("nb" :default "Forfatter")
+ ("nn" :default "Forfattar")
+ ("pl" :default "Autor")
+ ("ru" :html "Автор" :utf-8 "Автор")
+ ("sv" :html "Författare")
+ ("uk" :html "Автор" :utf-8 "Автор")
+ ("zh-CN" :html "作者" :utf-8 "作者")
+ ("zh-TW" :html "作者" :utf-8 "作者"))
+ ("Date"
+ ("ca" :default "Data")
+ ("cs" :default "Datum")
+ ("da" :default "Dato")
+ ("de" :default "Datum")
+ ("eo" :default "Dato")
+ ("es" :default "Fecha")
+ ("fi" :html "Päivämäärä")
+ ("hu" :html "Dátum")
+ ("is" :default "Dagsetning")
+ ("it" :default "Data")
+ ("ja" :html "日付" :utf-8 "日付")
+ ("nl" :default "Datum")
+ ("no" :default "Dato")
+ ("nb" :default "Dato")
+ ("nn" :default "Dato")
+ ("pl" :default "Data")
+ ("ru" :html "Дата" :utf-8 "Дата")
+ ("sv" :default "Datum")
+ ("uk" :html "Дата" :utf-8 "Дата")
+ ("zh-CN" :html "日期" :utf-8 "日期")
+ ("zh-TW" :html "日期" :utf-8 "日期"))
+ ("Equation"
+ ("de" :default "Gleichung")
+ ("es" :html "Ecuación" :default "Ecuación")
+ ("fr" :ascii "Equation" :default "Équation"))
+ ("Figure"
+ ("de" :default "Abbildung")
+ ("es" :default "Figura")
+ ("ja" :html "図" :utf-8 "図"))
+ ("Figure %d:"
+ ("de" :default "Abbildung %d:")
+ ("es" :default "Figura %d:")
+ ("fr" :default "Figure %d :" :html "Figure %d :")
+ ("ja" :html "図%d:" :utf-8 "図%d:"))
+ ("Footnotes"
+ ("ca" :html "Peus de pàgina")
+ ("cs" :default "Pozn\xe1mky pod carou")
+ ("da" :default "Fodnoter")
+ ("de" :html "Fußnoten" :default "Fußnoten")
+ ("eo" :default "Piednotoj")
+ ("es" :html "Nota al pie de página" :default "Nota al pie de página")
+ ("fi" :default "Alaviitteet")
+ ("fr" :default "Notes de bas de page")
+ ("hu" :html "Lábjegyzet")
+ ("is" :html "Aftanmálsgreinar")
+ ("it" :html "Note a piè di pagina")
+ ("ja" :html "脚注" :utf-8 "脚注")
+ ("nl" :default "Voetnoten")
+ ("no" :default "Fotnoter")
+ ("nb" :default "Fotnoter")
+ ("nn" :default "Fotnotar")
+ ("pl" :default "Przypis")
+ ("ru" :html "Сноски" :utf-8 "Сноски")
+ ("sv" :default "Fotnoter")
+ ("uk" :html "Примітки"
+ :utf-8 "Примітки")
+ ("zh-CN" :html "脚注" :utf-8 "脚注")
+ ("zh-TW" :html "腳註" :utf-8 "腳註"))
+ ("List of Listings"
+ ("de" :default "Programmauflistungsverzeichnis")
+ ("es" :default "Indice de Listados de programas")
+ ("fr" :default "Liste des programmes"))
+ ("List of Tables"
+ ("de" :default "Tabellenverzeichnis")
+ ("es" :default "Indice de tablas")
+ ("fr" :default "Liste des tableaux"))
+ ("Listing %d:"
+ ("de" :default "Programmlisting %d")
+ ("es" :default "Listado de programa %d")
+ ("fr" :default "Programme %d :" :html "Programme %d :"))
+ ("See section %s"
+ ("de" :default "siehe Abschnitt %s")
+ ("es" :default "vea seccion %s")
+ ("fr" :default "cf. section %s"))
+ ("Table"
+ ("de" :default "Tabelle")
+ ("es" :default "Tabla")
+ ("fr" :default "Tableau")
+ ("ja" :html "表" :utf-8 "表"))
+ ("Table %d:"
+ ("de" :default "Tabelle %d")
+ ("es" :default "Tabla %d")
+ ("fr" :default "Tableau %d :")
+ ("ja" :html "表%d:" :utf-8 "表%d:"))
+ ("Table of Contents"
+ ("ca" :html "Índex")
+ ("cs" :default "Obsah")
+ ("da" :default "Indhold")
+ ("de" :default "Inhaltsverzeichnis")
+ ("eo" :default "Enhavo")
+ ("es" :html "Índice")
+ ("fi" :html "Sisällysluettelo")
+ ("fr" :ascii "Sommaire" :default "Table des matières")
+ ("hu" :html "Tartalomjegyzék")
+ ("is" :default "Efnisyfirlit")
+ ("it" :default "Indice")
+ ("ja" :html "目次" :utf-8 "目次")
+ ("nl" :default "Inhoudsopgave")
+ ("no" :default "Innhold")
+ ("nb" :default "Innhold")
+ ("nn" :default "Innhald")
+ ("pl" :html "Spis treści")
+ ("ru" :html "Содержание"
+ :utf-8 "Содержание")
+ ("sv" :html "Innehåll")
+ ("uk" :html "Зміст" :utf-8 "Зміст")
+ ("zh-CN" :html "目录" :utf-8 "目录")
+ ("zh-TW" :html "目錄" :utf-8 "目錄"))
+ ("Unknown reference"
+ ("de" :default "Unbekannter Verweis")
+ ("es" :default "referencia desconocida")
+ ("fr" :ascii "Destination inconnue" :default "Référence inconnue")))
+ "Dictionary for export engine.
+
+Alist whose CAR is the string to translate and CDR is an alist
+whose CAR is the language string and CDR is a plist whose
+properties are possible charsets and values translated terms.
+
+It is used as a database for `org-export-translate'. Since this
+function returns the string as-is if no translation was found,
+the variable only needs to record values different from the
+entry.")
+
+(defun org-export-translate (s encoding info)
+ "Translate string S according to language specification.
+
+ENCODING is a symbol among `:ascii', `:html', `:latex', `:latin1'
+and `:utf-8'. INFO is a plist used as a communication channel.
+
+Translation depends on `:language' property. Return the
+translated string. If no translation is found, try to fall back
+to `:default' encoding. If it fails, return S."
+ (let* ((lang (plist-get info :language))
+ (translations (cdr (assoc lang
+ (cdr (assoc s org-export-dictionary))))))
+ (or (plist-get translations encoding)
+ (plist-get translations :default)
+ s)))
+
+
+\f
+;;; Smart Quotes
+;;
+;; The main function for the smart quotes sub-system is
+;; `org-export-activate-smart-quotes', which replaces every quote in
+;; a given string from the parse tree with its "smart" counterpart.
+;;
+;; Dictionary for smart quotes is stored in
+;; `org-export-smart-quotes-alist'.
+;;
+;; Internally, regexps matching potential smart quotes (checks at
+;; string boundaries are also necessary) are defined in
+;; `org-export-smart-quotes-regexps'.
+
+(defconst org-export-smart-quotes-alist
+ '(("de"
+ (opening-double-quote :utf-8 "„" :html "„" :latex "\"`"
+ :texinfo "@quotedblbase{}")
+ (closing-double-quote :utf-8 "“" :html "“" :latex "\"'"
+ :texinfo "@quotedblleft{}")
+ (opening-single-quote :utf-8 "‚" :html "‚" :latex "\\glq{}"
+ :texinfo "@quotesinglbase{}")
+ (closing-single-quote :utf-8 "‘" :html "‘" :latex "\\grq{}"
+ :texinfo "@quoteleft{}")
+ (apostrophe :utf-8 "’" :html "’"))
+ ("en"
+ (opening-double-quote :utf-8 "“" :html "“" :latex "``" :texinfo "``")
+ (closing-double-quote :utf-8 "”" :html "”" :latex "''" :texinfo "''")
+ (opening-single-quote :utf-8 "‘" :html "‘" :latex "`" :texinfo "`")
+ (closing-single-quote :utf-8 "’" :html "’" :latex "'" :texinfo "'")
+ (apostrophe :utf-8 "’" :html "’"))
+ ("es"
+ (opening-double-quote :utf-8 "«" :html "«" :latex "\\guillemotleft{}"
+ :texinfo "@guillemetleft{}")
+ (closing-double-quote :utf-8 "»" :html "»" :latex "\\guillemotright{}"
+ :texinfo "@guillemetright{}")
+ (opening-single-quote :utf-8 "“" :html "“" :latex "``" :texinfo "``")
+ (closing-single-quote :utf-8 "”" :html "”" :latex "''" :texinfo "''")
+ (apostrophe :utf-8 "’" :html "’"))
+ ("fr"
+ (opening-double-quote :utf-8 "« " :html "« " :latex "\\og "
+ :texinfo "@guillemetleft{}@tie{}")
+ (closing-double-quote :utf-8 " »" :html " »" :latex "\\fg{}"
+ :texinfo "@tie{}@guillemetright{}")
+ (opening-single-quote :utf-8 "« " :html "« " :latex "\\og "
+ :texinfo "@guillemetleft{}@tie{}")
+ (closing-single-quote :utf-8 " »" :html " »" :latex "\\fg{}"
+ :texinfo "@tie{}@guillemetright{}")
+ (apostrophe :utf-8 "’" :html "’")))
+ "Smart quotes translations.
+
+Alist whose CAR is a language string and CDR is an alist with
+quote type as key and a plist associating various encodings to
+their translation as value.
+
+A quote type can be any symbol among `opening-double-quote',
+`closing-double-quote', `opening-single-quote',
+`closing-single-quote' and `apostrophe'.
+
+Valid encodings include `:utf-8', `:html', `:latex' and
+`:texinfo'.
+
+If no translation is found, the quote character is left as-is.")
+
+(defconst org-export-smart-quotes-regexps
+ (list
+ ;; Possible opening quote at beginning of string.
+ "\\`\\([\"']\\)\\(\\w\\|\\s.\\|\\s_\\)"
+ ;; Possible closing quote at beginning of string.
+ "\\`\\([\"']\\)\\(\\s-\\|\\s)\\|\\s.\\)"
+ ;; Possible apostrophe at beginning of string.
+ "\\`\\('\\)\\S-"
+ ;; Opening single and double quotes.
+ "\\(?:\\s-\\|\\s(\\)\\([\"']\\)\\(?:\\w\\|\\s.\\|\\s_\\)"
+ ;; Closing single and double quotes.
+ "\\(?:\\w\\|\\s.\\|\\s_\\)\\([\"']\\)\\(?:\\s-\\|\\s)\\|\\s.\\)"
+ ;; Apostrophe.
+ "\\S-\\('\\)\\S-"
+ ;; Possible opening quote at end of string.
+ "\\(?:\\s-\\|\\s(\\)\\([\"']\\)\\'"
+ ;; Possible closing quote at end of string.
+ "\\(?:\\w\\|\\s.\\|\\s_\\)\\([\"']\\)\\'"
+ ;; Possible apostrophe at end of string.
+ "\\S-\\('\\)\\'")
+ "List of regexps matching a quote or an apostrophe.
+In every regexp, quote or apostrophe matched is put in group 1.")
+
+(declare-function org-export-get-next-element "org-export" (blob info &optional n))
+(declare-function org-export-get-previous-element "org-export" (blob info &optional n))
+(defun org-export-activate-smart-quotes (s encoding info &optional original)
+ "Replace regular quotes with \"smart\" quotes in string S.
+
+ENCODING is a symbol among `:html', `:latex', `:texinfo' and
+`:utf-8'. INFO is a plist used as a communication channel.
+
+The function has to retrieve information about string
+surroundings in parse tree. It can only happen with an
+unmodified string. Thus, if S has already been through another
+process, a non-nil ORIGINAL optional argument will provide that
+original string.
+
+Return the new string."
+ (if (equal s "") ""
+ (let* ((prev (org-export-get-previous-element (or original s) info))
+ ;; Try to be flexible when computing number of blanks
+ ;; before object. The previous object may be a string
+ ;; introduced by the back-end and not completely parsed.
+ (pre-blank (and prev
+ (or (org-element-property :post-blank prev)
+ ;; A string with missing `:post-blank'
+ ;; property.
+ (and (stringp prev)
+ (string-match " *\\'" prev)
+ (length (match-string 0 prev)))
+ ;; Fallback value.
+ 0)))
+ (next (org-export-get-next-element (or original s) info))
+ (get-smart-quote
+ (lambda (q type)
+ ;; Return smart quote associated to a give quote Q, as
+ ;; a string. TYPE is a symbol among `open', `close' and
+ ;; `apostrophe'.
+ (let ((key (case type
+ (apostrophe 'apostrophe)
+ (open (if (equal "'" q) 'opening-single-quote
+ 'opening-double-quote))
+ (otherwise (if (equal "'" q) 'closing-single-quote
+ 'closing-double-quote)))))
+ (or (plist-get
+ (cdr (assq key
+ (cdr (assoc (plist-get info :language)
+ org-export-smart-quotes-alist))))
+ encoding)
+ q)))))
+ (if (or (equal "\"" s) (equal "'" s))
+ ;; Only a quote: no regexp can match. We have to check both
+ ;; sides and decide what to do.
+ (cond ((and (not prev) (not next)) s)
+ ((not prev) (funcall get-smart-quote s 'open))
+ ((and (not next) (zerop pre-blank))
+ (funcall get-smart-quote s 'close))
+ ((not next) s)
+ ((zerop pre-blank) (funcall get-smart-quote s 'apostrophe))
+ (t (funcall get-smart-quote 'open)))
+ ;; 1. Replace quote character at the beginning of S.
+ (cond
+ ;; Apostrophe?
+ ((and prev (zerop pre-blank)
+ (string-match (nth 2 org-export-smart-quotes-regexps) s))
+ (setq s (replace-match
+ (funcall get-smart-quote (match-string 1 s) 'apostrophe)
+ nil t s 1)))
+ ;; Closing quote?
+ ((and prev (zerop pre-blank)
+ (string-match (nth 1 org-export-smart-quotes-regexps) s))
+ (setq s (replace-match
+ (funcall get-smart-quote (match-string 1 s) 'close)
+ nil t s 1)))
+ ;; Opening quote?
+ ((and (or (not prev) (> pre-blank 0))
+ (string-match (nth 0 org-export-smart-quotes-regexps) s))
+ (setq s (replace-match
+ (funcall get-smart-quote (match-string 1 s) 'open)
+ nil t s 1))))
+ ;; 2. Replace quotes in the middle of the string.
+ (setq s (replace-regexp-in-string
+ ;; Opening quotes.
+ (nth 3 org-export-smart-quotes-regexps)
+ (lambda (text)
+ (funcall get-smart-quote (match-string 1 text) 'open))
+ s nil t 1))
+ (setq s (replace-regexp-in-string
+ ;; Closing quotes.
+ (nth 4 org-export-smart-quotes-regexps)
+ (lambda (text)
+ (funcall get-smart-quote (match-string 1 text) 'close))
+ s nil t 1))
+ (setq s (replace-regexp-in-string
+ ;; Apostrophes.
+ (nth 5 org-export-smart-quotes-regexps)
+ (lambda (text)
+ (funcall get-smart-quote (match-string 1 text) 'apostrophe))
+ s nil t 1))
+ ;; 3. Replace quote character at the end of S.
+ (cond
+ ;; Apostrophe?
+ ((and next (string-match (nth 8 org-export-smart-quotes-regexps) s))
+ (setq s (replace-match
+ (funcall get-smart-quote (match-string 1 s) 'apostrophe)
+ nil t s 1)))
+ ;; Closing quote?
+ ((and (not next)
+ (string-match (nth 7 org-export-smart-quotes-regexps) s))
+ (setq s (replace-match
+ (funcall get-smart-quote (match-string 1 s) 'close)
+ nil t s 1)))
+ ;; Opening quote?
+ ((and next (string-match (nth 6 org-export-smart-quotes-regexps) s))
+ (setq s (replace-match
+ (funcall get-smart-quote (match-string 1 s) 'open)
+ nil t s 1))))
+ ;; Return string with smart quotes.
+ s))))
+
+
+
+(provide 'ox-i18n)
+;;; ox-i18n.el ends here
diff --git a/lisp/ox.el b/lisp/ox.el
index 08fbddd..ea4f7c1 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -80,6 +80,7 @@
(require 'org-element)
(require 'org-macro)
(require 'ob-exp)
+(require 'ox-i18n)
(declare-function org-publish "ox-publish" (project &optional force async))
(declare-function org-publish-all "ox-publish" (&optional force async))
@@ -4878,207 +4879,6 @@ Return a list of src-block elements with a caption."
(org-export-collect-elements 'src-block info))
-;;;; Smart Quotes
-;;
-;; The main function for the smart quotes sub-system is
-;; `org-export-activate-smart-quotes', which replaces every quote in
-;; a given string from the parse tree with its "smart" counterpart.
-;;
-;; Dictionary for smart quotes is stored in
-;; `org-export-smart-quotes-alist'.
-;;
-;; Internally, regexps matching potential smart quotes (checks at
-;; string boundaries are also necessary) are defined in
-;; `org-export-smart-quotes-regexps'.
-
-(defconst org-export-smart-quotes-alist
- '(("de"
- (opening-double-quote :utf-8 "„" :html "„" :latex "\"`"
- :texinfo "@quotedblbase{}")
- (closing-double-quote :utf-8 "“" :html "“" :latex "\"'"
- :texinfo "@quotedblleft{}")
- (opening-single-quote :utf-8 "‚" :html "‚" :latex "\\glq{}"
- :texinfo "@quotesinglbase{}")
- (closing-single-quote :utf-8 "‘" :html "‘" :latex "\\grq{}"
- :texinfo "@quoteleft{}")
- (apostrophe :utf-8 "’" :html "’"))
- ("en"
- (opening-double-quote :utf-8 "“" :html "“" :latex "``" :texinfo "``")
- (closing-double-quote :utf-8 "”" :html "”" :latex "''" :texinfo "''")
- (opening-single-quote :utf-8 "‘" :html "‘" :latex "`" :texinfo "`")
- (closing-single-quote :utf-8 "’" :html "’" :latex "'" :texinfo "'")
- (apostrophe :utf-8 "’" :html "’"))
- ("es"
- (opening-double-quote :utf-8 "«" :html "«" :latex "\\guillemotleft{}"
- :texinfo "@guillemetleft{}")
- (closing-double-quote :utf-8 "»" :html "»" :latex "\\guillemotright{}"
- :texinfo "@guillemetright{}")
- (opening-single-quote :utf-8 "“" :html "“" :latex "``" :texinfo "``")
- (closing-single-quote :utf-8 "”" :html "”" :latex "''" :texinfo "''")
- (apostrophe :utf-8 "’" :html "’"))
- ("fr"
- (opening-double-quote :utf-8 "« " :html "« " :latex "\\og "
- :texinfo "@guillemetleft{}@tie{}")
- (closing-double-quote :utf-8 " »" :html " »" :latex "\\fg{}"
- :texinfo "@tie{}@guillemetright{}")
- (opening-single-quote :utf-8 "« " :html "« " :latex "\\og "
- :texinfo "@guillemetleft{}@tie{}")
- (closing-single-quote :utf-8 " »" :html " »" :latex "\\fg{}"
- :texinfo "@tie{}@guillemetright{}")
- (apostrophe :utf-8 "’" :html "’")))
- "Smart quotes translations.
-
-Alist whose CAR is a language string and CDR is an alist with
-quote type as key and a plist associating various encodings to
-their translation as value.
-
-A quote type can be any symbol among `opening-double-quote',
-`closing-double-quote', `opening-single-quote',
-`closing-single-quote' and `apostrophe'.
-
-Valid encodings include `:utf-8', `:html', `:latex' and
-`:texinfo'.
-
-If no translation is found, the quote character is left as-is.")
-
-(defconst org-export-smart-quotes-regexps
- (list
- ;; Possible opening quote at beginning of string.
- "\\`\\([\"']\\)\\(\\w\\|\\s.\\|\\s_\\)"
- ;; Possible closing quote at beginning of string.
- "\\`\\([\"']\\)\\(\\s-\\|\\s)\\|\\s.\\)"
- ;; Possible apostrophe at beginning of string.
- "\\`\\('\\)\\S-"
- ;; Opening single and double quotes.
- "\\(?:\\s-\\|\\s(\\)\\([\"']\\)\\(?:\\w\\|\\s.\\|\\s_\\)"
- ;; Closing single and double quotes.
- "\\(?:\\w\\|\\s.\\|\\s_\\)\\([\"']\\)\\(?:\\s-\\|\\s)\\|\\s.\\)"
- ;; Apostrophe.
- "\\S-\\('\\)\\S-"
- ;; Possible opening quote at end of string.
- "\\(?:\\s-\\|\\s(\\)\\([\"']\\)\\'"
- ;; Possible closing quote at end of string.
- "\\(?:\\w\\|\\s.\\|\\s_\\)\\([\"']\\)\\'"
- ;; Possible apostrophe at end of string.
- "\\S-\\('\\)\\'")
- "List of regexps matching a quote or an apostrophe.
-In every regexp, quote or apostrophe matched is put in group 1.")
-
-(defun org-export-activate-smart-quotes (s encoding info &optional original)
- "Replace regular quotes with \"smart\" quotes in string S.
-
-ENCODING is a symbol among `:html', `:latex', `:texinfo' and
-`:utf-8'. INFO is a plist used as a communication channel.
-
-The function has to retrieve information about string
-surroundings in parse tree. It can only happen with an
-unmodified string. Thus, if S has already been through another
-process, a non-nil ORIGINAL optional argument will provide that
-original string.
-
-Return the new string."
- (if (equal s "") ""
- (let* ((prev (org-export-get-previous-element (or original s) info))
- ;; Try to be flexible when computing number of blanks
- ;; before object. The previous object may be a string
- ;; introduced by the back-end and not completely parsed.
- (pre-blank (and prev
- (or (org-element-property :post-blank prev)
- ;; A string with missing `:post-blank'
- ;; property.
- (and (stringp prev)
- (string-match " *\\'" prev)
- (length (match-string 0 prev)))
- ;; Fallback value.
- 0)))
- (next (org-export-get-next-element (or original s) info))
- (get-smart-quote
- (lambda (q type)
- ;; Return smart quote associated to a give quote Q, as
- ;; a string. TYPE is a symbol among `open', `close' and
- ;; `apostrophe'.
- (let ((key (case type
- (apostrophe 'apostrophe)
- (open (if (equal "'" q) 'opening-single-quote
- 'opening-double-quote))
- (otherwise (if (equal "'" q) 'closing-single-quote
- 'closing-double-quote)))))
- (or (plist-get
- (cdr (assq key
- (cdr (assoc (plist-get info :language)
- org-export-smart-quotes-alist))))
- encoding)
- q)))))
- (if (or (equal "\"" s) (equal "'" s))
- ;; Only a quote: no regexp can match. We have to check both
- ;; sides and decide what to do.
- (cond ((and (not prev) (not next)) s)
- ((not prev) (funcall get-smart-quote s 'open))
- ((and (not next) (zerop pre-blank))
- (funcall get-smart-quote s 'close))
- ((not next) s)
- ((zerop pre-blank) (funcall get-smart-quote s 'apostrophe))
- (t (funcall get-smart-quote 'open)))
- ;; 1. Replace quote character at the beginning of S.
- (cond
- ;; Apostrophe?
- ((and prev (zerop pre-blank)
- (string-match (nth 2 org-export-smart-quotes-regexps) s))
- (setq s (replace-match
- (funcall get-smart-quote (match-string 1 s) 'apostrophe)
- nil t s 1)))
- ;; Closing quote?
- ((and prev (zerop pre-blank)
- (string-match (nth 1 org-export-smart-quotes-regexps) s))
- (setq s (replace-match
- (funcall get-smart-quote (match-string 1 s) 'close)
- nil t s 1)))
- ;; Opening quote?
- ((and (or (not prev) (> pre-blank 0))
- (string-match (nth 0 org-export-smart-quotes-regexps) s))
- (setq s (replace-match
- (funcall get-smart-quote (match-string 1 s) 'open)
- nil t s 1))))
- ;; 2. Replace quotes in the middle of the string.
- (setq s (replace-regexp-in-string
- ;; Opening quotes.
- (nth 3 org-export-smart-quotes-regexps)
- (lambda (text)
- (funcall get-smart-quote (match-string 1 text) 'open))
- s nil t 1))
- (setq s (replace-regexp-in-string
- ;; Closing quotes.
- (nth 4 org-export-smart-quotes-regexps)
- (lambda (text)
- (funcall get-smart-quote (match-string 1 text) 'close))
- s nil t 1))
- (setq s (replace-regexp-in-string
- ;; Apostrophes.
- (nth 5 org-export-smart-quotes-regexps)
- (lambda (text)
- (funcall get-smart-quote (match-string 1 text) 'apostrophe))
- s nil t 1))
- ;; 3. Replace quote character at the end of S.
- (cond
- ;; Apostrophe?
- ((and next (string-match (nth 8 org-export-smart-quotes-regexps) s))
- (setq s (replace-match
- (funcall get-smart-quote (match-string 1 s) 'apostrophe)
- nil t s 1)))
- ;; Closing quote?
- ((and (not next)
- (string-match (nth 7 org-export-smart-quotes-regexps) s))
- (setq s (replace-match
- (funcall get-smart-quote (match-string 1 s) 'close)
- nil t s 1)))
- ;; Opening quote?
- ((and next (string-match (nth 6 org-export-smart-quotes-regexps) s))
- (setq s (replace-match
- (funcall get-smart-quote (match-string 1 s) 'open)
- nil t s 1))))
- ;; Return string with smart quotes.
- s))))
-
;;;; Topology
;;
;; Here are various functions to retrieve information about the
@@ -5206,179 +5006,6 @@ them."
(nreverse next))))
-;;;; Translation
-;;
-;; `org-export-translate' translates a string according to language
-;; specified by LANGUAGE keyword or `org-export-language-setup'
-;; variable and a specified charset. `org-export-dictionary' contains
-;; the dictionary used for the translation.
-
-(defconst org-export-dictionary
- '(("%e %n: %c"
- ("fr" :default "%e %n : %c" :html "%e %n : %c"))
- ("Author"
- ("ca" :default "Autor")
- ("cs" :default "Autor")
- ("da" :default "Ophavsmand")
- ("de" :default "Autor")
- ("eo" :html "Aŭtoro")
- ("es" :default "Autor")
- ("fi" :html "Tekijä")
- ("fr" :default "Auteur")
- ("hu" :default "Szerzõ")
- ("is" :html "Höfundur")
- ("it" :default "Autore")
- ("ja" :html "著者" :utf-8 "著者")
- ("nl" :default "Auteur")
- ("no" :default "Forfatter")
- ("nb" :default "Forfatter")
- ("nn" :default "Forfattar")
- ("pl" :default "Autor")
- ("ru" :html "Автор" :utf-8 "Автор")
- ("sv" :html "Författare")
- ("uk" :html "Автор" :utf-8 "Автор")
- ("zh-CN" :html "作者" :utf-8 "作者")
- ("zh-TW" :html "作者" :utf-8 "作者"))
- ("Date"
- ("ca" :default "Data")
- ("cs" :default "Datum")
- ("da" :default "Dato")
- ("de" :default "Datum")
- ("eo" :default "Dato")
- ("es" :default "Fecha")
- ("fi" :html "Päivämäärä")
- ("hu" :html "Dátum")
- ("is" :default "Dagsetning")
- ("it" :default "Data")
- ("ja" :html "日付" :utf-8 "日付")
- ("nl" :default "Datum")
- ("no" :default "Dato")
- ("nb" :default "Dato")
- ("nn" :default "Dato")
- ("pl" :default "Data")
- ("ru" :html "Дата" :utf-8 "Дата")
- ("sv" :default "Datum")
- ("uk" :html "Дата" :utf-8 "Дата")
- ("zh-CN" :html "日期" :utf-8 "日期")
- ("zh-TW" :html "日期" :utf-8 "日期"))
- ("Equation"
- ("de" :default "Gleichung")
- ("es" :html "Ecuación" :default "Ecuación")
- ("fr" :ascii "Equation" :default "Équation"))
- ("Figure"
- ("de" :default "Abbildung")
- ("es" :default "Figura")
- ("ja" :html "図" :utf-8 "図"))
- ("Figure %d:"
- ("de" :default "Abbildung %d:")
- ("es" :default "Figura %d:")
- ("fr" :default "Figure %d :" :html "Figure %d :")
- ("ja" :html "図%d:" :utf-8 "図%d:"))
- ("Footnotes"
- ("ca" :html "Peus de pàgina")
- ("cs" :default "Pozn\xe1mky pod carou")
- ("da" :default "Fodnoter")
- ("de" :html "Fußnoten" :default "Fußnoten")
- ("eo" :default "Piednotoj")
- ("es" :html "Nota al pie de página" :default "Nota al pie de página")
- ("fi" :default "Alaviitteet")
- ("fr" :default "Notes de bas de page")
- ("hu" :html "Lábjegyzet")
- ("is" :html "Aftanmálsgreinar")
- ("it" :html "Note a piè di pagina")
- ("ja" :html "脚注" :utf-8 "脚注")
- ("nl" :default "Voetnoten")
- ("no" :default "Fotnoter")
- ("nb" :default "Fotnoter")
- ("nn" :default "Fotnotar")
- ("pl" :default "Przypis")
- ("ru" :html "Сноски" :utf-8 "Сноски")
- ("sv" :default "Fotnoter")
- ("uk" :html "Примітки"
- :utf-8 "Примітки")
- ("zh-CN" :html "脚注" :utf-8 "脚注")
- ("zh-TW" :html "腳註" :utf-8 "腳註"))
- ("List of Listings"
- ("de" :default "Programmauflistungsverzeichnis")
- ("es" :default "Indice de Listados de programas")
- ("fr" :default "Liste des programmes"))
- ("List of Tables"
- ("de" :default "Tabellenverzeichnis")
- ("es" :default "Indice de tablas")
- ("fr" :default "Liste des tableaux"))
- ("Listing %d:"
- ("de" :default "Programmlisting %d")
- ("es" :default "Listado de programa %d")
- ("fr" :default "Programme %d :" :html "Programme %d :"))
- ("See section %s"
- ("de" :default "siehe Abschnitt %s")
- ("es" :default "vea seccion %s")
- ("fr" :default "cf. section %s"))
- ("Table"
- ("de" :default "Tabelle")
- ("es" :default "Tabla")
- ("fr" :default "Tableau")
- ("ja" :html "表" :utf-8 "表"))
- ("Table %d:"
- ("de" :default "Tabelle %d")
- ("es" :default "Tabla %d")
- ("fr" :default "Tableau %d :")
- ("ja" :html "表%d:" :utf-8 "表%d:"))
- ("Table of Contents"
- ("ca" :html "Índex")
- ("cs" :default "Obsah")
- ("da" :default "Indhold")
- ("de" :default "Inhaltsverzeichnis")
- ("eo" :default "Enhavo")
- ("es" :html "Índice")
- ("fi" :html "Sisällysluettelo")
- ("fr" :ascii "Sommaire" :default "Table des matières")
- ("hu" :html "Tartalomjegyzék")
- ("is" :default "Efnisyfirlit")
- ("it" :default "Indice")
- ("ja" :html "目次" :utf-8 "目次")
- ("nl" :default "Inhoudsopgave")
- ("no" :default "Innhold")
- ("nb" :default "Innhold")
- ("nn" :default "Innhald")
- ("pl" :html "Spis treści")
- ("ru" :html "Содержание"
- :utf-8 "Содержание")
- ("sv" :html "Innehåll")
- ("uk" :html "Зміст" :utf-8 "Зміст")
- ("zh-CN" :html "目录" :utf-8 "目录")
- ("zh-TW" :html "目錄" :utf-8 "目錄"))
- ("Unknown reference"
- ("de" :default "Unbekannter Verweis")
- ("es" :default "referencia desconocida")
- ("fr" :ascii "Destination inconnue" :default "Référence inconnue")))
- "Dictionary for export engine.
-
-Alist whose CAR is the string to translate and CDR is an alist
-whose CAR is the language string and CDR is a plist whose
-properties are possible charsets and values translated terms.
-
-It is used as a database for `org-export-translate'. Since this
-function returns the string as-is if no translation was found,
-the variable only needs to record values different from the
-entry.")
-
-(defun org-export-translate (s encoding info)
- "Translate string S according to language specification.
-
-ENCODING is a symbol among `:ascii', `:html', `:latex', `:latin1'
-and `:utf-8'. INFO is a plist used as a communication channel.
-
-Translation depends on `:language' property. Return the
-translated string. If no translation is found, try to fall back
-to `:default' encoding. If it fails, return S."
- (let* ((lang (plist-get info :language))
- (translations (cdr (assoc lang
- (cdr (assoc s org-export-dictionary))))))
- (or (plist-get translations encoding)
- (plist-get translations :default)
- s)))
-
\f
;;; Asynchronous Export
--
1.8.3.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-06-29 14:06 [RFC] Introduce ox-i18n.el Nicolas Goaziou
@ 2013-06-29 15:01 ` Bastien
2013-06-29 15:22 ` Rasmus
` (2 subsequent siblings)
3 siblings, 0 replies; 17+ messages in thread
From: Bastien @ 2013-06-29 15:01 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> I would like to move every variable and function related to
> internationalization (i.e smart quotes and translations) in a dedicated
> file ("ox-i18n.el") instead of "ox.el".
>
> Considering "ox.el" is 6k lines long, I think it can be a bit tedious to
> locate and modify internationalization entries. And since we are missing
> quite a few translations, every little bit can help.
Maybe we can generalize even more, call it org-i18n.el and have
`org-clock-clocktable-language-setup' (and maybe others) included?
If ox-i18n.el exists, it will be confusing to have other i18n
pieces in other part of Org.
If the *only* purpose is to boost translations, I don't think
moving the code the right thing to do: we simply need to give
more pointers on the website on how to help with it.
2 cts,
--
Bastien
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-06-29 14:06 [RFC] Introduce ox-i18n.el Nicolas Goaziou
2013-06-29 15:01 ` Bastien
@ 2013-06-29 15:22 ` Rasmus
2013-07-01 10:13 ` Sebastien Vauban
2013-07-02 6:37 ` Jambunathan K
2013-07-02 13:04 ` Rasmus
3 siblings, 1 reply; 17+ messages in thread
From: Rasmus @ 2013-06-29 15:22 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> I would like to move every variable and function related to
> internationalization (i.e smart quotes and translations) in a dedicated
> file ("ox-i18n.el") instead of "ox.el".
Sounds good to me.
How about a more informative name where uninformed need not look up
the meaning of "i18n" on Wikipedia? ox-translation(s) or something
like that. . .
–Rasmus
--
El Rey ha muerto. ¡Larga vida al Rey!
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-06-29 15:22 ` Rasmus
@ 2013-07-01 10:13 ` Sebastien Vauban
2013-07-01 10:19 ` Bastien
0 siblings, 1 reply; 17+ messages in thread
From: Sebastien Vauban @ 2013-07-01 10:13 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hello,
Rasmus wrote:
> Nicolas Goaziou <n.goaziou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> I would like to move every variable and function related to
>> internationalization (i.e smart quotes and translations) in a dedicated
>> file ("ox-i18n.el") instead of "ox.el".
>
> Sounds good to me.
+1
> How about a more informative name where uninformed need not look up
> the meaning of "i18n" on Wikipedia? ox-translation(s) or something
> like that. . .
+1 regarding the name "i18n". It does not mean much to me. I'd favor
ox-international(ization) or ox-strings or ox-translation(s) or ...
Now, if i18n is some kind of standard, that's good as well. It then means a
lot to people looking for translation strings.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-01 10:13 ` Sebastien Vauban
@ 2013-07-01 10:19 ` Bastien
0 siblings, 0 replies; 17+ messages in thread
From: Bastien @ 2013-07-01 10:19 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:
>> Sounds good to me.
>
> +1
Let's clearly think about what problem it is supposed to solve:
if it is just discoverability for potential contributors, I don't
think it's worth the split.
--
Bastien
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-06-29 14:06 [RFC] Introduce ox-i18n.el Nicolas Goaziou
2013-06-29 15:01 ` Bastien
2013-06-29 15:22 ` Rasmus
@ 2013-07-02 6:37 ` Jambunathan K
2013-07-02 15:39 ` Nicolas Goaziou
2013-07-02 13:04 ` Rasmus
3 siblings, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2013-07-02 6:37 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> +(defconst org-export-dictionary
^^^^^^^^
^^^^^^^^
Why?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-06-29 14:06 [RFC] Introduce ox-i18n.el Nicolas Goaziou
` (2 preceding siblings ...)
2013-07-02 6:37 ` Jambunathan K
@ 2013-07-02 13:04 ` Rasmus
2013-07-02 16:30 ` Nicolas Goaziou
3 siblings, 1 reply; 17+ messages in thread
From: Rasmus @ 2013-07-02 13:04 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> I would like to move every variable and function related to
> internationalization (i.e smart quotes and translations) in a dedicated
> file ("ox-i18n.el") instead of "ox.el".
>
> Considering "ox.el" is 6k lines long, I think it can be a bit tedious to
> locate and modify internationalization entries. And since we are missing
> quite a few translations, every little bit can help.
So I did some translation work today, and I now support this notion
further. It's super tedious /finding/ all the correct variables, as
they are not spread all over the place.
Should the ox-latex language-code to babel list also be included in an
ox-int'l file? The reason is that I found some "bugs" in this list
and perhaps further language related bugs would be easier to detect if
they were in the same file.
--
Don't panic!!!
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 6:37 ` Jambunathan K
@ 2013-07-02 15:39 ` Nicolas Goaziou
2013-07-02 16:21 ` Rasmus
2013-07-02 16:40 ` Jambunathan K
0 siblings, 2 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2013-07-02 15:39 UTC (permalink / raw)
To: Jambunathan K; +Cc: Org Mode List
Hello,
Jambunathan K <kjambunathan@gmail.com> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> +(defconst org-export-dictionary
> ^^^^^^^^
> ^^^^^^^^
>
> Why?
Because it is not meant to be changed by the user nor let-bound. IOW,
it's a constant.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 15:39 ` Nicolas Goaziou
@ 2013-07-02 16:21 ` Rasmus
2013-07-02 16:29 ` Nicolas Goaziou
2013-07-02 16:40 ` Jambunathan K
1 sibling, 1 reply; 17+ messages in thread
From: Rasmus @ 2013-07-02 16:21 UTC (permalink / raw)
To: emacs-orgmode
Hello,
>>> +(defconst org-export-dictionary
>> ^^^^^^^^
>> ^^^^^^^^
>>
>> Why?
>
> Because it is not meant to be changed by the user nor let-bound. IOW,
> it's a constant.
But perhaps it should not be. Consider org-export-smart-quotes-alist.
In Danish, according to the 'official' guidance, all of the following
are appropriate
(*) ,,.'', ``.'', `.', >>.<<, >.<.
Basically, only the french <<.>> is not appropriate. A similar
situation exists in Norwegian, to the best of my knowledge. Why
should I (submitting a patch) be able to actively force which of forms
in (*) should be used?
One remedy /in LaTeX/ would be to let quote-characters be selected by
csquote, but I don't really know if I'd want to go that way. . .
Alternatively, we can populate the various language variables and
provide easy means to alter them, a la:
(org-alter-language "da" :left-latex "``" :right-latex "''" :table "tabel").
–Rasmus
--
⠠⠵
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 16:21 ` Rasmus
@ 2013-07-02 16:29 ` Nicolas Goaziou
2013-07-02 17:10 ` Jambunathan K
2013-07-02 17:43 ` Rasmus
0 siblings, 2 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2013-07-02 16:29 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
>> Because it is not meant to be changed by the user nor let-bound. IOW,
>> it's a constant.
>
> But perhaps it should not be.
>
> Consider org-export-smart-quotes-alist.
> In Danish, according to the 'official' guidance, all of the following
> are appropriate
>
> (*) ,,.'', ``.'', `.', >>.<<, >.<.
>
> Basically, only the french <<.>> is not appropriate. A similar
> situation exists in Norwegian, to the best of my knowledge. Why
> should I (submitting a patch) be able to actively force which of forms
> in (*) should be used?
>
> One remedy /in LaTeX/ would be to let quote-characters be selected by
> csquote, but I don't really know if I'd want to go that way. . .
>
> Alternatively, we can populate the various language variables and
> provide easy means to alter them, a la:
>
> (org-alter-language "da" :left-latex "``" :right-latex "''" :table
> "tabel").
Even though it is a defconst, you can still change it. You are not
forced to anything. But you're on your own.
By the way, it is a defconst because of the keys, which shouldn't be
altered, not the values.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 13:04 ` Rasmus
@ 2013-07-02 16:30 ` Nicolas Goaziou
0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2013-07-02 16:30 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Should the ox-latex language-code to babel list also be included in an
> ox-int'l file? The reason is that I found some "bugs" in this list
> and perhaps further language related bugs would be easier to detect if
> they were in the same file.
I don't think so. Bugs in happening in latex export only are expected to
be found in ox-latex.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 15:39 ` Nicolas Goaziou
2013-07-02 16:21 ` Rasmus
@ 2013-07-02 16:40 ` Jambunathan K
1 sibling, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2013-07-02 16:40 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Hello,
>
> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>
>>> +(defconst org-export-dictionary
>> ^^^^^^^^
>> ^^^^^^^^
>>
>> Why?
>
> Because it is not meant to be changed by the user nor let-bound. IOW,
> it's a constant.
Lately, users ARE modifying it.
>
>
> Regards,
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 16:29 ` Nicolas Goaziou
@ 2013-07-02 17:10 ` Jambunathan K
2013-07-02 17:26 ` Nicolas Goaziou
2013-07-02 17:43 ` Rasmus
1 sibling, 1 reply; 17+ messages in thread
From: Jambunathan K @ 2013-07-02 17:10 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Rasmus
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Even though it is a defconst, you can still change it. You are not
> forced to anything. But you're on your own.
>
> By the way, it is a defconst because of the keys, which shouldn't be
> altered, not the values.
It /may/ be converted to a defcustom. Lots of people seem interested in
modifying it.
Btw, HTML provides <q> </q> for generating quotes. This is what the
Creole markup engine for Oddmuse is using. Apparently, the "quotes"
that gets emitted can be controlled on per-language basis through some
CSS.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 17:10 ` Jambunathan K
@ 2013-07-02 17:26 ` Nicolas Goaziou
2013-07-02 17:40 ` Jambunathan K
0 siblings, 1 reply; 17+ messages in thread
From: Nicolas Goaziou @ 2013-07-02 17:26 UTC (permalink / raw)
To: Jambunathan K; +Cc: emacs-orgmode, Rasmus
Jambunathan K <kjambunathan@gmail.com> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Even though it is a defconst, you can still change it. You are not
>> forced to anything. But you're on your own.
>>
>> By the way, it is a defconst because of the keys, which shouldn't be
>> altered, not the values.
>
> It /may/ be converted to a defcustom. Lots of people seem interested in
> modifying it.
Of course. Patch welcome.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 17:26 ` Nicolas Goaziou
@ 2013-07-02 17:40 ` Jambunathan K
0 siblings, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2013-07-02 17:40 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Rasmus
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Of course. Patch welcome.
The conversation is taking a humorous turn.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 16:29 ` Nicolas Goaziou
2013-07-02 17:10 ` Jambunathan K
@ 2013-07-02 17:43 ` Rasmus
2013-07-02 18:12 ` Jambunathan K
1 sibling, 1 reply; 17+ messages in thread
From: Rasmus @ 2013-07-02 17:43 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Even though it is a defconst, you can still change it. You are not
> forced to anything. But you're on your own.
I agree, but it being a defconst, it comes with the message
"This declares that neither programs nor users should ever change
the value."
> By the way, it is a defconst because of the keys, which shouldn't be
> altered, not the values.
If that's really a the concern then why not write a function to alter
values in a safe manner?
Alternatively, it could stay defconst, and there could be a
org-export-smart-quotes-alist-user, defaulting to nil but taking
precedence over its non-user counterpart. If people specify a wrong
language code it'll just be ignored.
–Rasmus
--
When in doubt, do it!
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [RFC] Introduce ox-i18n.el
2013-07-02 17:43 ` Rasmus
@ 2013-07-02 18:12 ` Jambunathan K
0 siblings, 0 replies; 17+ messages in thread
From: Jambunathan K @ 2013-07-02 18:12 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Even though it is a defconst, you can still change it. You are not
>> forced to anything. But you're on your own.
>
> I agree, but it being a defconst, it comes with the message
>
> "This declares that neither programs nor users should ever change
> the value."
>
>> By the way, it is a defconst because of the keys, which shouldn't be
>> altered, not the values.
>
> If that's really a the concern then why not write a function to alter
> values in a safe manner?
>
> Alternatively, it could stay defconst, and there could be a
> org-export-smart-quotes-alist-user, defaulting to nil but taking
> precedence over its non-user counterpart. If people specify a wrong
> language code it'll just be ignored.
Snippet below is a good starting point, for customizability you are
asking for.
(defcustom ox-sq-alist nil
""
:type '(alist :key-type string :value-type
(alist :key-type symbol
:options (ODQ CDQ OSQ CSQ)
:value-type (plist :options (:utf-8 :html :latex :texinfo)))))
> –Rasmus
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2013-07-02 18:10 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-29 14:06 [RFC] Introduce ox-i18n.el Nicolas Goaziou
2013-06-29 15:01 ` Bastien
2013-06-29 15:22 ` Rasmus
2013-07-01 10:13 ` Sebastien Vauban
2013-07-01 10:19 ` Bastien
2013-07-02 6:37 ` Jambunathan K
2013-07-02 15:39 ` Nicolas Goaziou
2013-07-02 16:21 ` Rasmus
2013-07-02 16:29 ` Nicolas Goaziou
2013-07-02 17:10 ` Jambunathan K
2013-07-02 17:26 ` Nicolas Goaziou
2013-07-02 17:40 ` Jambunathan K
2013-07-02 17:43 ` Rasmus
2013-07-02 18:12 ` Jambunathan K
2013-07-02 16:40 ` Jambunathan K
2013-07-02 13:04 ` Rasmus
2013-07-02 16:30 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).