forked from mirrors/org-mode
Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
e03fc31ee1
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
(declare-function org-element-get-contents "org-element" (element))
|
(declare-function org-element-get-contents "org-element" (element))
|
||||||
(declare-function org-element-get-property "org-element" (property element))
|
(declare-function org-element-get-property "org-element" (property element))
|
||||||
|
(declare-function org-element-normalize-string "org-element" (s))
|
||||||
(declare-function org-element-map "org-element"
|
(declare-function org-element-map "org-element"
|
||||||
(data types fun &optional info first-match))
|
(data types fun &optional info first-match))
|
||||||
(declare-function org-element-time-stamp-interpreter
|
(declare-function org-element-time-stamp-interpreter
|
||||||
|
@ -95,24 +96,15 @@ See `org-export-option-alist' for more information on the
|
||||||
structure or the values.")
|
structure or the values.")
|
||||||
|
|
||||||
(defconst org-e-ascii-dictionary
|
(defconst org-e-ascii-dictionary
|
||||||
'(("Table Of Contents\n"
|
'(("Footnotes\n"
|
||||||
("en"
|
("en"
|
||||||
:ascii "Table Of Contents\n"
|
:ascii "Footnotes\n"
|
||||||
:latin1 "Table Of Contents\n"
|
:latin1 "Footnotes\n"
|
||||||
:utf-8 "Table Of Contents\n")
|
:utf-8 "Footnotes\n")
|
||||||
("fr"
|
("fr"
|
||||||
:ascii "Sommaire\n"
|
:ascii "Notes de bas de page\n"
|
||||||
:latin1 "Table des matières\n"
|
:latin1 "Notes de bas de page\n"
|
||||||
:utf-8 "Table des matières\n"))
|
:utf-8 "Notes de bas de page\n"))
|
||||||
("Table %d: %s"
|
|
||||||
("en"
|
|
||||||
:ascii "Table %d: %s"
|
|
||||||
:latin1 "Table %d: %s"
|
|
||||||
:utf-8 "Table %d: %s")
|
|
||||||
("fr"
|
|
||||||
:ascii "Tableau %d : %s"
|
|
||||||
:latin1 "Tableau %d : %s"
|
|
||||||
:utf-8 "Tableau nº %d : %s"))
|
|
||||||
("Listing %d: %s"
|
("Listing %d: %s"
|
||||||
("en"
|
("en"
|
||||||
:ascii "Listing %d: %s"
|
:ascii "Listing %d: %s"
|
||||||
|
@ -149,6 +141,33 @@ structure or the values.")
|
||||||
:ascii "Programme %d : "
|
:ascii "Programme %d : "
|
||||||
:latin1 "Programme %d : "
|
:latin1 "Programme %d : "
|
||||||
:utf-8 "Programme nº %d : "))
|
:utf-8 "Programme nº %d : "))
|
||||||
|
("Table Of Contents\n"
|
||||||
|
("en"
|
||||||
|
:ascii "Table Of Contents\n"
|
||||||
|
:latin1 "Table Of Contents\n"
|
||||||
|
:utf-8 "Table Of Contents\n")
|
||||||
|
("fr"
|
||||||
|
:ascii "Sommaire\n"
|
||||||
|
:latin1 "Table des matières\n"
|
||||||
|
:utf-8 "Table des matières\n"))
|
||||||
|
("Table %d: %s"
|
||||||
|
("en"
|
||||||
|
:ascii "Table %d: %s"
|
||||||
|
:latin1 "Table %d: %s"
|
||||||
|
:utf-8 "Table %d: %s")
|
||||||
|
("fr"
|
||||||
|
:ascii "Tableau %d : %s"
|
||||||
|
:latin1 "Tableau %d : %s"
|
||||||
|
:utf-8 "Tableau nº %d : %s"))
|
||||||
|
("See section %s"
|
||||||
|
("en"
|
||||||
|
:ascii "See section %s"
|
||||||
|
:latin1 "See section %s"
|
||||||
|
:utf-8 "See section %s")
|
||||||
|
("fr"
|
||||||
|
:ascii "cf. section %s"
|
||||||
|
:latin1 "cf. section %s"
|
||||||
|
:utf-8 "cf. section %s"))
|
||||||
("Table %d: "
|
("Table %d: "
|
||||||
("en"
|
("en"
|
||||||
:ascii "Table %d: "
|
:ascii "Table %d: "
|
||||||
|
@ -166,16 +185,7 @@ structure or the values.")
|
||||||
("fr"
|
("fr"
|
||||||
:ascii "Destination inconnue"
|
:ascii "Destination inconnue"
|
||||||
:latin1 "Référence inconnue"
|
:latin1 "Référence inconnue"
|
||||||
:utf-8 "Référence inconnue"))
|
:utf-8 "Référence inconnue")))
|
||||||
("See section %s"
|
|
||||||
("en"
|
|
||||||
:ascii "See section %s"
|
|
||||||
:latin1 "See section %s"
|
|
||||||
:utf-8 "See section %s")
|
|
||||||
("fr"
|
|
||||||
:ascii "cf. section %s"
|
|
||||||
:latin1 "cf. section %s"
|
|
||||||
:utf-8 "cf. section %s")))
|
|
||||||
"Dictionary for ASCII back-end.
|
"Dictionary for ASCII back-end.
|
||||||
|
|
||||||
Alist whose car is the string to translate and cdr is an alist
|
Alist whose car is the string to translate and cdr is an alist
|
||||||
|
@ -211,6 +221,12 @@ Inner margin is applied between each headline."
|
||||||
:group 'org-export-e-ascii
|
:group 'org-export-e-ascii
|
||||||
:type 'integer)
|
:type 'integer)
|
||||||
|
|
||||||
|
(defcustom org-e-ascii-quote-margin 6
|
||||||
|
"Width of margin used for quoting text, in characters.
|
||||||
|
This margin is applied on both sides of the text."
|
||||||
|
:group 'org-export-e-ascii
|
||||||
|
:type 'integer)
|
||||||
|
|
||||||
(defcustom org-e-ascii-inlinetask-width 30
|
(defcustom org-e-ascii-inlinetask-width 30
|
||||||
"Width of inline tasks, in number of characters.
|
"Width of inline tasks, in number of characters.
|
||||||
This number ignores any margin."
|
This number ignores any margin."
|
||||||
|
@ -517,12 +533,11 @@ INFO is a plist used as a communication channel."
|
||||||
(- total-width
|
(- total-width
|
||||||
;; Each `quote-block', `quote-section' and `verse-block' above
|
;; Each `quote-block', `quote-section' and `verse-block' above
|
||||||
;; narrows text width by twice the standard margin size.
|
;; narrows text width by twice the standard margin size.
|
||||||
(+ (let ((margin (max (floor (/ total-width 12)) 2)))
|
(+ (* (loop for parent in genealogy
|
||||||
(* (loop for parent in genealogy
|
|
||||||
when (memq (car parent)
|
when (memq (car parent)
|
||||||
'(quote-block quote-section verse-block))
|
'(quote-block quote-section verse-block))
|
||||||
count parent)
|
count parent)
|
||||||
2 margin))
|
2 org-e-ascii-quote-margin)
|
||||||
;; Text width within a plain-list is restricted by
|
;; Text width within a plain-list is restricted by
|
||||||
;; indentation of current item. If that's the case,
|
;; indentation of current item. If that's the case,
|
||||||
;; compute it with the help of `:structure' property from
|
;; compute it with the help of `:structure' property from
|
||||||
|
@ -924,6 +939,7 @@ INFO is a plist used as a communication channel."
|
||||||
"Return complete document string after ASCII conversion.
|
"Return complete document string after ASCII conversion.
|
||||||
CONTENTS is the transcoded contents string. INFO is a plist
|
CONTENTS is the transcoded contents string. INFO is a plist
|
||||||
holding export options."
|
holding export options."
|
||||||
|
(org-element-normalize-string
|
||||||
(org-e-ascii--indent-string
|
(org-e-ascii--indent-string
|
||||||
(let ((text-width (- org-e-ascii-text-width org-e-ascii-global-margin)))
|
(let ((text-width (- org-e-ascii-text-width org-e-ascii-global-margin)))
|
||||||
;; 1. Build title block.
|
;; 1. Build title block.
|
||||||
|
@ -946,6 +962,13 @@ holding export options."
|
||||||
(when definitions
|
(when definitions
|
||||||
(concat
|
(concat
|
||||||
"\n\n\n"
|
"\n\n\n"
|
||||||
|
(let ((title (org-e-ascii--translate "Footnotes\n" info)))
|
||||||
|
(concat
|
||||||
|
title
|
||||||
|
(make-string
|
||||||
|
(1- (length title))
|
||||||
|
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))))
|
||||||
|
"\n\n"
|
||||||
(mapconcat
|
(mapconcat
|
||||||
(lambda (ref)
|
(lambda (ref)
|
||||||
(let ((id (format "[%s] " (car ref))))
|
(let ((id (format "[%s] " (car ref))))
|
||||||
|
@ -977,7 +1000,7 @@ holding export options."
|
||||||
"\n\n\n"
|
"\n\n\n"
|
||||||
(org-e-ascii--fill-string
|
(org-e-ascii--fill-string
|
||||||
(plist-get info :creator) text-width info 'right))))))
|
(plist-get info :creator) text-width info 'right))))))
|
||||||
org-e-ascii-global-margin))
|
org-e-ascii-global-margin)))
|
||||||
|
|
||||||
(defun org-e-ascii--translate (s info)
|
(defun org-e-ascii--translate (s info)
|
||||||
"Translate string S.
|
"Translate string S.
|
||||||
|
@ -1440,11 +1463,11 @@ channel."
|
||||||
"Transcode a QUOTE-BLOCK element from Org to ASCII.
|
"Transcode a QUOTE-BLOCK element from Org to ASCII.
|
||||||
CONTENTS holds the contents of the block. INFO is a plist
|
CONTENTS holds the contents of the block. INFO is a plist
|
||||||
holding contextual information."
|
holding contextual information."
|
||||||
(let* ((width (org-e-ascii--current-text-width quote-block info))
|
(let ((width (org-e-ascii--current-text-width quote-block info)))
|
||||||
(margin-width (max (floor (/ width 12)) 2)))
|
|
||||||
(org-e-ascii--indent-string
|
(org-e-ascii--indent-string
|
||||||
(org-remove-indentation
|
(org-remove-indentation
|
||||||
(org-e-ascii--fill-string contents width info)) margin-width)))
|
(org-e-ascii--fill-string contents width info))
|
||||||
|
org-e-ascii-quote-margin)))
|
||||||
|
|
||||||
|
|
||||||
;;;; Quote Section
|
;;;; Quote Section
|
||||||
|
@ -1452,15 +1475,14 @@ holding contextual information."
|
||||||
(defun org-e-ascii-quote-section (quote-section contents info)
|
(defun org-e-ascii-quote-section (quote-section contents info)
|
||||||
"Transcode a QUOTE-SECTION element from Org to ASCII.
|
"Transcode a QUOTE-SECTION element from Org to ASCII.
|
||||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(let* ((width (org-e-ascii--current-text-width quote-section info))
|
(let ((width (org-e-ascii--current-text-width quote-section info))
|
||||||
(margin-width (max (floor (/ width 12)) 2))
|
|
||||||
(value
|
(value
|
||||||
(org-export-secondary-string
|
(org-export-secondary-string
|
||||||
(org-remove-indentation
|
(org-remove-indentation
|
||||||
(org-element-get-property :value quote-section)) 'e-ascii info)))
|
(org-element-get-property :value quote-section)) 'e-ascii info)))
|
||||||
(org-e-ascii--indent-string
|
(org-e-ascii--indent-string
|
||||||
value
|
value
|
||||||
(+ margin-width
|
(+ org-e-ascii-quote-margin
|
||||||
;; Don't apply inner margin if parent headline is low level.
|
;; Don't apply inner margin if parent headline is low level.
|
||||||
(let ((headline (org-export-get-parent-headline quote-section info)))
|
(let ((headline (org-export-get-parent-headline quote-section info)))
|
||||||
(if (org-export-low-level-p headline info) 0
|
(if (org-export-low-level-p headline info) 0
|
||||||
|
@ -1818,7 +1840,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(org-export-secondary-string
|
(org-export-secondary-string
|
||||||
(org-element-get-property :value verse-block) 'e-ascii info)
|
(org-element-get-property :value verse-block) 'e-ascii info)
|
||||||
verse-width 'left)
|
verse-width 'left)
|
||||||
(max (floor (/ verse-width 12)) 2))))
|
org-e-ascii-quote-margin)))
|
||||||
|
|
||||||
|
|
||||||
;;; Filter
|
;;; Filter
|
||||||
|
|
Loading…
Reference in New Issue