Commits

Gabriele Lanaro  committed fb1fc21

implemented add tag functionality

  • Participants
  • Parent commits b9b346e

Comments (0)

Files changed (2)

File blogger-mode.el

 (defface blogger-tags
   '((t (:inherit font-lock-variable-name-face))) "Face for displaying tags")
 
-
 (defun blogger-post ()
   "Generic function to upload a post in blogger, it determines
 the current major mode and do exporting in various forms"
     )
   )
 
+(defun blogger-tag ()
+  "Tag post under cursor"
+  (interactive)
+  ;; Getting the post-id
+  (let (post-id taglist)
+    (setq post-id (get-text-property (point) 'entry-id))
+    
+    (blogger-bridge-tag-post
+     post-id  
+     (split-string (read-from-minibuffer "Insert tags separated by commas: ") ","))
+
+    (blogger-bridge-refresh)
+    (blogger-update-view)
+    )
+  )
 (defun blogger-rename-post ()
   "rename post under the cursor"
   (when (get-text-property (point) 'post-id)
   (define-key map "d" 'blogger-delete)
   (define-key map "g" 'blogger-update-view)
   (define-key map "q" 'blogger-quit)
+  (define-key map "t" 'blogger-tag)
   (setq blogger-mode-map map))
 
 

File blogger_bridge.py

         return entry.id
     
     def update_post(self, post_id, title=None, content=None):
-        blog = self.get_a_blog()
+        blog = self.blog
         blog.update_post(post_id, title, content)
     
     def delete_post(self, post_id, blog_id = None):
-        blog = self.get_a_blog(blog_id)
+        blog = self.blog
         blog.delete_post(post_id)
 
     def upload_image(self, filename):
         c.login(username, password)
         
         return c.add_photo(os.path.expanduser(filename))
-
-    def get_post_tags(self):
-        return 
+    def tag_post(self, post_id, tags):
+        blog = self.blog
+        blog.add_tags(str(post_id), tags)
 li = LispInteractive()
 
 # Exposing functions
                            filters.remove_space_between_tags)
 delete_post = li.delete_post
 update_post = li.update_post
-get_post_tags = li.get_post_tags
+tag_post = li.tag_post
+
 upload_image = li.upload_image
 
 # Interactive functions