Browse Source

org-exp: now removing table meta (e.g. #+TBLNAME, #+TBLFM) from export

* lisp/org-exp.el (org-export-handle-table-metalines): this function
  removes table specific meta-lines, now that we aren't wiping
  everything that looks remotely like a comment at the end of the
  export process we have to be sure to catch all of the specific lines
  in org-exp.el
Eric Schulte 15 years ago
parent
commit
f44832eed0
1 changed files with 16 additions and 0 deletions
  1. 16 0
      lisp/org-exp.el

+ 16 - 0
lisp/org-exp.el

@@ -1161,6 +1161,9 @@ on this string to produce the exported version."
       ;; Remove or replace comments
       (org-export-handle-comments (plist-get parameters :comments))
 
+      ;; Remove #+TBLFM and #+TBLNAME lines
+      (org-export-handle-table-metalines)
+      
       ;; Run the final hook
       (run-hooks 'org-export-preprocess-final-hook)
 
@@ -1671,6 +1674,19 @@ When it is nil, all comments will be removed."
 	  (replace-match "")
 	  (goto-char (max (point-min) (1- pos))))))))
 
+(defun org-export-handle-table-metalines ()
+  "Remove table specific metalines #+TBLNAME: and #+TBLFM:."
+  (let ((re "^[ \t]*#\\+TBL\\(NAME\\|FM\\):\\(.*\n?\\)")
+	pos)
+    (goto-char (point-min))
+    (while (or (looking-at re)
+	       (re-search-forward re nil t))
+      (setq pos (match-beginning 0))
+      (if (get-text-property (point) 'org-protected)
+	  (goto-char (1+ pos))
+	(goto-char (1+ pos))
+	(replace-match "")
+	(goto-char (max (point-min) (1- pos)))))))
 
 (defun org-export-mark-radio-links ()
   "Find all matches for radio targets and turn them into internal links."