emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Writing for Blogger, including images
@ 2015-12-24 16:58 Peter Davis
  2015-12-24 18:23 ` Samuel Wales
  2015-12-25 16:56 ` Puneeth Chaganti
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Davis @ 2015-12-24 16:58 UTC (permalink / raw)
  To: emacs-orgmode

I would love to be able to write blog posts for Blogger, including 
images, and be able to upload the posts easily. I've seen various 
discussions about using org-mode for blogging, but nothing recent for 
Blogger specifically. Are there any good tools or tips for this?

I do regularly use org-mode for text blog posts, but I don't know a way 
to include images, preview the results, and then upload the whole thing 
to one of several blogs I have.

Thank you!

-pd

-- 
----
The Tech Curmudgeon
http://www.techcurmudgeon.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing for Blogger, including images
  2015-12-24 16:58 Writing for Blogger, including images Peter Davis
@ 2015-12-24 18:23 ` Samuel Wales
  2015-12-25 12:39   ` Peter Davis
  2015-12-25 16:56 ` Puneeth Chaganti
  1 sibling, 1 reply; 5+ messages in thread
From: Samuel Wales @ 2015-12-24 18:23 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

here is fragmentary code that might give you ideas.

(cl-defun alpha-org-blog-subtree (&key nocopy)
  "Copy the subtree, converted to HTML, for pasting into Blogger
as a blog post.  If there is an active region, use that instead.

This also works generically, because Blogger uses what Org will
output as body-only.  So it could be called `alpha-org-html'.

No other software needs to be installed.  No temporary file is
created.  No file is created.  A buffer is created.

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 settings and in the new Blogger post editor (the old editors
do not have that option) and in the Blogger pages editor (if you
use pages).  This makes Blogger more compatible.  Extra blank
lines are normally ignored in HTML (w3m and Firefox on .html), so
it makes sense to make Blogger ignore them instead of converting
them.  Org sometimes leaves extra blank lines, so it makes a
difference.

The HTML code is left in a buffer that is one buffer away in the
buffer ring.  To display it in a browser, use M-x
browse-url-of-buffer or similar, but you can also use my wrappers
that do it directly for you.

===

The top level headline by default is not exported, because
Blogger already has a title.  For both posts and pages, Blogger's
title field forms the URL and is therefore manually entered.

===

Org variables:

You can control what gets exported with org-export-with-*.  I
also find that (setq org-export-headline-levels 10) is useful.

===

Advanced:

With non-interactive keyword NOCOPY, don't save the output in
the kill ring.

===

I use Blogger.com for hosted blogging instead of Wordpress.com
because Google has a better attitude toward accessibility.
"
  (interactive)

;;; I tried using mail2blogger, but the HTML got posted.  fixme
;;; try with msmtp or find out how to send raw programmatic
;;; email.
;;;
;;; ===
;;;
;;; 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 other blog entries.
;;;
;;; Also, remind you to make sure all links work and review
;;; formatting.
;;;

  ;; We need to create output that removes <p> tags for Blogger
  ;; comments.

  ;; with mail2blogger or weblogger.el or atom, we can assume
  ;; publish.

  (save-excursion
    (save-window-excursion
      (unless (org-region-active-p)
        (org-mark-subtree)
        ;; skip headline
        (forward-line 1))

      (let ((output-buffer
             ;; recommended: (let ((org-html-toplevel-hlevel 3))
             ;; we do our own copying in case we want to wrap and
             ;; then copy.
             ;;
             ;; (let ((org-export-copy-to-kill-ring (not nocopy)))
             (save-excursion
               (save-window-excursion
                 (org-export-to-buffer 'html
                                       ;;or buf
                                       alpha-org-blog-html-buffer
                                       ;; new arg for async
                                       nil
                                       'subtree
                                       ;; visible-only
                                       nil
                                       'body-only)))))

        ;;(deactivate-mark)
        (switch-to-buffer output-buffer)

        ;; org doesn't include a newline at the end
        (goto-char (point-max))
        (insert "\n")
        (goto-char (point-min))

        (unless nocopy
          (copy-region-as-kill (point-min) (point-max)))

        (setq header-line-format "html output")

        ;; we want the output buffer to be silently in the next
        ;; buffer in the buffer ring.
        (previous-buffer)
        (message "alpha org exported")
        output-buffer))))

for images:

#+ATTR_HTML: :title Fern
#+ATTR_HTML: :alt (c) ... Their free license
#+ATTR_HTML: :align center
#+ATTR_HTML: :width 512px
{{{image-fern}}}

#+macro: image-fern http://2.bp.blogspot.com/....jpg


On 12/24/15, Peter Davis <pfd@pfdstudio.com> wrote:
> I would love to be able to write blog posts for Blogger, including
> images, and be able to upload the posts easily. I've seen various
> discussions about using org-mode for blogging, but nothing recent for
> Blogger specifically. Are there any good tools or tips for this?
>
> I do regularly use org-mode for text blog posts, but I don't know a way
> to include images, preview the results, and then upload the whole thing
> to one of several blogs I have.
>
> Thank you!
>
> -pd
>
> --
> ----
> The Tech Curmudgeon
> http://www.techcurmudgeon.com
>
>
>


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing for Blogger, including images
  2015-12-24 18:23 ` Samuel Wales
@ 2015-12-25 12:39   ` Peter Davis
  2015-12-26  0:59     ` Samuel Wales
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Davis @ 2015-12-25 12:39 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Thank you, Samuel. I'm not sure what all this is. It appears to be 
snippets from various file and info topics. But I'll go through it more 
carefully.

Thank you.
-pd


On 12/24/15 1:23 PM, Samuel Wales wrote:
> here is fragmentary code that might give you ideas.
>
> (cl-defun alpha-org-blog-subtree (&key nocopy)
>    "Copy the subtree, converted to HTML, for pasting into Blogger
> as a blog post.  If there is an active region, use that instead.
>
> This also works generically, because Blogger uses what Org will
> output as body-only.  So it could be called `alpha-org-html'.
>
> No other software needs to be installed.  No temporary file is
> created.  No file is created.  A buffer is created.
>
> 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 settings and in the new Blogger post editor (the old editors
> do not have that option) and in the Blogger pages editor (if you
> use pages).  This makes Blogger more compatible.  Extra blank
> lines are normally ignored in HTML (w3m and Firefox on .html), so
> it makes sense to make Blogger ignore them instead of converting
> them.  Org sometimes leaves extra blank lines, so it makes a
> difference.
>
> The HTML code is left in a buffer that is one buffer away in the
> buffer ring.  To display it in a browser, use M-x
> browse-url-of-buffer or similar, but you can also use my wrappers
> that do it directly for you.
>
> ===
>
> The top level headline by default is not exported, because
> Blogger already has a title.  For both posts and pages, Blogger's
> title field forms the URL and is therefore manually entered.
>
> ===
>
> Org variables:
>
> You can control what gets exported with org-export-with-*.  I
> also find that (setq org-export-headline-levels 10) is useful.
>
> ===
>
> Advanced:
>
> With non-interactive keyword NOCOPY, don't save the output in
> the kill ring.
>
> ===
>
> I use Blogger.com for hosted blogging instead of Wordpress.com
> because Google has a better attitude toward accessibility.
> "
>    (interactive)
>
> ;;; I tried using mail2blogger, but the HTML got posted.  fixme
> ;;; try with msmtp or find out how to send raw programmatic
> ;;; email.
> ;;;
> ;;; ===
> ;;;
> ;;; 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 other blog entries.
> ;;;
> ;;; Also, remind you to make sure all links work and review
> ;;; formatting.
> ;;;
>
>    ;; We need to create output that removes <p> tags for Blogger
>    ;; comments.
>
>    ;; with mail2blogger or weblogger.el or atom, we can assume
>    ;; publish.
>
>    (save-excursion
>      (save-window-excursion
>        (unless (org-region-active-p)
>          (org-mark-subtree)
>          ;; skip headline
>          (forward-line 1))
>
>        (let ((output-buffer
>               ;; recommended: (let ((org-html-toplevel-hlevel 3))
>               ;; we do our own copying in case we want to wrap and
>               ;; then copy.
>               ;;
>               ;; (let ((org-export-copy-to-kill-ring (not nocopy)))
>               (save-excursion
>                 (save-window-excursion
>                   (org-export-to-buffer 'html
>                                         ;;or buf
>                                         alpha-org-blog-html-buffer
>                                         ;; new arg for async
>                                         nil
>                                         'subtree
>                                         ;; visible-only
>                                         nil
>                                         'body-only)))))
>
>          ;;(deactivate-mark)
>          (switch-to-buffer output-buffer)
>
>          ;; org doesn't include a newline at the end
>          (goto-char (point-max))
>          (insert "\n")
>          (goto-char (point-min))
>
>          (unless nocopy
>            (copy-region-as-kill (point-min) (point-max)))
>
>          (setq header-line-format "html output")
>
>          ;; we want the output buffer to be silently in the next
>          ;; buffer in the buffer ring.
>          (previous-buffer)
>          (message "alpha org exported")
>          output-buffer))))
>
> for images:
>
> #+ATTR_HTML: :title Fern
> #+ATTR_HTML: :alt (c) ... Their free license
> #+ATTR_HTML: :align center
> #+ATTR_HTML: :width 512px
> {{{image-fern}}}
>
> #+macro: image-fern http://2.bp.blogspot.com/....jpg
>
>
> On 12/24/15, Peter Davis <pfd@pfdstudio.com> wrote:
>> I would love to be able to write blog posts for Blogger, including
>> images, and be able to upload the posts easily. I've seen various
>> discussions about using org-mode for blogging, but nothing recent for
>> Blogger specifically. Are there any good tools or tips for this?
>>
>> I do regularly use org-mode for text blog posts, but I don't know a way
>> to include images, preview the results, and then upload the whole thing
>> to one of several blogs I have.
>>
>> Thank you!
>>
>> -pd
>>
>> --
>> ----
>> The Tech Curmudgeon
>> http://www.techcurmudgeon.com
>>
>>
>>
>

-- 
----
The Tech Curmudgeon
http://www.techcurmudgeon.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing for Blogger, including images
  2015-12-24 16:58 Writing for Blogger, including images Peter Davis
  2015-12-24 18:23 ` Samuel Wales
@ 2015-12-25 16:56 ` Puneeth Chaganti
  1 sibling, 0 replies; 5+ messages in thread
From: Puneeth Chaganti @ 2015-12-25 16:56 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

On Thu, Dec 24, 2015 at 10:28 PM, Peter Davis <pfd@pfdstudio.com> wrote:
> I do regularly use org-mode for text blog posts, but I don't know a way to
> include images, preview the results, and then upload the whole thing to one
> of several blogs I have.


There is also org2blog/atom[1] (which doesn't seem to have any recent activity).

[1]  - http://www.emacswiki.org/emacs/Org2BlogAtom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing for Blogger, including images
  2015-12-25 12:39   ` Peter Davis
@ 2015-12-26  0:59     ` Samuel Wales
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2015-12-26  0:59 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

it is a command to post for blogger.  you might need to supply something.

it is not snippets from info.

it also includes examples of what to put in your .org file.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-26  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-24 16:58 Writing for Blogger, including images Peter Davis
2015-12-24 18:23 ` Samuel Wales
2015-12-25 12:39   ` Peter Davis
2015-12-26  0:59     ` Samuel Wales
2015-12-25 16:56 ` Puneeth Chaganti

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).