mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-27 07:37:25 +00:00
Centering: Implement markup for centered text.
This commit is contained in:
parent
4ec5a19ecf
commit
ad11d7f675
@ -1,3 +1,7 @@
|
||||
2009-03-16 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.texi (Paragraphs): Document centering.
|
||||
|
||||
2009-03-14 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.texi (Creating timestamps, Agenda commands): Document new
|
||||
|
@ -7855,6 +7855,13 @@ but not any simpler -- Albert Einstein
|
||||
#+END_QUOTE
|
||||
@end example
|
||||
|
||||
If you would like to center some text, do it like this:
|
||||
@example
|
||||
#+BEGIN_CENTER
|
||||
Everything should be made as simple as possible, \\
|
||||
but not any simpler
|
||||
#+END_CENTER
|
||||
@end example
|
||||
|
||||
@node Literal examples, Include files, Paragraphs, Markup rules
|
||||
@subheading Literal examples
|
||||
|
@ -1,5 +1,12 @@
|
||||
2009-03-16 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-export-latex.el (org-export-latex-preprocess): Implement the
|
||||
centering markup.
|
||||
|
||||
* org-exp.el (org-export-mark-blockquote-verse-center): Renamed
|
||||
from `org-export-mark-blockquote-and-verse'.
|
||||
(org-export-as-html): Implement the centering markup.
|
||||
|
||||
* org-export-latex.el (org-export-latex-tables): Fix vertical
|
||||
lines in tables.
|
||||
|
||||
|
@ -1656,8 +1656,8 @@ on this string to produce the exported version."
|
||||
;; Protect verbatim elements
|
||||
(org-export-protect-verbatim)
|
||||
|
||||
;; Blockquotes and verse
|
||||
(org-export-mark-blockquote-and-verse)
|
||||
;; Blockquotes, verse, and center
|
||||
(org-export-mark-blockquote-verse-center)
|
||||
|
||||
;; Remove timestamps, if the user has requested so
|
||||
(unless (plist-get parameters :timestamps)
|
||||
@ -2027,7 +2027,7 @@ from the buffer."
|
||||
;; No, this is for a different backend, kill it
|
||||
(delete-region (match-beginning 0) (match-end 0)))))))
|
||||
|
||||
(defun org-export-mark-blockquote-and-verse ()
|
||||
(defun org-export-mark-blockquote-verse-center ()
|
||||
"Mark block quote and verse environments with special cookies.
|
||||
These special cookies will later be interpreted by the backend."
|
||||
;; Blockquotes
|
||||
@ -2042,6 +2042,12 @@ These special cookies will later be interpreted by the backend."
|
||||
(while (re-search-forward "^#\\+\\(begin\\|end\\)_verse\\>.*" nil t)
|
||||
(replace-match (if (equal (downcase (match-string 1)) "end")
|
||||
"ORG-VERSE-END" "ORG-VERSE-START")
|
||||
t t))
|
||||
;; Center
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^#\\+\\(begin\\|end\\)_center\\>.*" nil t)
|
||||
(replace-match (if (equal (downcase (match-string 1)) "end")
|
||||
"ORG-CENTER-END" "ORG-CENTER-START")
|
||||
t t)))
|
||||
|
||||
(defun org-export-attach-captions-and-attributes (backend target-alist)
|
||||
@ -3713,7 +3719,7 @@ lang=\"%s\" xml:lang=\"%s\">
|
||||
(insert "\n<hr/>\n"))
|
||||
(throw 'nextline nil))
|
||||
|
||||
;; Blockquotes and verse
|
||||
;; Blockquotes, verse, and center
|
||||
(when (equal "ORG-BLOCKQUOTE-START" line)
|
||||
(org-close-par-maybe)
|
||||
(insert "<blockquote>\n<p>\n")
|
||||
@ -3730,6 +3736,13 @@ lang=\"%s\" xml:lang=\"%s\">
|
||||
(insert "</p>\n")
|
||||
(setq inverse nil)
|
||||
(throw 'nextline nil))
|
||||
(when (equal "ORG-CENTER-START" line)
|
||||
(org-close-par-maybe)
|
||||
(insert "\n<p style=\"text-align: center\">\n")
|
||||
(throw 'nextline nil))
|
||||
(when (equal "ORG-CENTER-END" line)
|
||||
(insert "</p>\n")
|
||||
(throw 'nextline nil))
|
||||
(when inverse
|
||||
(let ((i (org-get-string-indentation line)))
|
||||
(if (> i 0)
|
||||
|
@ -1366,6 +1366,14 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
||||
(while (search-forward "ORG-VERSE-END" nil t)
|
||||
(replace-match "\\end{verse}" t t))
|
||||
|
||||
;; Convert center
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "ORG-CENTER-START" nil t)
|
||||
(replace-match "\\begin{center}" t t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "ORG-CENTER-END" nil t)
|
||||
(replace-match "\\end{center}" t t))
|
||||
|
||||
;; Convert horizontal rules
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^----+.$" nil t)
|
||||
|
@ -8373,6 +8373,7 @@ This function can be used in a hook."
|
||||
"BEGIN_EXAMPLE" "END_EXAMPLE"
|
||||
"BEGIN_QUOTE" "END_QUOTE"
|
||||
"BEGIN_VERSE" "END_VERSE"
|
||||
"BEGIN_CENTER" "END_CENTER"
|
||||
"BEGIN_SRC" "END_SRC"
|
||||
"CATEGORY" "COLUMNS"
|
||||
"CAPTION" "LABEL" "ATTR_HTML" "ATTR_LaTeX"))
|
||||
@ -8387,6 +8388,8 @@ This function can be used in a hook."
|
||||
"<quote>\n?\n</quote>")
|
||||
("v" "#+begin_verse\n?\n#+end_verse"
|
||||
"<verse>\n?\n/verse>")
|
||||
("c" "#+begin_center\n?\n#+end_center"
|
||||
"<center>\n?\n/center>")
|
||||
("l" "#+begin_latex\n?\n#+end_latex"
|
||||
"<literal style=\"latex\">\n?\n</literal>")
|
||||
("L" "#+latex: "
|
||||
|
Loading…
Reference in New Issue
Block a user