Browse Source

HTML export: Avoid empty lines at the beginning

This was a request by Ian Barton, to get Jekyll blogging working.
Carsten Dominik 15 years ago
parent
commit
178acdac94
2 changed files with 9 additions and 0 deletions
  1. 5 0
      lisp/ChangeLog
  2. 4 0
      lisp/org-html.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-11-21  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-html.el (org-export-as-html): Remove empty lines at the
+	beginning of the exported text.
+
 2009-11-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-protocol.el (org-protocol-remember): Cater for empty title,

+ 4 - 0
lisp/org-html.el

@@ -1469,6 +1469,10 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (delete-region beg end)
 	  (insert (format "<span style=\"visibility:hidden;\">%s</span>"
 			  (make-string n ?x)))))
+      ;; Remove empty lines at the beginning of the file.
+      (goto-char (point-min))
+      (when (looking-at "\\s-+\n") (replace-match ""))
+      ;; Run the hook
       (run-hooks 'org-export-html-final-hook)
       (or to-buffer (save-buffer))
       (goto-char (point-min))