Skip to content
Browse files

more fixes from checkdoc

  • Loading branch information...
1 parent aec02e1 commit 246a559ebf880a95e1ed1793bf13dd6195873eb4 @metaperl committed
Showing with 101 additions and 92 deletions.
  1. +101 −92 asciidoc.el
View
193 asciidoc.el
@@ -4,7 +4,7 @@
;; Author: Terrence Brannon <bauhaus@metaperl.com>
;; Created: 21 Sept 2007
-;; Version: 0.1
+;; Version: 0.2
;; Keywords: text-formatting
;; This file is not (yet) part of GNU Emacs.
@@ -25,8 +25,9 @@
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
-;;; Description:
+;;; Commentary:
+;;
;; Suggested add-ons:
;; doc-mode: font-locking for asciidoc buffers
@@ -40,33 +41,36 @@
;; (require 'asciidoc)))
;; Author extends thanks to:
-;; Steve Youngs (JackaLX on irc://irc.freenode.net/xemacs)
+;; Steve Youngs (JackaLX on irc://irc.freenode.net/xemacs)
;; bpalmer, twb
+;; jari aalto for turning me on the M-x checkdoc-current-buffer, etc
;; Version control:
-;; This software is under Mercurial version control and maybe retrieved via:
-;; hg clone http://hg.metaperl.com/asciidoc-el
+;; This software is under git version control and maybe retrieved at:
+;; https://github.com/metaperl/asciidoc-el
-;; Code:
+;;; Code:
(setq debug-on-error t)
+
+
(require 'easymenu)
(require 'cl)
(require 'apropos)
-(defvar *asciidoc-indent-level* 2 "Number of spaces to indent per level")
+(defvar *asciidoc-indent-level* 2 "Number of spaces to indent per level.")
-(defvar *delimiter-length* 70
- "How many characters to use when building a delimited block string. 4 min")
+(defvar *delimiter-length* 70
+ "How many characters to use when building a delimited block string. 4 min.")
(defun asciidoc-header (title author revision)
- "Insert asciidoc header consisting of TITLE and optional AUTHOR and REVISION"
+ "Insert asciidoc header consisting of TITLE and optional AUTHOR and REVISION."
(interactive "sHeader title: \nsHeader author (return if none): \nsHeader revision (return if none):")
- (insert
- (concat title "\n"
+ (insert
+ (concat title "\n"
(make-string (length title) ?=) "\n"
author "\n"
revision "\n"
@@ -74,185 +78,186 @@
)))
(defun asciidoc-get-started ()
+ "Start the document."
(interactive)
(let ((date (format-time-string "%D" (current-time))))
- (asciidoc-header "Document Title"
- "Terrence Brannon <bauhaus@metaperl.com>"
+ (asciidoc-header "Document Title"
+ "Terrence Brannon <bauhaus@metaperl.com>"
date)))
(defun asciidoc-emphasized (text)
- "Insert text with asciidoc emphasis formatting"
+ "Insert TEXT with asciidoc emphasis formatting."
(interactive "sText to be emphasized: ")
- (insert
+ (insert
(concat "_" text "_")))
(defun asciidoc-strong (text)
- "Insert text with asciidoc strong formatting"
+ "Insert TEXT with asciidoc strong formatting."
(interactive "sText to be strong-formatted: ")
- (insert
+ (insert
(concat "*" text "*")))
(defun asciidoc-monospace (text)
- "Insert text with asciidoc monospace formatting"
+ "Insert TEXT with asciidoc monospace formatting."
(interactive "sText to be monospace formatted: ")
- (insert
+ (insert
(concat "`" text "`")))
(defun asciidoc-quoted (text)
- "Insert text with asciidoc quoted-text formatting"
+ "Insert TEXT with asciidoc quoted-text formatting."
(interactive "sText to be enclosed in quotation marks: ")
- (insert
+ (insert
(concat "``" text "''")))
(defun asciidoc-unquoted (text)
- "Insert text with asciidoc unquoted text formatting"
+ "Insert TEXT with asciidoc unquoted text formatting."
(interactive "sText to be non-quoted: ")
- (insert
+ (insert
(concat "#" text "#")))
(defun asciidoc-passthru-triple-plus (text)
- "Insert text with asciidoc triple plus passthrough formatting"
+ "Insert TEXT with asciidoc triple plus passthrough formatting."
(interactive "sText to be formatted for no change: ")
- (insert
+ (insert
(concat "+++" text "+++")))
(defun asciidoc-passthru-double-dollar (text)
- "Insert text with asciidoc double-dollar formatting"
+ "Insert TEXT with asciidoc double-dollar formatting."
(interactive "sText to be formatted for no change except escaping special characters: ")
- (insert
+ (insert
(concat "$$" text "$$")))
(defun asciidoc-passthru-double-dollar (text)
- "Insert text with asciidoc double-dollar formatting"
+ "Insert TEXT with asciidoc double-dollar formatting."
(interactive "sText to be formatted for no change except escaping special characters: ")
- (insert
+ (insert
(concat "$$" text "$$")))
(defun asciidoc-superscript (text)
- "Insert text with asciidoc superscript formatting"
+ "Insert TEXT with asciidoc superscript formatting."
(interactive "sText to be formatted for superscripting: ")
- (insert
+ (insert
(concat "^" text "^")))
(defun asciidoc-subscript (text)
- "Insert text with asciidoc subscript formatting"
+ "Insert TEXT with asciidoc subscript formatting."
(interactive "sText to be formatted for subscripting: ")
- (insert
+ (insert
(concat "~" text "~")))
(defun asciidoc-line-break ()
- "Insert asciidoc forced line break"
+ "Insert asciidoc forced line break."
(interactive)
- (insert
+ (insert
(concat " +\n")))
(defun asciidoc-horizontal-rule ()
- "Insert asciidoc <hr /> tag for HTML only"
+ "Insert asciidoc <hr /> tag for HTML only."
(interactive)
- (insert
+ (insert
(concat "'''\n")))
(defun asciidoc-copyright ()
- "Insert asciidoc copyright replacement"
+ "Insert asciidoc copyright replacement."
(interactive)
(insert "(C) "))
(defun asciidoc-trademark ()
- "Insert asciidoc copyright replacement"
+ "Insert asciidoc copyright replacement."
(interactive)
(insert "(TM) "))
(defun asciidoc-registered-trademark ()
- "Insert asciidoc registered copyright replacement"
+ "Insert asciidoc registered copyright replacement."
(interactive)
(insert "(R) "))
(defun asciidoc-section-title (section-level title)
- "Insert asciidoc one-line title syntax"
+ "Insert asciidoc one-line title syntax consisting of SECTION-LEVEL number of asterisks and TITLE text."
(interactive "NNumber of equals signs (2-4): \nsSection title: ")
; " " equals-signs
(let ((equals-signs (make-string (1+ section-level) ?=)))
- (insert
- (concat
+ (insert
+ (concat
"\n"
equals-signs " " title
"\n\n"))))
(defun asciidoc-block-title (text)
- "Insert text with asciidoc block title formatting"
+ "Insert TEXT with asciidoc block title formatting."
(interactive "sText to be formatted as block title: ")
- (insert
+ (insert
(concat "." text "\n")))
(defun asciidoc-block-id-element (text)
- "Insert text with asciidoc BlockId Element formatting"
+ "Insert TEXT with asciidoc BlockId Element formatting."
(interactive "sText to be formatted as block-id: ")
- (insert
+ (insert
(concat "[[" text "]]" "\n")))
(defun asciidoc-block-reference (block-id descriptive-text)
- "Insert asciidoc reference to a block consisting of BLOCK-ID and DESCRIPTIVE-TEXT"
+ "Insert asciidoc reference to a block consisting of BLOCK-ID and DESCRIPTIVE-TEXT."
(interactive "sBlockId: \nsDescriptive text: ")
- (insert
+ (insert
(concat "<<" block-id "," descriptive-text ">>"
)))
(defun asciidoc-verse-paragraph (text)
- "Insert verse paragraph formatting"
+ "Insert TEXT with verse paragraph formatting."
(interactive)
(insert (concat "[verse]" "\n")))
(defun asciidoc-literal-paragraph (text)
- "Insert literal paragraph formatting"
+ "Insert TEXT with literal paragraph formatting."
(interactive)
(insert (concat " " "\n")))
(defun asciidoc-admonition-paragraph (text)
- "Insert admonition paragraph formatting"
+ "Insert TEXT with admonition paragraph formatting."
(interactive)
(insert (concat "[NOTE]" "\n")))
(defun asciidoc-delimited-block (delimiter text)
- ""
+ "Make a string consisting of DELIMITER and TEXT."
(let ((str (make-string *delimiter-length* delimiter)))
(insert (concat str "\n" text "\n" str "\n\n"))))
(defun asciidoc-comment-block (text)
- "create an asciidoc CommentBlock"
+ "Create an asciidoc CommentBlock consisting of TEXT."
(interactive "sText for comment block? ")
(asciidoc-delimited-block ?/ text))
(defun asciidoc-passthru-block (text)
- "create an asciidoc PassthroughBlock"
+ "Create an asciidoc PassthroughBlock consisting of TEXT."
(interactive "sText for passthru block? ")
(asciidoc-delimited-block ?+ text))
(defun asciidoc-listing-block (text)
- "create an asciidoc ListingBlock"
+ "Create an asciidoc ListingBlock consisting of TEXT."
(interactive "sText for listing block? ")
(asciidoc-delimited-block ?- text))
(defun asciidoc-literal-block (text)
- "create an asciidoc LiteralBlock"
+ "Create an asciidoc LiteralBlock consisting of TEXT."
(interactive "sText for literal block? ")
(asciidoc-delimited-block ?. text))
(defun asciidoc-sidebar-block (text)
- "create an asciidoc SidebarBlock"
+ "Create an asciidoc SidebarBlock consisting of TEXT."
(interactive "sText for sidebar block? ")
(asciidoc-delimited-block ?* text))
(defun asciidoc-example-block (text)
- "create an asciidoc ExampleBlock, using TEXT and optionally modifying the default EXAMPLE-LABEL and EXAMPLE-DESCRIPTION"
+ "Create an asciidoc ExampleBlock, using TEXT and optionally modifying the default EXAMPLE-LABEL and EXAMPLE-DESCRIPTION."
(interactive "sText for example block? ")
(let ((example-label (read-string "Example label? (it needs a space at the end) " "Example: "))
(example-description (read-string "Example description? " "An example")))
@@ -263,7 +268,7 @@
(asciidoc-delimited-block ?= text)))
(defun asciidoc-quotation-block (text author source)
- "create an asciidoc QuoteBlock"
+ "Given TEXT, AUTHOR, and SOURCE, create an asciidoc QuoteBlock."
(interactive "sText of quotation? \nsAuthor of quotation? \nsWhere did this quotation come from? ")
(insert
(concat "["
@@ -276,83 +281,84 @@
(defun asciidoc-compile ()
+ "Create an asciidoc document."
(interactive)
- (setq compile-command
- (concat
+ (setq compile-command
+ (concat
"asciidoc -a numbered -a toc -a toclevels=4" " "
(file-name-nondirectory (buffer-file-name))
))
(call-interactively 'compile))
-(defvar *asciidoc-bullet* '("-" "*")
- "strings representing each of the two bullet levels offered by Asciidoc")
+(defvar *asciidoc-bullet* '("-" "*")
+ "Strings representing each of the two bullet levels offered by Asciidoc.")
(defun asciidoc-bullet-item (bullet-level text)
- "At BULLET_LEVEL, insert TEXT"
+ "At BULLET-LEVEL (1 or 2), insert TEXT."
(interactive "NBullet level (1 or 2): \nsText for bullet: ")
(let* ((level (if (= bullet-level 2) 1 0))
(bullet (nth level *asciidoc-bullet*))
(tab-space (make-string (* level 4) ?\s)))
- (insert
- (concat
+ (insert
+ (concat
tab-space bullet " " text "\n"))))
(defun asciidoc-numbered-list-item (item-level text)
- "At ITEM-LEVEL, insert TEXT"
+ "At ITEM-LEVEL, insert TEXT."
(interactive "NItem level (1 or 2): \nsText for bullet: ")
(let* ((level (if (= item-level 2) 2 1))
(bullet (make-string level ?.))
(tab-space (make-string (* (- level 1) 4) ?\s)))
- (insert
- (concat
+ (insert
+ (concat
tab-space bullet " " text "\n"))))
(defun asciidoc-labelled-list-item (text)
- "Insert TEXT"
+ "Insert TEXT."
(interactive "sLabel for list item: ")
- (insert
- (concat
+ (insert
+ (concat
text "::" "\n ")))
(defun asciidoc-bibliography-item (ref-label ref-text)
- "Insert bibliography item consisting of REF-LABEL and REF-TEXT"
+ "Insert bibliography item consisting of REF-LABEL and REF-TEXT."
(interactive "sLabel for bib item: \nsText of bibitem: ")
- (insert
- (concat
+ (insert
+ (concat
"+" " " "[[[" ref-label "]]]" " " ref-text "\n")))
(defun asciidoc-href (url link-text)
- "Insert hyperlink consisting of URL and LINK-TEXT"
+ "Insert hyperlink consisting of URL and LINK-TEXT."
(interactive "sURL: \nsText describing URL: ")
- (insert
- (concat
- url "[" link-text "]" "\n"
+ (insert
+ (concat
+ url "[" link-text "]" "\n"
)))
(defun asciidoc-relative-href (url link-text)
- "Insert hyperlink consisting of URL and LINK-TEXT"
+ "Insert hyperlink consisting of URL and LINK-TEXT."
(interactive "sRelative path to file (anchors allowed): \nsText describing link: ")
- (insert
- (concat
+ (insert
+ (concat
"link:"
- url "[" link-text "]" "\n"
+ url "[" link-text "]" "\n"
)))
(defun asciidoc-image-href (url link-text)
- "Insert hyperlink consisting of URL and LINK-TEXT"
+ "Insert hyperlink consisting of URL and LINK-TEXT."
(interactive "sURL to image file: \nsText describing image (only displayed when image unavailable): ")
- (insert
- (concat
+ (insert
+ (concat
"image:"
- url "[" "\"" link-text "\"" "]" "\n"
+ url "[" "\"" link-text "\"" "]" "\n"
)))
(let ((s "admonition-paragraph"))
(split-string s "asciidoc"))
-(setq asciidoc-global-menuspec
+(setq asciidoc-global-menuspec
(list "Doc"
(list
"Links and refs"
@@ -406,7 +412,10 @@
))
-(easy-menu-define
+(easy-menu-define
asciidoc-global-menu global-map "" asciidoc-global-menuspec)
-(provide 'asciidoc)
+(provide 'asciidoc)
+(provide 'asciidoc)
+
+;;; asciidoc.el ends here

0 comments on commit 246a559

Please sign in to comment.
Something went wrong with that request. Please try again.