;; lj.el --- LiveJournal meets SXEmacs -*- Emacs-Lisp -*-
-;; Copyright (C) 2008, 2009 Steve Youngs
+;; Copyright (C) 2008 - 2011 Steve Youngs
;; Author: Steve Youngs <steve@sxemacs.org>
;; Maintainer: Steve Youngs <steve@sxemacs.org>
;; Created: <2008-06-15>
;; Based On: jwz-lj.el by Jamie Zawinski <jwz@jwz.org>
;; Keywords: blog, lj, livejournal
-;; Homepage: <http://www.sxemacs.org/~steve/lj/lj.el>
+;; Homepage: <http://www.sxemacs.org/lj.el>
;; This file is part of SLH (Steve's Lisp Hacks).
;; certain. As for GNU/Emacs... absolutely no idea, but I'd doubt
;; that this is anywhere near compatible.
;;
-;;; History:
-;;
-;; See the tla logs
-;;
;;; Version:
-(defconst lj-version 1.25
+(defconst lj-version 1.26
"Version number of SXEmacs/LJ.")
;;; Code:
(interactive)
(customize-group "lj"))
+(defcustom lj-self-promote t
+ "When non-nil, a \"Posted via...\" byline is added to a post.
+
+The text is a single line in small print (8pt) right justified at the
+very end of your post. It should be quite inconspicuous, but you are
+welcome to turn this off if you are too bashful to let the world know
+what software you use."
+ :type 'boolean
+ :group 'lj)
+
(defcustom lj-user-id (user-login-name)
"*Your LJ user ID."
:type 'string
:group 'lj)
+(defcustom lj-signature nil
+ "A signature to add to the bottom of a post.
+
+This is analogous to an email signature. Set this any HTML marked up
+text you like, or something that returns such. Remember to use valid
+XHTML 1.0 Transitional if you plan to validate before posting."
+ :type 'sexp
+ :group 'lj)
+
(defcustom lj-cookie-flavour 'auto
"*The default cookie flavour \(browser\) to search for cookies."
:type '(choice
(set-extent-property
(insert-face "</head>\n" 'default) 'invisible t)
(insert lj-header-separator "\n")
+ (when lj-signature
+ (save-excursion (insert "\n\n" lj-signature)))
(lj-mode))
(defun lj-goto-subject (&optional nocreate)
nil t)
(replace-match "<h3>Writer's Block Answer</h3>" t))))
+(defconst lj-byline
+ (format (concat "<br />"
+ "<p style=\"text-align:right;font-family:verdana,"
+ "helvetica,sans-serif;font-size:8pt;\">"
+ "Posted via: <a href=\"http://www.sxemacs.org/lj.el\""
+ " title=\"Download SXEmacs/LJ\">"
+ "SXEmacs/LJ</a> (%s)</p>")
+ lj-clientversion)
+ "A client by-line to add to bottom of a post.
+
+It is also included when validating or previewing a post.")
+
(defun lj-validate ()
"Check the markup in a LJ post.
(save-restriction
(narrow-to-region (point) (point-max))
(buffer-string))))
+ (and lj-self-promote
+ (insert lj-byline))
(insert lj-validate-footer)
(lj-ljtags-to-html)
(write-region (point-min) (point-max) vf))
(save-restriction
(narrow-to-region (point) (point-max))
(buffer-string))))
+ (and lj-self-promote
+ (insert lj-byline))
(insert "\n</div>")
(insert lj-validate-footer)
(lj-ljtags-to-html)
(run-hooks 'lj-before-post-hook)
(let ((subject (lj-header-content "subject"))
(body (and (lj-goto-body)
- (buffer-substring-no-properties (point) (point-max))))
+ (if lj-self-promote
+ (concat
+ (buffer-substring-no-properties (point) (point-max))
+ lj-byline)
+ (buffer-substring-no-properties (point) (point-max)))))
(user lj-user-id)
(security (lj-header-content "security"))
(tags (lj-header-content "tags"))