Commits

Gabriele Lanaro  committed 586a984

Added org support, needs testing

  • Participants
  • Parent commits fb1fc21

Comments (0)

Files changed (1)

File blogger-mode.el

 ;; Variables
-
 (defvar blogger-mode-map nil "Local keymap for dired-mode buffers.")
 (defvar blogger-username nil "Username used to log in")
 (defvar blogger-password nil "Password to log in")
 
 (defvar blogger-initialized nil "Check if the initialization procedure was successful")
 
-
 ;; Faces
 (defface blogger-date
   '((t (:inherit file-name-shadow))) "Face for date displaying")
   (case major-mode
     ('rst-mode        
      (blogger-process-rst))
+    ('org-mode
+     (blogger-process-org))
     )
   )
 
+(defun blogger-filter (filters)
+  "Filter the current buffer with the filters passed in"
+  (let (buffer-substring-filters)
+    (setq buffer-substring-filters filters)
+    (filter-buffer-substring (point-min) (point-max))))
+
 (defun blogger-process-rst ()
   "Filter the current buffer and return a string of the bloggerized post"
-  (let (buffer-substring-filters)
-    (setq buffer-substring-filters '(blogger-bridge-rst2blogger))
-    (filter-buffer-substring (point-min) (point-max))))
+  (blogger-filter '(blogger-bridge-rst2blogger))
+  )
 
+(defun blogger-process-org ()
+  "org-mode->pseudo html for blogger"
+  (save-excursion 
+  (org-export-region-as-html (point-min) (point-max) t 'string))
+  )
 
 ;; Mode Commands
 (defun blogger-show ()
   "Prompt the user for a blog with completion support"
   (setq blogger-default-blog-name 
 	(completing-read "Select a Blog (TAB for completion): " (blogger-bridge-get-blog-names))
-  )
-)
+  ))
 
 (defun blogger-set-blog (blog-name)
   "Set the blog specified by BLOG-NAME as the current edited blog"
   (use-local-map blogger-mode-map)
   (setq buffer-read-only t)  
   )
+