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左右,导 ...
随机推荐
- eclipse jvm 参数配置
双击tomcat服务器---->打开启动配置--->VM 自变量
- Nacos配置中心
本文介绍spring cloud 集成 nacos案例 官方文档:https://nacos.io/zh-cn/docs/what-is-nacos.html](https://nacos.io/zh ...
- WPF 精修篇 多属性触发器
原文:WPF 精修篇 多属性触发器 多属性触发器就是多个属性都满足在触发 在属性触发器上加了一些逻辑判断 举栗子 这个栗子里 textBox 要满足俩个条件 才能触发背景变色 1)textbox的 ...
- EF连接mysql,出现A call to SSPI failed错误,解决办法
我的使用场景是用EF连接AWS的mysql RDS,会偶发性的出现A call to SSPI failed错误, System.AggregateException: One or more err ...
- LearnOpenGL笔记(1)搭建环境
之前有写过Unity Shader,但不过是东拼西凑,对其中的原理可以说完全不清楚,现在准备好好从opengl开始,学习这基础又重要的内容. LearnOpenGL CN是一个超超超炒鸡好的openG ...
- Web Api 模型绑定 一
[https://docs.microsoft.com/zh-cn/aspnet/core/web-api/?view=aspnetcore-2.2]1.模型绑定 简单模型绑定针对简单类型(如stri ...
- 关于final
最近见的一道选择题 刚学习一直认为final修饰,为常量,必须声明时被初始化,现在又明白第二种情况可以通过创建对象之后由构造方法立即初始化. 1.final修饰类不能被继承 2.final修饰方法不能 ...
- H5离线缓存(基础)学习指南
离线缓存 application cache 1. 什么是离线缓存: 离线缓存可以将站点的一些文件缓存到本地,它是浏览器自己的一种机制,将需要的文件缓存下来,以便后期即使没有连接网络,被缓存的页面也可 ...
- 【前端_React】npm常用命令
安装模块(包): //全局安装 $ npm install 模块名 -g //本地安装 $ npm install 模块名 //一次性安装多个 $ npm install 模块1 模块2 模块n -- ...
- Python--RE--?
?在re中默认匹配前一个字符0次或者1次 比如: aal? 默认匹配aal,或者aa 即整体匹配前一个字符串,但是可以舍弃最近的一个字符或者不舍弃 re模块 常用正则表达式符号 '.' 默认匹配 ...