Skip to content

Commit

Permalink
org-lparse.el & co: Bring over few commits (contd.)
Browse files Browse the repository at this point in the history
Bring over following commits:
- dfcb6fa
- 767f518
- ca49e89
- 728611f
- b2408c0
- 97d107d
  • Loading branch information
kjambunathan committed Nov 13, 2011
1 parent b13b3e3 commit 7e31ecd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
41 changes: 26 additions & 15 deletions contrib/lisp/org-lparse.el
Expand Up @@ -563,6 +563,7 @@ and then converted to \"doc\" then org-lparse-backend is set to
(setq params (format "(%s)" params))) (setq params (format "(%s)" params)))
(ignore-errors (read params))))) (ignore-errors (read params)))))


(defvar org-heading-keyword-regexp-format) ; defined in org.el
(defvar org-lparse-special-blocks '("list-table" "annotation")) (defvar org-lparse-special-blocks '("list-table" "annotation"))
(defun org-do-lparse (arg &optional hidden ext-plist (defun org-do-lparse (arg &optional hidden ext-plist
to-buffer body-only pub-dir) to-buffer body-only pub-dir)
Expand Down Expand Up @@ -674,6 +675,7 @@ version."
(current-dir (if buffer-file-name (current-dir (if buffer-file-name
(file-name-directory buffer-file-name) (file-name-directory buffer-file-name)
default-directory)) default-directory))
(auto-insert nil) ; Avoid any auto-insert stuff for the new file
(buffer (if to-buffer (buffer (if to-buffer
(cond (cond
((eq to-buffer 'string) ((eq to-buffer 'string)
Expand All @@ -684,6 +686,12 @@ version."
(and f (functionp f) (funcall f filename))) (and f (functionp f) (funcall f filename)))
filename)))) filename))))
(org-levels-open (make-vector org-level-max nil)) (org-levels-open (make-vector org-level-max nil))
(dummy (mapc
(lambda(p)
(let* ((val (plist-get opt-plist p))
(val (org-xml-encode-org-text-skip-links val)))
(setq opt-plist (plist-put opt-plist p val))))
'(:date :author :keywords :description)))
(date (plist-get opt-plist :date)) (date (plist-get opt-plist :date))
(date (cond (date (cond
((and date (string-match "%" date)) ((and date (string-match "%" date))
Expand All @@ -704,8 +712,9 @@ version."
"UNTITLED"))) "UNTITLED")))
(dummy (setq opt-plist (plist-put opt-plist :title title))) (dummy (setq opt-plist (plist-put opt-plist :title title)))
(html-table-tag (plist-get opt-plist :html-table-tag)) (html-table-tag (plist-get opt-plist :html-table-tag))
(quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) (quote-re0 (concat "^ *" org-quote-string "\\( +\\|[ \t]*$\\)"))
(quote-re (concat "^\\(\\*+\\)\\([ \t]+" org-quote-string "\\>\\)")) (quote-re (format org-heading-keyword-regexp-format
org-quote-string))
(org-lparse-dyn-current-environment nil) (org-lparse-dyn-current-environment nil)
;; Get the language-dependent settings ;; Get the language-dependent settings
(lang-words (or (assoc (plist-get opt-plist :language) (lang-words (or (assoc (plist-get opt-plist :language)
Expand Down Expand Up @@ -1038,7 +1047,7 @@ version."
t t line)))))) t t line))))))


(cond (cond
((string-match "^\\(\\*+\\)[ \t]+\\(.*\\)" line) ((string-match "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" line)
;; This is a headline ;; This is a headline
(setq level (org-tr-level (- (match-end 1) (match-beginning 1) (setq level (org-tr-level (- (match-end 1) (match-beginning 1)
level-offset)) level-offset))
Expand Down Expand Up @@ -1450,18 +1459,20 @@ Possible conversions are set in `org-export-html-protect-char-alist'."


(defun org-xml-encode-org-text-skip-links (string) (defun org-xml-encode-org-text-skip-links (string)
"Prepare STRING for HTML export. Apply all active conversions. "Prepare STRING for HTML export. Apply all active conversions.
If there are links in the string, don't modify these." If there are links in the string, don't modify these. If STRING
(let* ((re (concat org-bracket-link-regexp "\\|" is nil, return nil."
(org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) (when string
m s l res) (let* ((re (concat org-bracket-link-regexp "\\|"
(while (setq m (string-match re string)) (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")))
(setq s (substring string 0 m) m s l res)
l (match-string 0 string) (while (setq m (string-match re string))
string (substring string (match-end 0))) (setq s (substring string 0 m)
(push (org-xml-encode-org-text s) res) l (match-string 0 string)
(push l res)) string (substring string (match-end 0)))
(push (org-xml-encode-org-text string) res) (push (org-xml-encode-org-text s) res)
(apply 'concat (nreverse res)))) (push l res))
(push (org-xml-encode-org-text string) res)
(apply 'concat (nreverse res)))))


(defun org-xml-encode-org-text (s) (defun org-xml-encode-org-text (s)
"Apply all active conversions to translate special ASCII to HTML." "Apply all active conversions to translate special ASCII to HTML."
Expand Down
5 changes: 3 additions & 2 deletions contrib/lisp/org-xhtml.el
Expand Up @@ -1274,11 +1274,11 @@ make any modifications to the exporter file. For example,
"%s "%s
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\">
lang=\"%s\" xml:lang=\"%s\">
<head> <head>
<title>%s</title> <title>%s</title>
<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/> <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>
<meta name=\"title\" content=\"%s\"/>
<meta name=\"generator\" content=\"Org-mode\"/> <meta name=\"generator\" content=\"Org-mode\"/>
<meta name=\"generated\" content=\"%s\"/> <meta name=\"generated\" content=\"%s\"/>
<meta name=\"author\" content=\"%s\"/> <meta name=\"author\" content=\"%s\"/>
Expand All @@ -1300,6 +1300,7 @@ lang=\"%s\" xml:lang=\"%s\">
language language language language
(plist-get opt-plist :title) (plist-get opt-plist :title)
charset charset
(plist-get opt-plist :title)
(plist-get opt-plist :effective-date) (plist-get opt-plist :effective-date)
(plist-get opt-plist :author) (plist-get opt-plist :author)
(plist-get opt-plist :description) (plist-get opt-plist :description)
Expand Down

0 comments on commit 7e31ecd

Please sign in to comment.