Quellcode durchsuchen

ox-texinfo: Fix quotations

* lisp/ox-texinfo.el (org-texinfo-quote-block): Do not use NAME
  keyword as the emphasized tag.  Use a dedicated :tag attribute
  instead.  Also add :author attribute.
* doc/org-manual.org (Quotations in Texinfo export): New section.
Nicolas Goaziou vor 6 Jahren
Ursprung
Commit
cbe1d76dc2
2 geänderte Dateien mit 35 neuen und 5 gelöschten Zeilen
  1. 29 0
      doc/org-manual.org
  2. 6 5
      lisp/ox-texinfo.el

+ 29 - 0
doc/org-manual.org

@@ -14852,6 +14852,35 @@ and specify the text using Texinfo code, as shown in the example:
 [[ridt.pdf]]
 #+end_example
 
+*** Quotations in Texinfo export
+:PROPERTIES:
+:DESCRIPTION: Quote block attributes.
+:END:
+
+#+cindex: @samp{ATTR_TEXINFO}, keyword
+You can write the text of a quotation within a quote block (see
+[[*Paragraphs]]).  You may also emphasize some text at the beginning of
+the quotation with the =:tag= attribute.
+
+#+begin_example
+,#+ATTR_TEXINFO: :tag Warning
+,#+BEGIN_QUOTE
+Striking your thumb with a hammer may cause severe pain and discomfort.
+,#+END_QUOTE
+#+end_example
+
+To specify the author of the quotation, use the =:author= attribute.
+
+#+begin_example
+,#+ATTR_TEXINFO: :author King Arthur
+,#+BEGIN_QUOTE
+The Lady of the Lake, her arm clad in the purest shimmering samite,
+held aloft Excalibur from the bosom of the water, signifying by divine
+providence that I, Arthur, was to carry Excalibur. That is why I am
+your king.
+,#+END_QUOTE
+#+end_example
+
 *** Special blocks in Texinfo export
 :PROPERTIES:
 :DESCRIPTION: Special block attributes.

+ 6 - 5
lisp/ox-texinfo.el

@@ -1345,11 +1345,12 @@ holding contextual information."
   "Transcode a QUOTE-BLOCK element from Org to Texinfo.
 CONTENTS holds the contents of the block.  INFO is a plist
 holding contextual information."
-  (let* ((title (org-element-property :name quote-block))
-	 (start-quote (concat "@quotation"
-			      (when title
-				(format " %s" title)))))
-    (format "%s\n%s@end quotation" start-quote contents)))
+  (let ((tag (org-export-read-attribute :attr_texinfo quote-block :tag))
+	(author (org-export-read-attribute :attr_texinfo quote-block :author)))
+    (format "@quotation%s\n%s%s\n@end quotation"
+	    (if tag (concat " " tag) "")
+	    contents
+	    (if author (concat "\n@author " author) ""))))
 
 ;;;; Radio Target