emacs-muse.el

 

(require 'muse-mode) ; load authoring mode (require 'muse-html) ; load publishing styles I use (require 'muse-latex) (require 'muse-texinfo) (require 'muse-docbook) (require 'muse-project) ; publish files in projects (setq muse-project-alist '(("website" ("~/Wiki" :default "index") (:base "html" :path "~/Wiki/public_html") (:base "pdf" :path "~/Wiki/public_html/pdf")))) (muse-derive-style "ut" "html" :header 'ut-html-header :style-sheet 'ut-style-sheet) (setq ut-html-header "<!DOCTYPE HTML PUBLIC /"-//W3C//DTD HTML 4.0 Transitional//EN/"> <html> <head> <title><lisp> (concat (muse-publishing-directive /"title/") (let ((author (muse-publishing-directive /"author/"))) (if (not (string= author (user-full-name))) (concat /" (by /" author /")/")))) </lisp></title> <meta name=/"generator/" content=/"muse.el/"> <meta http-equiv=/"<lisp>muse-html-meta-http-equiv</lisp>/" content=/"<lisp>muse-html-meta-content-type</lisp>/"> <lisp> (let ((maintainer (muse-style-element :maintainer))) (when maintainer (concat /"<link rev=///"made///" href="///" mce_href="///""/" maintainer /"///">/"))) </lisp> <lisp>(muse-style-element :style-sheet muse-publishing-current-style) </lisp> </head> <body> <h1><lisp>(muse-publishing-directive /"title/")</lisp></h1> <p><big><em><lisp>(let ((author (muse-publishing-directive /"author/"))) (if (not (string= author (user-full-name))) (concat /"by /" author )))</lisp></em></big></p> <p><big><em><lisp>(let ((date (muse-publishing-directive /"date/"))) (concat /"Last Modified: /" date ))</lisp></em></big></p> <h2><lisp>(let ((package (muse-publishing-directive /"package/"))) (concat /"Test script Package —/; /" package )) </lisp> </h2> <table class=/"muse-table/" border=/"2/" cellpadding=/"5/"> <tbody><tr><td><span class=/"pass/">PASS</span></td> <td>Passed all test</td></tr><tr><td><span class=/"fail/">FAIL</span></td> <td>Failed for new issue</td></tr><tr><td><span class=/"attempt/">ATTEMPTED</span></td> <td>Tried but there is known issue</td></tr> <tr><td><span class=/"nattempt/">NOT ATTEMPTED</span></td> <td>Not tried</td></tr></tbody></table> <!-- Page published by Emacs Muse begins here -->/n") (setq ut-style-sheet "<mce:style type=/"text/css/"><!-- body { FONT: 14px/1.4 'Trebuchet MS',Verdana, Arial, Helvetica, sans-serif; background:#fff; width: 60em; margin: 0 auto 0; padding: 2em 0 6em 0; text-align: left; } a { font-family: Verdana; text-decoration:none; font-weight:bold; color:#c00; } a:hover { background:#000000; color:#FFFFFF; } h1 a { color:#666;} h2 a { color:#666;} h3 a { color:#666;} h4 a { color:#666;} h1 { font-size: 40px; color:#666; border-bottom: 5px solid #000; padding: 2px; margin: 0px; margin-bottom: 8px; } h2 { color:#666; font-size: 22px; padding: 2px; margin-top: 15px; border-bottom: 2px solid #000000; } h3 { color:#666; font-size: 18px; padding: 2px; margin-top: 5px; } h4 { color:#666; font-size: 18px; padding: 2px; margin-top: 5px; } img { float: right; margin: 10px; border-style:solid; border-width:2px; } #im { clear: right;} pre { border: #777777 1px solid; padding: 0.5em; margin-left: 1em; margin-right: 2em; white-space: pre; background-color: #e6e6e6; color: black; } .pass { color:Green; } .fail { color:Red; font-weight: bold; } .attempt { color:Maroon; font-weight: bold; } .nattempt { color:Silver; } .verse { white-space: pre; margin-left: 1em; } dt { font-weight: bold;} li { margin-bottom: 0.9ex;} blockquote { margin-left: 2em; color: #4444ff; } td { font-size: 13px;} th { background: #d6d6d6; font-size: 14px; } --></mce:style><style type=/"text/css/" mce_bogus="1">body { FONT: 14px/1.4 'Trebuchet MS',Verdana, Arial, Helvetica, sans-serif; background:#fff; width: 60em; margin: 0 auto 0; padding: 2em 0 6em 0; text-align: left; } a { font-family: Verdana; text-decoration:none; font-weight:bold; color:#c00; } a:hover { background:#000000; color:#FFFFFF; } h1 a { color:#666;} h2 a { color:#666;} h3 a { color:#666;} h4 a { color:#666;} h1 { font-size: 40px; color:#666; border-bottom: 5px solid #000; padding: 2px; margin: 0px; margin-bottom: 8px; } h2 { color:#666; font-size: 22px; padding: 2px; margin-top: 15px; border-bottom: 2px solid #000000; } h3 { color:#666; font-size: 18px; padding: 2px; margin-top: 5px; } h4 { color:#666; font-size: 18px; padding: 2px; margin-top: 5px; } img { float: right; margin: 10px; border-style:solid; border-width:2px; } #im { clear: right;} pre { border: #777777 1px solid; padding: 0.5em; margin-left: 1em; margin-right: 2em; white-space: pre; background-color: #e6e6e6; color: black; } .pass { color:Green; } .fail { color:Red; font-weight: bold; } .attempt { color:Maroon; font-weight: bold; } .nattempt { color:Silver; } .verse { white-space: pre; margin-left: 1em; } dt { font-weight: bold;} li { margin-bottom: 0.9ex;} blockquote { margin-left: 2em; color: #4444ff; } td { font-size: 13px;} th { background: #d6d6d6; font-size: 14px; } </style>") (defvar muse-pass-tag '("pass" t nil nil muse-ut-pass-tag)) (defun muse-ut-pass-tag (beg end) (delete-region beg end) (goto-char beg) (muse-insert-markup "<span class=/"pass/">PASS</span>")) (defvar muse-fail-tag '("fail" t nil nil muse-ut-fail-tag)) (defun muse-ut-fail-tag (beg end) (delete-region beg end) (goto-char beg) (muse-insert-markup "<span class=/"fail/">FAIL</span>")) (defvar muse-attempt-tag '("attempt" t nil nil muse-ut-attempt-tag)) (defun muse-ut-attempt-tag (beg end) (delete-region beg end) (goto-char beg) (muse-insert-markup "<span class=/"attempt/">ATTEMPTED</span>")) (defvar muse-nattempt-tag '("nattempt" t nil nil muse-ut-nattempt-tag)) (defun muse-ut-nattempt-tag (beg end) (delete-region beg end) (goto-char beg) (muse-insert-markup "<span class=/"nattempt/">NOT ATTEMPTED</span>")) (defvar muse-result-tag '("result" t t nil muse-ut-result-tag)) (defun muse-ut-result-tag (beg end attrs) "Insert unit test result <result> ... </result>." (muse-publish-markup-attribute beg end attrs nil (save-excursion (save-restriction (setq passed 0) (setq failed 0) (setq attempted 0) (setq nattempted 0) (goto-char (point-min)) (while (re-search-forward "<pass/>" nil t) (setq passed (1+ passed))) (goto-char (point-min)) (while (re-search-forward "<fail/>" nil t) (setq failed (1+ failed))) (goto-char (point-min)) (while (re-search-forward "<attempt/>" nil t) (setq attempted (1+ attempted))) (goto-char (point-min)) (while (re-search-forward "<nattempt/>" nil t) (setq nattempted (1+ nattempted))) (goto-char (point-min)) (setq count (+ passed failed attempted nattempted)) (goto-char (point-min)) (muse-insert-markup (concat "<h3>Result:</h3><p><strong><em>" "Totally " (number-to-string count) " cases," (number-to-string passed) " passed, " (number-to-string failed) " failed, " (number-to-string attempted) " attempted, " (number-to-string nattempted) " not attempted." "</em></strong></p>")) )))) (add-to-list 'muse-publish-markup-tags muse-result-tag) (add-to-list 'muse-publish-markup-tags muse-pass-tag) (add-to-list 'muse-publish-markup-tags muse-fail-tag) (add-to-list 'muse-publish-markup-tags muse-attempt-tag) (add-to-list 'muse-publish-markup-tags muse-nattempt-tag) 

 

你可能感兴趣的:(emacs-muse.el)