From: Samuel Wales <samologist@gmail.com>
To: "Tom Breton (Tehom)" <tehom@panix.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Blogging from org-mode
Date: Sun, 16 Jan 2011 15:59:12 -0700 [thread overview]
Message-ID: <AANLkTi=9faBSiZy8Eu4eFN1tc6x5pF2kVgdHJDQaP-Z4@mail.gmail.com> (raw)
In-Reply-To: <448f55abac6a0c1da962076fb75d186d.squirrel@mail.panix.com>
On 2011-01-16, Tom Breton (Tehom) <tehom@panix.com> wrote:
> Please tell me if I've missed any other org-based blogging software (other
> than the blog hosting software which is a different category).
Right, there are hosted blogs (like Blogger) and self-hosted blogs
(where you run the software).
Here is the latest version of my Blogger command.
I wrote it for these reasons:
1) should work with all recent versions of Emacs including 22
2) works on subtrees (not files)
3) does not require any downloads of Google software (self-contained)
4) handles H levels correctly
5) uses subtree top level headline as a title
6) shows you the HTML
7) doesn't include stuff I don't want there (author etc.)
The only change I would make, but cannot do for health
reasons, is to make it work with mail2blogger.
I would be delighted if there were some other protocol that
it could use.
Could your API work to send the result to Blogger? If so,
how? Do you have to sign up with Google in some special way
or does it work just through the web?
Thanks.
Samuel
(defun alpha-org-blog-subtree ()
"Copy the subtree, converted to HTML, for pasting into Blogger
as a blog post.
No other software needs to be installed.
===
For an example of this code in action, see
http://thekafkapandemic.blogspot.com/ .
You have to turn off Blogger's conversion of newline to br tags
in two places. This requires the new editor.
mail2blogger is a very intriguing option here and I'd like to do
that. Avoids the web entirely. See comments.
To display the results in a browser, use M-x browse-url-of-buffer
.
No temporary file is created.
===
Mark pages (About, Contribute, etc.) with the tag, :page:. This
will remove the top headline. The reason is that Blogger pages
always include the title as the name of the page and it looks
silly to have two titles.
===
You should turn off Blogger's showing of titles.
Turning off the titles has one convenience: you don't have to
enter it manually. It also has one drawback: people who link to
your post by copying that link cannot do so (they can get it from
other places, including the URL bar and Archives in the sidebar).
Perhaps mail2blogger will fix that by letting you set the title
by email subject.
Of course you can manually enter the title. In which case
use :page:.
===
I use Blogger.com instead of Wordpress.com because it appears to
have a better attitude toward accessibility.
"
(interactive)
;;; todo list
;;;
;;; === mail2blogger ===
;;;
;;; I tried using mail2blogger, but the HTML got posted. There might
;;; be a way to fix this. How do you do an HTML email in a format
;;; that gets recognized as HTML?
;;;
;;; We want to use raw programmatic email, such as sent using msmtp
;;; or the built-in Emacs client. The ability to do so will obviate
;;; the need to use Google's command line client or to run Emacs 23.
;;;
;;; This is the next thing to try. Patch welcome. I have no idea
;;; how to do it.
;;;
;;; ===
;;;
;;; Another good thing to try would be to automate grabbing the source from
;;; the page automatically to compare what you just created with ediff or
;;; git diff --color-words. This is for edits.
;;;
;;; Also, export whole blog before each post for git. Requires post
;;; method maybe. How to do that?
;;;
;;; Also, check for fixmes. (Or org could check for fixmes before
;;; all export. Is there a hook?)
;;;
;;; Also, remind you to extract big chunks of comments for possible ohter
;;; blog entries.
;;;
;;; /Also, remind you to make sure all links work and review formatting/.
;;;
;;; ===
;;;
;;; Is there HTML for a title? I will guess not.
(save-excursion
;;say about to publish editing or about to publish post. with
;;mail2blogger, we can automate this and assume publish.
;;
;;technically, this should be later in case you kill something inside
;;the note.
;;
;;(let ((k kill-ring))
;;(let ((c (car kill-ring)))
(org-add-note)
;;
;;could add sugu here. donekeep or tag should be done manually.
;;
;;how do we want blogs to sort? probably donekeep. probably not by
;;latest edit but by publish.
;;i have an issue with "--", which is perfect for emdash in ascii, but
;;gets converted to endash in html. i'd like it to be emdash in html.
;;is there an option for that?
;;
;;if not, we have to replace -- with --- somehow here before exporting.
;;that requires a temporary buffer.
;;org converts headlines to html h numbers according to the level in the
;;org file, not the level in the region. i prefer the latter.
;;
;;kludge it.
;;
;;for a blog we want it to start with delta 0 = h1. delta 1 respects
;;the variable.
;;
;;for some reason, blogger does not format h2 bold on firefox. so h3
;;looks bigger? if so, do delta 2. css wizards please weigh in on this.
(let ((delta 2))
(outline-mark-subtree)
(when (member "page" (org-get-tags))
;;remove title
(forward-line 1)
;;might be nice to add hr here
;;we will start with the first headilne's title
(decf delta))
(switch-to-buffer
(let ((org-export-html-toplevel-hlevel
(+ delta (- org-export-html-toplevel-hlevel
(org-reduced-level (org-current-level)))))
(org-export-headline-levels
(+ delta (- org-export-headline-levels
(org-reduced-level (org-current-level)))))
org-export-with-tags
org-export-with-todo-keywords
org-export-with-timestamps
;;note: priority must be after todo kw for export
;;already nil org-export-with-priority
)
(org-export-region-as-html (region-beginning)
(region-end)
t
;;seems to erase, which we want
(get-buffer-create
;;this should work if it is a *buffer*
;;but some might prefer html mode.
;;this does not save to a file unless
;;you do.
"alpha-org-blog-subtree.html")))
;;one drawback is it leaves spaces around text. like "tag> text". there
;;might be other drawbacks.
;;(hoka-unfill-region-special (point-min) (point-max))
;;(goto-char (point-min))
;;this does not work because it will join lines with no space in between;
;;we have to actually fill paragraphs.
;;; (while (search-forward "\n" nil t)
;;; (replace-match ""))
;;; (insert "\n")
;;unnec if blogger knows to treat whitespace as insignificant
;;; (goto-char (point-min))
;;; (delete-matching-lines "^$")
(kill-ring-save (point-min) (point-max))))))
--
The Kafka Pandemic: http://thekafkapandemic.blogspot.com
I support WPI: http://www.wpinstitute.org/xmrv/index.html -- PLEASE DONATE
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MLV paper.
-- [[file:~/Desktop/K/kpc/org/todo-new--a.org]]
next prev parent reply other threads:[~2011-01-16 22:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-16 20:57 Blogging from org-mode Tom Breton (Tehom)
2011-01-16 22:59 ` Samuel Wales [this message]
2011-01-17 2:25 ` Tom Breton (Tehom)
2011-01-17 19:39 ` Samuel Wales
2011-01-17 19:13 ` Juan Reyero
2011-01-17 20:03 ` Erik Iverson
2011-01-17 21:02 ` Samuel Wales
2011-01-17 21:28 ` Erik Iverson
2011-01-18 3:46 ` Samuel Wales
-- strict thread matches above, loose matches on Subject: below --
2008-03-17 6:06 blogging " Cezar Halmagean
2008-03-18 23:27 ` Bastien Guerry
2008-03-19 18:05 ` Cezar Halmagean
2008-03-20 10:04 ` Bastien
2008-03-20 16:47 ` Cezar Halmagean
2008-03-20 18:20 ` Bastien Guerry
2008-03-20 18:52 ` Cezar Halmagean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=9faBSiZy8Eu4eFN1tc6x5pF2kVgdHJDQaP-Z4@mail.gmail.com' \
--to=samologist@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=tehom@panix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.