From d898031cc105be2686d2e52219048184464dced9 Mon Sep 17 00:00:00 2001 From: Frank Duncan Date: Sun, 29 May 2016 22:44:14 -0500 Subject: [PATCH] Remove need for ARGUMENTS AND VALUES when there are none --- README.md | 2 +- resources/success1.lisp | 13 ++++++++++++- resources/success1.md | 13 +++++++++++++ src/main/docgen.asd | 2 +- src/main/func.lisp | 10 +++++++--- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 43f0db2..3d1ce91 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Enforcement of documentation guidelines for my Common Lisp Projects, as well as I wish I had aspirations for this being some standard that someone else might follow, but realistically I'm just irritated at my own laziness with regard to documentation, so I wrote a solution. The forceful nature of the validator is really just because I didn't want to write a smarter parser. As an added bonus, all the docs now look the same when I look at them in the repl, so that's kind of nice. -If you like, you can [download it](https://github.com/frankduncan/docgen/releases/download/0.2/docgen_0.2.tar.gz) +If you like, you can [download it](https://github.com/frankduncan/docgen/releases/download/0.3/docgen_0.3.tar.gz) ## Usage diff --git a/resources/success1.lisp b/resources/success1.lisp index 3e33e13..28d492d 100644 --- a/resources/success1.lisp +++ b/resources/success1.lisp @@ -7,7 +7,7 @@ to success1.md.") (:export #:*special-variable* #:test-condition - #:func-that-does-stuff #:noargs #:result-list #:has-no-examples + #:func-that-does-stuff #:noargs #:no-args-and-values #:result-list #:has-no-examples #:values-result #:has-optional #:has-keywords #:has-rest)) (in-package #:success1) @@ -108,6 +108,17 @@ EXAMPLES: (func-that-does-stuff) => (:failure \"path/to/error.lisp\" \"Error msg\" 20 0)" nil) +(defun no-args-and-values () + "NO-ARGS-AND-VALUES => RESULT + + RESULT: :nothing + +DESCRIPTION: + + RESULT-LIST runs all the things against a file and returns + as soon as the first func error is found." + nil) + (defun has-no-examples () "HAS-NO-EXAMPLES => RESULT diff --git a/resources/success1.md b/resources/success1.md index 80c3c1c..3c4b4f8 100644 --- a/resources/success1.md +++ b/resources/success1.md @@ -12,6 +12,7 @@ This is should all get pulled in and the markdown.md should be equal to success1 * **function [has-no-examples](#function-has-no-examples)** - _has-no-examples_ runs all the things against a file and returns as soon as the first func error is found. * **function [has-optional](#function-has-optional)** - _has-optional_ runs all the things against a file and returns as soon as the first func error is found. * **function [has-rest](#function-has-rest)** - _has-rest_ runs all the things against a file and returns as soon as the first func error is found. +* **function [no-args-and-values](#function-no-args-and-values)** - _result_-LIST runs all the things against a file and returns as soon as the first func error is found. * **function [noargs](#function-noargs)** - _noargs_ runs all the things against a file and returns as soon as the first func error is found. * **function [result-list](#function-result-list)** - _result-list_ runs all the things against a file and returns as soon as the first func error is found. * **condition [test-condition](#condition-test-condition)** - Simple documentation. @@ -153,6 +154,18 @@ _has-rest_ runs all the things against a file and returns as soon as the first f This second section uses _path_ and _x_ as something we should talk about, but doesn't use all the arguments (let's include _path_ here for fun) +## Function **NO-ARGS-AND-VALUES** + +#### Syntax: + +**no-args-and-values** => _result_ + +```result::= :nothing``` + +#### Description: + +_result_-LIST runs all the things against a file and returns as soon as the first func error is found. + ## Function **NOARGS** #### Syntax: diff --git a/src/main/docgen.asd b/src/main/docgen.asd index 3c63c45..9b0858b 100644 --- a/src/main/docgen.asd +++ b/src/main/docgen.asd @@ -1,6 +1,6 @@ (asdf:defsystem docgen :name "Documentation Generator" - :version "0.2" + :version "0.3" :maintainer "Frank Duncan (frank@kank.com)" :author "Frank Duncan (frank@kank.com)" :serial t diff --git a/src/main/func.lisp b/src/main/func.lisp index 68b05dc..45bd970 100644 --- a/src/main/func.lisp +++ b/src/main/func.lisp @@ -259,7 +259,7 @@ (append (when types (list types)) (list - (parse-arguments-and-values args-to-be-defined) + (when args-to-be-defined (parse-arguments-and-values args-to-be-defined)) (parse-description)) (when (more) (list (parse-examples))))))))) @@ -294,7 +294,8 @@ (case (car type) (:list (format nil "(~{~(~A~)~^ ~})" (mapcar #'cadr (cadr type)))) (:or (format nil "~{~(~A~)~^ | ~}" (mapcar #'cadr (cadr type)))) - (:asterisk (format nil "~(~A~)*" (cadr (car (cadr type)))))))) + (:asterisk (format nil "~(~A~)*" (cadr (car (cadr type))))) + (:symbol (format nil "~(~A~)" (cadr (car (cadr type)))))))) (if (not types) "" (format nil "~{~A~%~}~%" @@ -325,7 +326,10 @@ (format nil "~A~A~A~A~A" (format-header (get-section :function)) (format-types (get-section :types)) - (format-args-and-values (get-section :arguments-and-values)) + (if + (get-section :arguments-and-values) + (format-args-and-values (get-section :arguments-and-values)) + "") (format-description (get-section :description)) (format-examples (get-section :examples))))) -- 2.25.1