最近写了一个newlisp_armory库,用来实现一些newlisp自身不支持的操作。比如跨windows和ubuntu的目录拷贝功能等。

自己用的时候,发现没有API reference文档参考,很不方便。于是学习了如何用注释生成文档。

在Ubuntu环境下,首先要下载newlispdoc程序的源码:http://newlisp.org/syntax.cgi?code/newlispdoc.txt

将文件重命名为newlispdoc,添加执行权限,复制到/usr/bin目录下。

也可直接从我的github项目中获得:https://github.com/csfreebird/newlisp_armory.git

然后注意注释的写法,下面是个例子:

;; file.lsp

;; @module file
;; @description file module provides some file operations on both Ubuntu and Windows
;; @location file.lsp
;; @version 1.0
;; @author Dean Chen
;; @example
;; (let ((test-dir1 (append (real-path) file:file-seperator "a")) (test-dir2 (append (real-path) file:file-seperator "b")))
;; (make-dir test-dir1)
;; (make-dir test-dir2)
;; (if (directory? test-dir1)
;; (begin
;; (unless (catch (file:copy-folder test-dir1 test-dir2) 'result)
;; (println (append "catch error: " result))
;; (println "test copy-folder failed"))
;; (file:remove-folder test-dir1)
;; (file:remove-folder test-dir2))))
(context 'file) ;; @syntax (file:init)
;; @throw Throw error if environment variable NEWLISP_ARMORY_HOME does not exist or is invalid
;; @throw Throw error if OS is not Windows or UBuntu
;; @note init function will be called automatically when loading file.lsp module, don't call it manually
(define (init)
(unless (env "NEWLISP_ARMORY_HOME")
(throw-error "NEWLISP_ARMORY_HOME does not exist"))
(unless (file? (env "NEWLISP_ARMORY_HOME"))
(throw-error "NEWLISP_ARMORY_HOME points to a non-existing file"))
(unless (directory? (env "NEWLISP_ARMORY_HOME"))
(throw-error "NEWLISP_ARMORY_HOME points to a file instead of directory"))
(set 'file-folder (append (env "NEWLISP_ARMORY_HOME") "/codes/file"))
(if
(= ostype "Linux") (load (append file-folder "/file_ubuntu.lsp"))
(= ostype "Win32") (load (append file-folder "/file_win.lsp"))
(throw-error (append "file tool doesn't support this OS for now, ostype:" ostype))
))

现在运行命令产生doc:

newlispdoc file.lsp

由于我还有几个支持不同平台的文件,file_ubuntu.lsp和file.win.lsp,似乎newlispdoc没有这么智能。因此我将file_ubuntu.lsp的注释复制到file.lsp中,不复制源代码。

也能够生成。

下面的截图展示了我的doc:

点击链接后,进入详细页面:

newlisp 注释生成文档的更多相关文章

  1. 1.0 添加WEB API项目并按注释生成文档(多项目结构)

    1.新建ASP.NET 项目,模板选择如图 2.选择Web API,并选择不进行身份验证方式 成功后我们看到这个结果. 至于其它三种身份验证方式,不太适合我的使用.而且这种方式也可以在代码里去实现身份 ...

  2. Sphinx将python代码注释生成文档

    安装 使用pip进行安装: pip install sphinx 初始化 进入你代码所在的目录,输入: sphinx-quickstart 下图:PRD是代码所在目录,生成的文档保存目录设成doc  ...

  3. eoLinker 新功能发布,增加了识别代码注释自动生成文档功能

    产品地址:https://www.eolinker.com开源代码:https://www.eolinker.com/#/os/download在线生成代码注释工具:http://tool.eolin ...

  4. xcode 自动添加注释,生成文档

    一.自动生成注释代码        添加一个快捷键,生成 注释代码        ThisService 下载连接:http://wafflesoftware.net/thisservice/     ...

  5. eclipse中生成文档注释--javadoc的使用

    1.针对于单一的JAVA文件,在终端窗口中,使用 javadoc 文件名.java 即可生成文档注释: 2.在eclipse中生成文档注释: ①单击eclipse菜单栏中的[Project]菜单,该菜 ...

  6. 使用 Swagger 自动生成 ASP.NET Core Web API 的文档、在线帮助测试文档(ASP.NET Core Web API 自动生成文档)

    对于开发人员来说,构建一个消费应用程序时去了解各种各样的 API 是一个巨大的挑战.在你的 Web API 项目中使用 Swagger 的 .NET Core 封装 Swashbuckle 可以帮助你 ...

  7. 使用Ldoc给Lua生成文档

    Ldoc介绍 LDoc是一个Lua的文档生成工具,过去,比较常用的Lua生成文档的工具是LuaDoc,可惜作者自从2008年之后就再也没有发布过新的版本了,说明作者基本上已经放弃维护了.而LDoc则是 ...

  8. doxygen的使用(一)配置并生成文档

    原创文章,欢迎阅读,禁止转载. doxygen是个好用的文档生成工具,他的强大功能有很多介绍,我就不说了.自带的chm帮助手册很全面,包括功能.注释规范.怎么配置.工具用法等.doxygen的用法共3 ...

  9. ASP.NET Core 1.0 中使用 Swagger 生成文档

    github:https://github.com/domaindrivendev/Ahoy 之前文章有介绍在ASP.NET WebAPI 中使用Swagger生成文档,ASP.NET Core 1. ...

随机推荐

  1. SPOJ 11840. Sum of Squares with Segment Tree (线段树,区间更新)

    http://www.spoj.com/problems/SEGSQRSS/ SPOJ Problem Set (classical) 11840. Sum of Squares with Segme ...

  2. poj1573&&hdu1035 Robot Motion(模拟)

    转载请注明出处:http://blog.csdn.net/u012860063? viewmode=contents 题目链接: HDU:pid=1035">http://acm.hd ...

  3. ModelConvertHelper(将DataTable转换成List<model>)

      public class ModelConvertHelper<T> where T : new() {      public static IList<T> Conve ...

  4. 由两代WIN8 Surface平板看微软心态

    要说win8平板的前景非常好,微软的两代surface做的真不错. 可是可是,微软就错在了把价格定的太高.为什么高,一是intel芯价格不低,二是每套win8和office微软得要价几百美金吧! 这两 ...

  5. PHP 页面跳转到另一个页面的几种方法分享

    如何在 PHP 中从一个页面重定向到另外一个页面呢?今天 清源 为大家列举出了三种办法,供大家来参考. 一.用HTTP头信息  也就是用PHP的HEADER函数.PHP里的HEADER函数的作用就是向 ...

  6. C++基础学习笔记----第十四课(new和malloc的区别、单例模式等深入)

    本节主要讲new关键字和malloc函数的差别,编译器对构造函数调用的实质,单例模式的实现等. new和malloc的差别 1.malloc和free是C语言的库函数,以字节为单位申请堆空间.new和 ...

  7. 简单理清一下proto与prototype

    这篇博客主要是为了理清自己的思路. 先上图,所有内容都从这张图来讲. 在js中,所有的东西都是对象,包括是function. prototype这个属性是函数特有的.有两层含义,第一层含义指的是某对象 ...

  8. Qt MinGW 使用联合编译IncrediBuild

    联合编译工具IncrediBuild提供了接口,以使得可以使用网格来处理各种任务,而不仅仅是VS的联合编译,文档地址:http://www.incredibuild.com/webhelp/xge_h ...

  9. Managing your Actor Systems

    今天偶然得机会,找到一篇不错得文章,现在分享给大家. 原文:http://www.kotancode.com/2013/02/15/managing-your-actor-systems/ If yo ...

  10. gaoyong的干货

    http://blog.163.com/you888@188/blog/static/6723961920169319529515/    1.xe6安卓编程入门教程,一本很好的资料,全是干货,书印刷 ...