LDoc使用总结
LDoc使用总结
安装
按照下面的安装就可以了
http://www.cnblogs.com/ZhYQ-Note/articles/6022525.html
使用
参考:官方的说明文档
https://stevedonovan.github.io/ldoc/manual/doc.md.html
修改
问题
在模块中生成函数列表时,如我下面这样定义:
--[[--
color 颜色处理
@module color
]]
local color = {}
---整形转cc.c3b类型
-- @function intToc3b
-- @param int intValue
-- @return cc.c3b
function color.intToc3b(intValue)
local hexStr = string.format("%06X", intValue)
return color.hexToc3b(hexStr)
end
---整形转cc.c3b类型
-- @function color.intToHex
-- @param int intValue
-- @return "aabbcc"
color.intToHex = function (intValue)
return string.format("%06X", intValue)
end
最后生成的函数列表会去掉模块名,生成的函数名是intToc3b 和 intToHex,但是我想生成的
函数名字是根据-- @function intToc3b 这这里写的,我写成color.intToHex 就生成这样的
就行了,而不是主动给我去掉color 前缀,只剩下intToHex,这样就不能很好的区分调用方式是
color:intToHex 还是 color.intToHex
解决
出线上面的问题,我就想自己查看下ldoc的源码,看看能不能自己修改下,毕竟源码是lua写的,也是抱着试试看的感觉,分析了下ldoc的源码,找到了一个地方:
在doc.lua文件中
-- 看注释应该是获取模块中的函数名mod.foo
-- new-style modules will have qualified names like 'mod.foo'
if item.name == nil then
self:error("item's name is nil")
end
--分开模块名和函数名
local mod,fname = split_dotted_name(item.name)
-- warning for inferred unqualified names in new style modules
-- (retired until we handle methods like Set:unset() properly)
if not mod and not this_mod.old_style and item.inferred then
--item:warning(item.name .. ' is declared in global scope')
end
-- the function may be qualified with a module alias...
local alias = this_mod.tags.alias
if (alias and mod == alias) or mod == 'M' or mod == '_M' then
mod = this_mod.mod_name
end
--- 这里是关键,这里做了一个判断,意思是只保留foo即函数名,去掉模块名,
--- 所以我这里直接这两行去掉,保留为模块名.函数名的形式,如mod.foo
--- 这样我们生成的文档应该就可以了
-- if that's the mod_name, then we want to only use 'foo'
-- if mod == this_mod.mod_name and this_mod.tags.pragma ~= 'nostrip' then
-- item.name = fname
-- end
注意
因为我的ldoc是通过luarocks安装的,那必须找到luarocks把安装的工具源码放到那里了,才能够修改源码,并且实验是否方案可行,在官网上找到了
https://github.com/keplerproject/luarocks/wiki/File-locations#Path_to_Lua_binaries_and_associated_data,这个网页上说明了luarocks的
所有相关路径,最终在:
LuaRocks command-line tools are configured during installation to be able to find those files.
Unix default: /usr/local/share/lua/5.x/
我的:/usr/local/share/lua/5.1 目录下的文件:
ldoc(需要修改的地方) luarocks markdown.lua pl
LDoc使用总结的更多相关文章
- 使用Ldoc给Lua生成文档
Ldoc介绍 LDoc是一个Lua的文档生成工具,过去,比较常用的Lua生成文档的工具是LuaDoc,可惜作者自从2008年之后就再也没有发布过新的版本了,说明作者基本上已经放弃维护了.而LDoc则是 ...
- 【Lua】LDoc生成Lua文档工具的使用
参考资料: http://my.oschina.net/wangxuanyihaha/blog/188909 LDoc介绍: LDoc是一个Lua的文档生成工具,过去,比较常用的Lua生成 ...
- lua UT测试工具
luaunit Luaunit is a unit-testing framework for Lua, in the spirit of many others unit-testing frame ...
- Lua Doc生成工具
Luadoc http://keplerproject.github.io/luadoc/ Overview LuaDoc is a documentation generator tool for ...
- WPF 选项卡
1.引用 xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock" 2.xaml代码 <xcad:DockingMa ...
- 《Python入门》Windows 7下Python Web开发环境搭建笔记
最近想尝试一下在IBM Bluemix上使用Python语言创建Web应用程序,所以需要在本地搭建Python Web的开发测试环境. 关于Python的版本 进入Python的网站,鼠标移到导航条上 ...
- 全文检索引擎及工具 Lucene Solr
全文检索引擎及工具 lucence lucence是一个全文检索引擎. lucence代码级别的使用步骤大致如下: 创建文档(org.apache.lucene.document.Document), ...
- windows服务与log4net应用
有时候我们需要用到window服务来执行定时任务,然后配合log4net记录程序运行情况,这里简单记录下配置的整个过程以及注意要点: 一.添加windows服务 1.设计页面,右键添加安装程序
- Lua OpenResty容器化(考古历程)
原文地址:Lua OpenResty容器化(考古历程) 背景 公司有几个"远古时期"的项目,一直都相对较为稳定,但是项目每天总会在一些时段,请求每分钟QPS到达峰值800K左右,导 ...
随机推荐
- R与金钱游戏:均线黄金交叉1
双11临近的我发现自己真的很穷很穷很穷(重要的问题说三遍)-- 贫穷催人上进.于是我就寻思着在空闲时间自己捣鼓一下钱生钱的游戏是怎么玩的,毕竟就算注定做韭菜也要做一根有知识有理想的韭菜. 第一个要玩的 ...
- 如何在Quartus II中查看RTL原理图
整个工程代码编写并且编译完成之后,标题栏选择Tools→Netlist Viewers→RTL Viewer即可
- LinQ in 写法
有时候会碰到一个需求,又一堆id 1,2,3,4,循环遍历id再去数据库查不仅效率低,而且代码难看,可以用in来实现: string[] codes = item.ExamPaperCode.Spli ...
- 2019-11-29-WPF-笔刷绑定不上可能的原因
原文:2019-11-29-WPF-笔刷绑定不上可能的原因 title author date CreateTime categories WPF 笔刷绑定不上可能的原因 lindexi 2019-1 ...
- 'while' statement cannot complete without throwing an exception
You are probably using Android Studio or IntelliJ. If so, you can add this above your method contain ...
- juc包下四大并发工具
juc.CountDownLatch 闭锁 一个线程在等待一组线程后再恢复执行 await()等待其他线程执行完毕 被等待线程执行完毕后计数器-1 如何知道其他线程执行完了? 计数器,若一组线程为,C ...
- Python - 基础语法 - 第一天
编码 默认情况下,Python 3 源码文件以 UTF-8 编码,所有字符串都是 unicode 字符串. 标识符 第一个字符必须是字母表中字母或下划线 _ . 标识符的其他的部分由字母.数字和下划线 ...
- 3-awk
1.输出双引号:awk '{print "\""}' #放大:awk '{print " \" "}'使用“”双引号把一个 ...
- nginx配置ssl证书实现https
一,环境说明 服务器系统:centos6 服务器IP地址:0.0.0.0 域名:bjubi.com 二,域名解析到服务器 在阿里云控制台-产品与服务-云解析DNS-找到需要解析的域名点“解析”,进入解 ...
- 【转载】c# datatable 判断值是否存在
在C#的数据表格DataTable操作过程中,有时候在操作DataTable前需要判断DataTable中的值是否存在,此时首选需要判断DataTable是否为null值,而后在判断DataTable ...