org-export-generic.el: Small code clean-up

* org-export-generic.el (org-export-generic-preprocess): Use
`delete-backward-char' instead of `backward-delete-char'.
(org-generic-alist, def-org-export-generic-keyword)
(org-export-generic-remember-section, org-export-generic)
(org-export-generic-format, org-export-generic-header)
(org-generic-level-start): Remove dangling parentheses,
fix indentation.
This commit is contained in:
Bastien Guerry 2012-12-23 12:23:02 +01:00
parent 6b9d77eb8c
commit 91056e2a8d
1 changed files with 120 additions and 148 deletions

View File

@ -230,10 +230,7 @@ in this way, it will be wrapped."
; print above and below all body parts
:body-text-prefix "<p>\n"
:body-text-suffix "</p>\n"
)
:body-text-suffix "</p>\n")
;;
;; ascii exporter
;;
@ -290,9 +287,8 @@ in this way, it will be wrapped."
; :body-text-suffix "</t>\n"
:body-bullet-list-prefix (?* ?+ ?-)
:body-bullet-list-prefix (?* ?+ ?-))
; :body-bullet-list-suffix (?* ?+ ?-)
)
;;
;; wikipedia
@ -327,8 +323,7 @@ in this way, it will be wrapped."
:body-list-format "* %s\n"
:body-number-list-format "# %s\n"
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** ")
)
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** "))
;;
;; mediawiki
;;
@ -370,10 +365,7 @@ in this way, it will be wrapped."
:body-table-cell-start "|"
:body-table-cell-end "\n"
:body-table-last-cell-end "|-"
:body-table-hline-start ""
)
:body-table-hline-start "")
;;
;; internet-draft .xml for xml2rfc exporter
;;
@ -437,9 +429,7 @@ in this way, it will be wrapped."
:body-list-prefix "<list style=\"symbols\">\n"
:body-list-suffix "</list>\n"
:body-list-format "<t>%s</t>\n"
)
:body-list-format "<t>%s</t>\n")
("trac-wiki"
:file-suffix ".txt"
:key-binding ?T
@ -474,8 +464,7 @@ in this way, it will be wrapped."
;; :body-list-suffix "LISTEND"
;; this is ignored! [2010/02/02:rpg]
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** ")
)
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** "))
("tikiwiki"
:file-suffix ".txt"
:key-binding ?U
@ -517,11 +506,8 @@ in this way, it will be wrapped."
:underline-format "===%s==="
:strikethrough-format "--%s--"
:code-format "-+%s+-"
:verbatim-format "~pp~%s~/pp~"
)
)
"A assoc list of property lists to specify export definitions"
)
:verbatim-format "~pp~%s~/pp~"))
"A assoc list of property lists to specify export definitions")
(setq org-generic-export-type "demo")
@ -541,11 +527,10 @@ export definitions."
type)
"Define KEYWORD as a legitimate element for inclusion in
the body of an org-set-generic-type definition."
`(progn
(pushnew ,keyword org-export-generic-keywords)
;; TODO: push the documentation and type information
;; somewhere where it will do us some good.
))
`(progn
(pushnew ,keyword org-export-generic-keywords)))
(def-org-export-generic-keyword :body-newline-paragraph
:documentation "Bound either to NIL or to a pattern to be
@ -565,15 +550,11 @@ is \"\\n\". Should typically be combined with a value for
(def-org-export-generic-keyword :code-format)
(def-org-export-generic-keyword :verbatim-format)
(defun org-export-generic-remember-section (type suffix &optional prefix)
(setq org-export-generic-section-type type)
(setq org-export-generic-section-suffix suffix)
(if prefix
(insert prefix))
)
(insert prefix)))
(defun org-export-generic-check-section (type &optional prefix suffix)
"checks to see if type is already in use, or we're switching parts
@ -700,7 +681,7 @@ underlined headlines. The default is 3."
(email (plist-get opt-plist :email))
(language (plist-get opt-plist :language))
(quote-re0 (concat "^[ \t]*" org-quote-string "\\>"))
; (quote-re (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
; (quote-re (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
(todo nil)
(lang-words nil)
(region
@ -881,7 +862,7 @@ underlined headlines. The default is 3."
(if tocprefix
(push tocprefix thetoc))
(mapc '(lambda (line)
(mapc #'(lambda (line)
(if (string-match org-todo-line-regexp line)
;; This is a headline
(progn
@ -954,8 +935,7 @@ underlined headlines. The default is 3."
toctags)
thetoc)
(setq org-last-level level))
))))
(setq org-last-level level))))))
lines)
(if tocsuffix
(push tocsuffix thetoc))
@ -1075,8 +1055,7 @@ underlined headlines. The default is 3."
listcheckdoneend)))
((string-match "^\\(\\[/\\]\\)[ \t]*" line)
(setq line (concat (replace-match listcheckhalf nil nil line)
listcheckhalfend)))
)
listcheckhalfend))))
(insert (format listformat (org-export-generic-fontify line))))
((string-match "^\\([ \t]+\\)\\([0-9]+\\.[ \t]*\\)" line)
@ -1101,8 +1080,7 @@ underlined headlines. The default is 3."
listcheckdoneend)))
((string-match "\\(\\[/\\]\\)[ \t]*" line)
(setq line (concat (replace-match listcheckhalf nil nil line)
listcheckhalfend)))
)
listcheckhalfend))))
(insert (format numlistformat (org-export-generic-fontify line))))
@ -1221,8 +1199,7 @@ REVERSE means to reverse the list if the plist match is a list
(if (stringp subtype)
subtype
(concat (make-string len subtype) "\n")))
(t ""))
))
(t ""))))
(defun org-export-generic-header (header export-plist
prefixprop formatprop postfixprop
@ -1233,8 +1210,7 @@ REVERSE means to reverse the list if the plist match is a list
(concat
(org-export-generic-format export-plist prefixprop len n reverse)
(format (or formatspec "%s") header)
(org-export-generic-format export-plist postfixprop len n reverse))
))
(org-export-generic-format export-plist postfixprop len n reverse))))
(defun org-export-generic-preprocess (parameters)
"Do extra work for ASCII export"
@ -1242,7 +1218,7 @@ REVERSE means to reverse the list if the plist match is a list
(goto-char (point-min))
(while (re-search-forward org-verbatim-re nil t)
(goto-char (match-end 2))
(backward-delete-char 1) (insert "'")
(delete-backward-char 1) (insert "'")
(goto-char (match-beginning 2))
(delete-char 1) (insert "`")
(goto-char (match-end 2)))
@ -1323,22 +1299,18 @@ REVERSE means to reverse the list if the plist match is a list
(insert
(org-export-generic-format export-plist :body-section-prefix 0
(+ old-level counter)))
(setq counter (1+ counter))
))
(setq counter (1+ counter))))
;; going up
((< level old-level)
(while (> (- old-level counter) (1- level))
(insert
(org-export-generic-format export-plist :body-section-suffix 0
(- old-level counter)))
(setq counter (1+ counter))
))
(setq counter (1+ counter))))
;; same level
((= level old-level)
(insert
(org-export-generic-format export-plist :body-section-suffix 0 level))
)
)
(org-export-generic-format export-plist :body-section-suffix 0 level))))
(insert
(org-export-generic-format export-plist :body-section-prefix 0 level))