Contributions


Charles Curley

Charles Curley sent some functions (below) and this documentation on the workings of the templates (see tempo.el for more). Straight for his Emacs Lisp comments:


;; On prompts... Charles Curley (http://w3.trib.com/~ccurley/): It took
;; some time to figure this out... The (p "prompt: ") and (r "prompt:
;; ") entries indicate where the prompting mode should prompt for a
;; field in the tag. (p ) indicates a parameter, such as the color of a
;; <font> tag. (r ) indicates a region, where the text to be surrounded
;; by the tag should go, such as the text to be turned that color. The
;; difference is this: when prompting mode is turned off and the user
;; is surrounding a region with the tag, the (r ) (region) parameter
;; indicates where the surrounded region will go. The first (p )
;; (parameter) is where the cursor will go, ready to input the first
;; parameter to the tag.

;; So when you have prompting on, and use the font with color and size
;; tag, put the cursor where you want the modified text to go. Start
;; inserting the tag. You will be prompted for the color, the size, and
;; then the text to display that way. When you have prompting turned
;; off, and don't have a region blocked, insert the font tag, and the
;; cursor will be at the the first parameter. Then tab over to the
;; space between the two parts of the tag, and type in your text. If
;; you have region blocked, C-u followed by the tag will surround the
;; region with the tag. The blocked region goes into the (r )
;; parameter. Then the cursor is placed at the first (p ) location,
;; ready for you to type in a parameter, such as the color of the text.

Here are a couple of function you could add to your .emacs (non standard insert-date is supplied in ccurley.el.gz):

;;; A macro to add a link to the top of the page:
;;; <em>Up to the <a href="#top">Top of the Page</a></em><p>

(defun to-top ()
  "add a link to the top of the page: \"<em>Up to the <a href=\"#top\">Top of the Page</a></em><p>\\n\" It assumes you have already established the anchor for the link."
  (interactive "*")
  (insert "<em>Up to the <a href=\"#top\">Top of the Page</a></em><p>\n")
  )

;;; Given a hyperlink already in the ring buffer, and a region defined,
;;; makes the given region into a hyperlink pointing to the location in
;;; the ring buffer.

(fset 'link
   "\C-u\C-c\C-al#\C-y")

;; Add a $(new) entry to a web page.
(defun addnew ()
  "Insert the text for a \"new\" splat. Use kill-new-splat to remove it when it has aged enough."
  (interactive "*")
  (insert ".- ")
  (let ((time (current-time-string)))
    (insert (substring time -4)))
  (insert "z$(bullet)\n$(new) "))

;;; kill of the $(new) macro installed above when it has expired
(fset 'kill-new-splat
   [?\C-a ?\M-z ?z down ?\M-z ?) ?\M-^])

And last, how you can customize the default contents for new HTML documents:

(setq html-helper-new-buffer-template
  '(html-helper-htmldtd-version
    "<html> <head>\n"
    "<title>" p "</title>\n</head>\n\n"
    "<body bgcolor=\"\#ffffe0\"><a name=\"top\">&nbsp;</a>\n"
    "<h1 align=center>" p "</h1>\n\n"
    "<em>Up to <a href=\"index.html\">Charles Curley's Home Page</a></em>"
    "<hr>"
    p
    "\n\n\n\n<hr>\n"
    "<em>Up to <a href=\"index.html\">Charles Curley's Home Page</a></em><p>\n"
    "<em>Up to the <a href=\"\#top\">Top of the Page</a></em>\n"
    "<hr>\n"

    "<address>For <a name=\"Questions&amp;Comments\">Question and Comments</A>
about our web site, please write our Speaker to Web Pages, \n"
    html-helper-address-string ".</address>\n<br>\n"

"Copyright &#169; 1999 through the date of last modification by Charles Curley. Various trademarks are the property of their owners.<br>\n"

    html-helper-timestamp-start
    html-helper-timestamp-end
    "\n</body> </html>\n")
  "*Template for new buffers.
Inserted by `html-helper-insert-new-buffer-strings' if
`html-helper-build-new-buffer' is set to t")

Download .emacs (_emacs for w32) snippet ready to use (gzipped)


Back to html-helper-mode page Last modified: Mon Oct 25 15:20:52 Ora legale Europa occidentale 1999

                     Made in  LINUX 2.0