Luadoc

http://keplerproject.github.io/luadoc/

Overview

LuaDoc is a documentation generator tool for Lua source code. It parses the declarations and documentation comments in a set of Lua source files and produces a set of XHTML pages describing the commented declarations and functions.

The output is not limited to XHTML. Other formats can be generated by implementing new doclets. The format of the documentation comments is also flexible and can be customized by implementing new taglets. Please refer to customizing section for further information.

LuaDoc is free software and uses the same license as Lua.

LDoc

https://github.com/stevedonovan/LDoc

A LuaDoc-compatible documentation generation system http://stevedonovan.github.com/ldoc/

Rationale

This project grew out of the documentation needs of Penlight (and not always getting satisfaction with LuaDoc) and depends on Penlight itself.(This allowed me to not write a lot of code.)

The API documentation of Penlight is an example of a project using plain LuaDoc markup processed using LDoc.

LDoc is intended to be compatible with LuaDoc and thus follows the pattern set by the various *Doc tools:

--- Summary ends with a period.
-- Some description, can be over several lines.
-- @param p1 first parameter
-- @param p2 second parameter
-- @return a string value
-- @see second_fun
function mod1.first_fun(p1,p2)
end

Tags such as see and usage are supported, and generally the names of functions and modules can be inferred from the code.

LDoc is designed to give better diagnostics: if a @see reference cannot be found, then the line number of the reference is given. LDoc knows about modules which do not use module()

  • this is important since this function has become deprecated in Lua 5.2. And you can avoid having to embed HTML in commments by using Markdown.

LDoc will also work with Lua C extension code, and provides some convenient shortcuts.

An example showing the support for named sections and 'classes' is the Winapi documentation; this is generated from winapi.l.c.

LDoc API & Help

http://stevedonovan.github.io/ldoc/manual/doc.md.html#Basic_Usage

LDoc, a Lua Documentation Tool

Introduction

LDoc is a software documentation tool which automatically generates API documentation out of source code comments (doc comments). It is mainly targeted at Lua and documenting Lua APIs, but it can also parse C with according doc comments for documenting Lua modules implemented in C.

It is mostly compatible with LuaDoc, except that certain workarounds are no longer needed. For instance, it is not so married to the idea that Lua modules should be defined using the module function; this is not only a matter of taste since this has been deprecated in Lua 5.2.

Otherwise, the output is very similar, which is no accident since the HTML templates are based directly on LuaDoc. You can ship your own customized templates and style sheets with your own project (also see Graham Hannington’s documentation for Lua for z/OS). LDoc comes with three extra themes; ‘pale’ for those who like whitespace, ‘one’ for one-column output, and ‘fixed’ for a fixed navigation bar down the left side.

You have an option to use Markdown to process the documentation, which means no ugly HTML is needed in doc comments. C/C++ extension modules may be documented in a similar way, although function names cannot be inferred from the code itself.

LDoc can provide integrated documentation, with traditional function comments, any documents in Markdown format, and specified source examples. Lua source in examples and the documents will be prettified.

Although there are a fair number of command-line options, the preferred route is to write a config.ld configuration file in Lua format. By convention, if LDoc is simply invoked as ldoc . it will read this file first. In this way, the aim is to make it very easy for end-users to build your documentation using this simple command.

------------

Here are all the tags known to LDoc:

  • @module A Lua module containing functions and tables, which may be inside sections
  • @classmod Like @module but describing a class
  • @submodule A file containing definitions that you wish to put into the named master module
  • @script A Lua program
  • @author (multiple), copyright, @license, @release only used for project-level tags like @module
  • @function, @lfunction. Functions inside a module
  • @param formal arguments of a function (multiple)
  • @return returned values of a function (multiple)
  • @raise unhandled error thrown by this function
  • @local explicitly marks a function as not being exported (unless --all)
  • @see reference other documented items
  • @usage give an example of a function’s use. (Has a somewhat different meaning when used with @module)
  • @table a Lua table
  • @field a named member of a table
  • @section starting a named section for grouping functions or tables together
  • @type a section which describes a class
  • @within puts the function or table into an implicit section
  • @fixme, @todo and @warning are annotations, which are doc comments that occur inside a function body.

http://stevedonovan.github.io/ldoc/manual/doc.md.html#Basic_Usage

Fields allowed in config.ld

Same meaning as the corresponding parameters:

  • file a file or directory containing sources. In config.ld this can also be a table of files and directories.
  • project name of project, used as title in top left
  • title page title, default ‘Reference’
  • package explicit base package name; also used for resolving references in documents
  • all show local functions, etc as well in the docs
  • format markup processor, can be ‘plain’ (default), ‘markdown’ or ‘discount’
  • output output name (default ‘index’)
  • dir directory for output files (default ‘doc’)
  • colon use colon style, instead of @ tag style
  • boilerplate ignore first comment in all source files (e.g. license comments)
  • ext extension for output (default ‘html’)
  • one use a one-column layout
  • style, template: together these specify the directories for the style and and the template. In config.ld they may also be true, meaning use the same directory as the configuration file.
  • merge allow documentation from different files to be merged into modules without explicit @submodule tag

_These only appear in the configuration file:_

  • description a short project description used under the project title
  • full_description when you really need a longer project description
  • examples a directory or file: can be a table
  • readme or topics readme files (to be processed with Markdown)
  • pretty code prettify ‘lua’ (default) or ‘lxsh’
  • prettify_files prettify the source as well and make links to it; if its value is “show” then also index the source files.
  • charset use if you want to override the UTF-8 default (also @charset in files)
  • sort set if you want all items in alphabetical order
  • no_return_or_parms don’t show parameters or return values in output
  • no_lua_ref stop obsessively trying to create references to standard Lua libraries
  • backtick_references whether references in backticks will be resolved. Happens by default when using Markdown. When explicit will expand non-references in backticks into <code> elements
  • plain set to true if format is set but you don’t want code comments processed
  • wrap set to true if you want to allow long names to wrap in the summaries
  • manual_url point to an alternative or local location for the Lua manual, e.g. ‘file:///D:/dev/lua/projects/lua-5.1.4/doc/manual.html’
  • no_summary suppress the Contents summary
  • custom_tags define some new tags, which will be presented after the function description. The format is {<name>,[title=<name>,}{hidden=false,}{format=nil}}. For instance custom_tags={'remark',title='Remarks'} will add a little Remarks section to the docs for any function containing this tag. format can be a function – if not present the default formatter will be used, e.g. Markdown
  • custom_see_handler function that filters see-references
  • custom_display_name_handler function that formats an item’s name. The arguments are the item and the default function used to format the name. For example, to show an icon or label beside any function tagged with a certain tag:

LDoc demo

http://stevedonovan.github.io/ldoc/examples/mylib.c.html

/// A sample C extension.
// Demonstrates using ldoc's C/C++ support. Can either use /// or /*** */ etc.
// @module mylib
#include <string.h>
#include <math.h> // includes for Lua
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h> /***
Create a table with given array and hash slots.
@function createtable
@param narr initial array slots, default 0
@param nrec initial hash slots, default 0
*/
static int l_createtable (lua_State *L) {
int narr = luaL_optint(L,1,0);
int nrec = luaL_optint(L,2,0);
lua_createtable(L,narr,nrec);
return 1;
}

-------------

------
-- Various ways of indicating errors
-- @module multiple -----
-- function with return groups.
-- @treturn[1] string result
-- @return[2] nil
-- @return[2] error message
function mul1 () end

LDoc 依赖 PenLight 库

https://github.com/stevedonovan/Penlight

Penlight brings together a set of generally useful pure Lua modules, focusing on input data handling (such as reading configuration files), functional programming (such as map, reduce, placeholder expressions, etc), and OS path management. Much of the functionality is inspired by the Python standard libraries.

Paths, Files and Directories

  • path: queries like isdir,isfile,exists, splitting paths like dirname and basename
  • dir: listing files in directories (getfiles,getallfiles) and creating/removing directory paths
  • file: copy,move; read/write contents with read and write

Application Support

  • app: require_here to rebase require to work with main script path; simple argument parsing parse_args
  • lapp: sophisticated usage-text-driven argument parsing for applications
  • config: flexibly read Unix config files and Windows INI files
  • strict: check for undefined global variables - can use strict.module for modules
  • utils,compat: Penlight support for unified Lua 5.1/5.2 codebases
  • types: predicates like is_callable and is_integer; extended type function.

Extra String Operations

  • utils: can split a string with a delimiter using utils.split
  • stringx: extended string functions covering the Python string type
  • stringio: open strings for reading, and creating strings using standard Lua IO methods
  • lexer: lexical scanner for splitting text into tokens; special cases for Lua and C
  • text: indenting and dedenting text, wrapping paragraphs; optionally make % work as in Python
  • template: small but powerful template expansion engine
  • sip: Simple Input Patterns - higher-level string patterns for parsing text

Extra Table Operations

  • tablex: copying, comparing and mapping over
  • pretty: pretty-printing Lua tables, and various safe ways to load Lua as data
  • List: implementation of Python 'list' type - slices, concatenation and partitioning
  • Map, Set, OrderedMap: classes for specialized kinds of tables
  • data: reading tabular data into 2D arrays and efficient queries
  • array2d: operations on 2D arrays
  • permute: generate permutations

Iterators, OOP and Functional

  • seq: working with iterator pipelines; collecting iterators as tables
  • class: a simple reusable class framework
  • func: symbolic manipulation of expressions and lambda expressions
  • utils: utils.string_lambda converts short strings like '|x| x^2' into functions
  • comprehension: list comprehensions: C'x for x=1,4'()=={1,2,3,4}

参考BLOG

http://blog.justbilt.com/2015/08/23/ldoc/

http://www.dpull.com/blog/2016-02-03-ldoc

其它

http://www.cs.scranton.edu/~doc/cppdoc/

CDOC没有找到。

https://en.wikipedia.org/wiki/Comparison_of_documentation_generators

http://jessevdk.github.io/cldoc/

Lua Doc生成工具的更多相关文章

  1. 【Lua】LDoc生成Lua文档工具的使用

    参考资料: http://my.oschina.net/wangxuanyihaha/blog/188909   LDoc介绍:     LDoc是一个Lua的文档生成工具,过去,比较常用的Lua生成 ...

  2. 数据字典生成工具之旅(5):DocX组件读取与写入Word

    由于上周工作比较繁忙,所以这篇文章等了这么久才写(预告一下,下一个章节正式进入NVelocity篇,到时会讲解怎么使用NVelocity做一款简易的代码生成器,敬请期待!),好了正式进入本篇内容. 这 ...

  3. 赞!jsPDF – 基于 HTML5 的强大 PDF 生成工具

    jsPDF 是一个基于 HTML5 的客户端解决方案,用于生成各种用途的 PDF 文档.使用方法很简单,只要引入 jsPDF 库,然后调用内置的方法就可以了.浏览器兼容性: IE 10, Firefo ...

  4. JS文档和Demo自动化生成工具 - SmartDoc发布

    曾几何时,当你码神附体,一路披荆斩棘的完成代码后,带着“一码在手,天下我有”的傲然环顾之时,却发现单元测试.API文档.Demo实例陆续向你砸来,顿时有木有一种冰水挑战后的感觉.而这时你应该:哟哟,快 ...

  5. 使用Objective-C的文档生成工具:appledoc

    使用Objective-C的文档生成工具:appledoc 前言 做项目的人多了,就需要文档了.今天开始尝试写一些项目文档.但是就源代码来说,文档最好和源码在一起,这样更新起来更加方便和顺手.象 Ja ...

  6. Lua内存分析工具

    最近给公司写了一个lua内存分析工具,可以非常方便的分析出Lua内存泄露问题,有图形化界面操作,方便手机端上传快照等功能 内存分析我是在c语言端写的,也有人写过lua端的分析工具,也蛮好用的,不过lu ...

  7. Markdown 文档生成工具

    之前用了很多Markdown 文档生成工具,发现有几个挺好用的,现在整理出来,方便大家快速学习. loppo: 非常简单的静态站点生成器 idoc:简单的文档生成工具 gitbook:大名鼎鼎的文档协 ...

  8. python文档生成工具:pydoc、sphinx;django如何使用sphinx?

    文档生成工具: 自带的pydoc,比较差 建议使用sphinx 安装: pip install sphinx 安装主题: 由各种主题,我选择常用的sphinx_rtd_theme pip instal ...

  9. H5类似易企秀/编辑器/页面制作/开发/生成工具/软件/源码/授权

    代码地址如下:http://www.demodashi.com/demo/14960.html 项目简介 H5DS (HTML5 Design software) 这是一款基于WEB的 H5制作工具. ...

随机推荐

  1. Composer 安装时要求输入授权用户名密码?

    D:\work\dreamland-yii>composer require "saviorlv/yii2-dysms:dev-master" Authentication ...

  2. 洛谷P2831 愤怒的小鸟 + 篮球比赛1 2

    这三道题一起做,有一点心得吧. 愤怒的小鸟,一眼看上去是爆搜,但是实现起来有困难(我打了0分出来). 还有一种解法是状压DP. 抛物线一共只有那么多条,我们枚举抛物线(枚举两个点),这样就能够预处理出 ...

  3. vue2.0项目实战(4)生命周期和钩子函数详解

    最近的项目都使用vue2.0来开发,不得不说,vue真的非常好用,大大减少了项目的开发周期.在踩坑的过程中,因为对vue的生命周期不是特别了解,所以有时候会在几个钩子函数里做一些事情,什么时候做,在哪 ...

  4. Django 获取访问者信息

    request内的META里有请求用户的信息 #定义视图方法 def get_ip(request): #打印头部所以信息 # print(request.META) # 获取ip信息 if &quo ...

  5. MongoDB 学习记录(二)yum安装

    前言:接着上篇继续学习MongoDB,这次学习的是在Linux下安装MongoDB 环境:centos7.3 安装版本:MongoDB4.0 官网安装教程地址 https://docs.mongodb ...

  6. 第一篇-ubuntu18.04访问共享文件夹

    1. 在访问Windows共享资料之前,请确保Windows共享是可用的.Linux访问Windows共享或者LInux共享资料给Windows时,都使用Samba软件 rpm -qa | grep ...

  7. Day6--Python--小数据池和再谈编码

    一.小数据池 参考 目的:缓存我们字符串,整数,布尔值.在使用的时候不需要创建过多的对象 缓存: int, str, bool int: 缓存范围 -5~256 str: 1. 长度小于等于1,直接缓 ...

  8. TestNg 10. 多线程测试-xml文件实现

    代码如下: package com.course.testng.multiThread; import org.testng.annotations.Test; public class MultiT ...

  9. qml: QtCharts模块得使用(数据整合和显示) ---- <二>

    QtCharts目前已经可以免费使用,而且使用非常方便.快捷,并且提供了各种类别的支持(例如:曲线图,柱形图,折线图,饼图等). 这里讲解qml端图表显示,C++端进行数据整合,并能实现实时数据刷新( ...

  10. 在linux下面解压用的zxpf是什么意思,它跟zxvf有啥区别

    在linux下面解压用的zxpf是什么意思,它跟zxvf有啥区别 linux 命令中tar后跟的zxvf是什么意思:.tar.gz是一个压缩包   .tar只是打包而没有压缩 z:表示 tar 包是被 ...