emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: HTML export and blogging to blogger.com


From: Christian Moe
Subject: Re: [Orgmode] Re: HTML export and blogging to blogger.com
Date: Wed, 17 Nov 2010 12:47:16 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

Hi,

Samuel Wales wrote:
So I guess I'd like to know if:

   1) anybody has a /hook in the exporter/ to unfill paragraphs, or

This is what I've come up with for posting comments on WordPress blogs, without <p> tags and linebreaks. It can probably be written more elegantly, but it does what I need. Haven't tried Blogger but possibly it works for you as well.

(defun my-org-postprocess-blog-post ()
    "Adapt exported HTML to blogs that get confused by <p> and
newlines."
  (let ((fill-column (point-max))) ; h/t Chris Lowry
    ;; p tags
    (goto-char (point-min))
    (while (re-search-forward "</?p>" nil t)
      (replace-match ""))
    ;; unfill
    (fill-region start end nil) ; with fill-column set really huge
    ;; delete superfluous blank lines (is there a better way?)
    (goto-char (point-min))
    (while (re-search-forward "\n\n+" nil t)
      (previous-line)
      (delete-blank-lines))))

(org-add-hook 'org-export-html-final-hook 'my-org-postprocess-blog-post)

   2) anybody has a way for the HTML to instruct the browser to /ignore
newlines/

I don't think that's a viable option across platforms.

Yours,
Christian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]