From 3d31f32b93942adb33a78f28e8b2a7caa4d71942 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Mon, 20 Jun 2016 19:32:46 +0200 Subject: [PATCH] --testing: version and date does not change. Bump to 1.4.4 --- ldoc.lua | 23 ++++++++++++++--------- ldoc/html/ldoc_ltp.lua | 2 +- run-tests.lua | 22 +++++++++++++++++----- tests/classes.lua | 2 +- tests/config.ld | 2 +- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/ldoc.lua b/ldoc.lua index 93f324b..07b0378 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -27,17 +27,18 @@ local tablex = require 'pl.tablex' -- Penlight compatibility utils.unpack = utils.unpack or unpack or table.unpack - local append = table.insert - local lapp = require 'pl.lapp' +local version = '1.4.4' + -- so we can find our private modules app.require_here() --- @usage local usage = [[ -ldoc, a documentation generator for Lua, vs 1.4.3 +ldoc, a documentation generator for Lua, vs ]]..version..[[ + -d,--dir (default doc) output directory -o,--output (default 'index') output name -v,--verbose verbose @@ -66,6 +67,8 @@ ldoc, a documentation generator for Lua, vs 1.4.3 --filter (default none) filter output as Lua data (e.g pl.pretty.dump) --tags (default none) show all references to given tags, comma-separated --fatalwarnings non-zero exit status on any warning + --testing reproducible build; no date or version on output + (string) source file or directory containing source `ldoc .` reads options from an `config.ld` file in same directory; @@ -101,8 +104,6 @@ function ProjectMap:_init () self.fieldname = 'type' end - - local lua, cc = lang.lua, lang.cc local file_types = { @@ -120,7 +121,7 @@ local file_types = { ------- ldoc external API ------------ -- the ldoc table represents the API available in `config.ld`. -local ldoc = { charset = 'UTF-8' } +local ldoc = { charset = 'UTF-8', version = version } local known_types, kind_names = {} @@ -238,7 +239,7 @@ local ldoc_contents = { 'unqualified', 'custom_display_name_handler', 'kind_names', 'custom_references', 'dont_escape_underscore','global_lookup','prettify_files','convert_opt', 'user_keywords', 'postprocess_html', - 'custom_css', + 'custom_css','version' } ldoc_contents = tablex.makeset(ldoc_contents) @@ -806,14 +807,18 @@ ldoc.title = ldoc.title or args.title ldoc.project = ldoc.project or args.project ldoc.package = args.package:match '%a+' and args.package or nil -if os.getenv("SOURCE_DATE_EPOCH") == nil then +local source_date_epoch = os.getenv("SOURCE_DATE_EPOCH") +if args.testing then + ldoc.updatetime = "2015-01-01 12:00:00" + ldoc.version = 'TESTING' +elseif source_date_epoch == nil then if args.date == 'system' then ldoc.updatetime = os.date("%Y-%m-%d %H:%M:%S") else ldoc.updatetime = args.date end else - ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",os.getenv("SOURCE_DATE_EPOCH")) + ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",source_date_epoch) end local html = require 'ldoc.html' diff --git a/ldoc/html/ldoc_ltp.lua b/ldoc/html/ldoc_ltp.lua index 0bafabf..4827e61 100644 --- a/ldoc/html/ldoc_ltp.lua +++ b/ldoc/html/ldoc_ltp.lua @@ -306,7 +306,7 @@ return [==[
-generated by LDoc 1.4.3 +generated by LDoc $(ldoc.version) Last updated $(ldoc.updatetime)
diff --git a/run-tests.lua b/run-tests.lua index 335659a..6d10a7d 100644 --- a/run-tests.lua +++ b/run-tests.lua @@ -1,6 +1,18 @@ -function run_test(dir) - os.execute('cd '..dir..' && ldoc --testing . && diff -r doc cdocs') +local run +if not arg[1] then + run = function (dir) + local cmd = 'cd '..dir..' && ldoc --testing . && diff -r doc cdocs' + print(cmd) + os.execute(cmd) + end +elseif arg[1] == 'update' then + run = function (dir) + local cmd = 'cd '..dir..' && ldoc --dir cdocs --testing .' + print(cmd) + os.execute(cmd) + end +end + +for _,d in ipairs{'tests','tests/example','tests/md-test'} do + run(d) end -run_test('tests') -run_test('tests/example') -run_test('tests/md-test') diff --git a/tests/classes.lua b/tests/classes.lua index 7b33b32..ed9c6ab 100644 --- a/tests/classes.lua +++ b/tests/classes.lua @@ -10,7 +10,7 @@ local _M = {} _M.Bonzo = class() --- a method. --- function one +-- function one; reference to @{one.md.classes|documentation} function Bonzo:one() end diff --git a/tests/config.ld b/tests/config.ld index 22b4983..4c9cbae 100644 --- a/tests/config.ld +++ b/tests/config.ld @@ -2,4 +2,4 @@ format='markdown' project = 'Basic Example' file = {'types.lua','classes.lua'} use_markdown_titles=true -topics = {'one 1.md','two.md'} +topics = {'one.md','two.md'}