Added Wordpress tags and excerpt to weblogger 1.4.4

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Added Wordpress tags and excerpt to weblogger 1.4.4

Aaron Hammitt
Hello,

I am new to this list and new to weblogger.el. I've used Emacs for a while but am just learning elisp. Anyway, I was a little annoyed by the lack of support for tags and excerpts. After looking through the code I made enough sense of it to get the tags and excerpts working (using mt_keywords and mt_excerpts, and associating them with the "Keywords" and "Summary" fields, respectively).

These are the changes I made:

------- BEGIN DIFF -----
--- weblogger-1.4.4.el Fri Mar 12 08:36:26 2010
+++ weblogger.el Wed Mar 17 13:25:54 2010
@@ -1,5 +1,6 @@
 ;;; weblogger.el --- Weblog maintenance via XML-RPC APIs
 
+;; Modified for Wordpress March 2010 by Aaron Hammitt 
 ;; Copyright (C) 2002-2009 Mark A. Hershberger.
 ;; Inspired by code Copyright (C) 2001 by Simon Kittle.
 ;; Parts Copyright (C) 2007 Wickersheimer Jeremy.
@@ -679,6 +680,8 @@
                                         ; Note that the blogger API on
                                         ; blogger.com is depcrated and
                                         ; broken on this element.
+    (list "Summary"
+  (cdr (assoc "excerpt" entry)))
     (list "From"
   (or (cdr (assoc "authorName"  entry))
       weblogger-server-username))
@@ -1186,6 +1189,8 @@
                                                ; the modified flag
                                                ; themselves if they
                                                ; want to.
+  (message-fetch-field "Summary")
+  (message-goto-summary)
   (if (message-fetch-field "Subject")
       (message-goto-body) ;; If Subject exists, move cursor to message
                           ;; body
@@ -1208,7 +1213,8 @@
  (url         (cdr (assoc-string "link" response t)))
  (description      (assoc-string "description" response))
  (extended         (assoc-string "mt_text_more" response))
- (tags        (cdr (assoc-string "mt_tags" response t)))
+ (tags        (cdr (assoc-string "mt_keywords" response t)))
+ (excerpt     (cdr (assoc-string "mt_excerpt" response t)))
         (categories  (cdr (assoc-string "categories" response t))))
 
     (cond (content
@@ -1265,6 +1271,8 @@
  (cons "dateCreated"  dateCreated))
       (when tags
  (cons "tags"   tags))
+      (when excerpt
+ (cons "excerpt" excerpt))
       (when categories
  (cons "categories"   categories))
       (when textType
@@ -1291,7 +1299,9 @@
          (when (cdr (assoc "content" entry))
            (cons "description" (cdr (assoc "content" entry))))
          (when (cdr (assoc "tags" entry))
-           (cons "mt_tags" (cdr (assoc "tags" entry))))
+           (cons "mt_keywords" (cdr (assoc "tags" entry))))
+         (when (cdr (assoc "excerpt" entry))
+           (cons "mt_excerpt" (cdr (assoc "excerpt" entry))))
          (when (cdr (assoc "categories" entry))
            (cons "categories" (cdr (assoc "categories" entry)))))))
 
@@ -1377,6 +1387,7 @@
    (cons "title"     (or (message-fetch-field "Subject")
  weblogger-default-title))
    (cons "tags" (message-fetch-field "Keywords"))
+   (cons "excerpt" (message-fetch-field "Summary"))
    (when (message-fetch-field "In-Reply-To")
              (cons "trackbacks"
                    (or (message-tokenize-header
------ END DIFF------

This works quite nicely for my with Emacs 23.1 and Wordpress, since I don't care too much about categories (I just use tags and don't bother with categories).

I now see that you have put out a new version, and are using "Summary" for tags and "Keywords" for categories (and nothing for excerpts). I'm debating whether to stick with my patched version or try to stick with the developed version. What am I missing by sticking with 1.4.4?

Also, when using C-c C-n or C-c C-p to go through my messages, it seemed to "unpublish" them by turning them into drafts. Is there a way around this, or am I doing something wrong?



_______________________________________________
Emacsweblogs mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacsweblogs
Reply | Threaded
Open this post in threaded view
|

Re: Added Wordpress tags and excerpt to weblogger 1.4.4

Mark A. Hershberger
Aaron Hammitt <[hidden email]> writes:

> I am new to this list and new to weblogger.el. I've used Emacs for a while
> but am just learning elisp. Anyway, I was a little annoyed by the lack
> of support for tags and excerpts.

Thanks for the input!

> I now see that you have put out a new version, and are using "Summary" for
> tags and "Keywords" for categories (and nothing for excerpts). I'm debating
> whether to stick with my patched version or try to stick with the developed
> version. What am I missing by sticking with 1.4.4?

Well, I'm planning to do more work on it, so you'll have to continuously
merge your changes into it.

When it comes to these particular fields, different weblogging engines
operate slightly differently.

I've been planning for some time to rationalize the behavior across
engines on the client.  Now that interest has “spiked” (compared to any
other time in the past few years), it is probably time to start on the
project.

> Also, when using C-c C-n or C-c C-p to go through my messages, it seemed to
> "unpublish" them by turning them into drafts. Is there a way around this, or
> am I doing something wrong?

That's a bug.  Could you report it here:
https://savannah.nongnu.org/bugs/?group=emacsweblogs

Thanks,

Mark.

--
http://hexmode.com/

The world is a dangerous place, not because of those who do evil, but
because of those who look on and do nothing.
                                            — Albert Einstein


_______________________________________________
Emacsweblogs mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacsweblogs