From b978597eca62492c80ad160cab7401e261a61167 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 06:46:36 +0200 Subject: [PATCH 01/10] Pretty Index? --- template/index.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/index.lua b/template/index.lua index 28c0605..376c9dd 100644 --- a/template/index.lua +++ b/template/index.lua @@ -18,7 +18,7 @@ return # for _, module in sortedpairs( _index.modules ) do # if module.tag ~= 'index' then - $( fulllinkto(module) ) + $( fulllinkto(prettyname(module)) ) $( module.description and format(module.shortdescription) ) # end From 1f87abd8b8250e92f27c172219c899d290185f7c Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 06:56:37 +0200 Subject: [PATCH 02/10] Pure link --- .project | 18 ++++++++++++++++++ template/index.lua | 2 +- templateengine.lua | 12 ++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .project diff --git a/.project b/.project new file mode 100644 index 0000000..0876484 --- /dev/null +++ b/.project @@ -0,0 +1,18 @@ + + + luadocumentor + + + Penlight + + + + org.eclipse.dltk.core.scriptbuilder + + + + + + org.eclipse.ldt.nature + + diff --git a/template/index.lua b/template/index.lua index 376c9dd..426eb25 100644 --- a/template/index.lua +++ b/template/index.lua @@ -18,7 +18,7 @@ return # for _, module in sortedpairs( _index.modules ) do # if module.tag ~= 'index' then - $( fulllinkto(prettyname(module)) ) + $( purelinkto(module) ) $( module.description and format(module.shortdescription) ) # end diff --git a/templateengine.lua b/templateengine.lua index 607a600..7bdc760 100644 --- a/templateengine.lua +++ b/templateengine.lua @@ -85,6 +85,18 @@ local function format(string) return M.env.markdown( string ) end +--- +-- Provide a full link to an element using `prettyname` and `linkto`. +-- Default implementation is for HTML. +local function purelinkto(o,...) + local ref = M.env.linkto(o,...) + local name = o + if not ref then + return name + end + return string.format('%s', ref, name) +end + --- -- Provide a full link to an element using `prettyname` and `linkto`. -- Default implementation is for HTML. From 1f7ada8fcc40f442e9dd9243343799052b648c12 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 07:06:06 +0200 Subject: [PATCH 03/10] purelink --- templateengine.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/templateengine.lua b/templateengine.lua index 7bdc760..f2a7465 100644 --- a/templateengine.lua +++ b/templateengine.lua @@ -119,6 +119,7 @@ local defaultenv = { applytemplate = M.applytemplate, format = format, linkto = function(str) return str end, + purelinkto = purelinkto, fulllinkto = fulllinkto, prettyname = function(s) return s end, getelement = function(s) return nil end From df8ac1308b3e35ef1c7d16d92255fd2d8ea86f37 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 07:14:30 +0200 Subject: [PATCH 04/10] purename --- template/utils.lua | 21 +++++++++++++++++++++ templateengine.lua | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/template/utils.lua b/template/utils.lua index bf9f9e0..d777255 100644 --- a/template/utils.lua +++ b/template/utils.lua @@ -363,6 +363,27 @@ function M.prettyname( apiobject, ... ) return nil, string.format('No pretty name for `%s.', tag) end +--- +-- Provide human readable overview from an API model element +-- +-- Resolve all element needed to summurize nicely an element form API model. +-- @usage $ print( prettyname(item) ) +-- module:somefunction(secondparameter) +-- @function [parent = #docutils] +-- @param apiobject Object form API model +-- @result #string Human readable description of given element. +-- @result #nil, #string In case of error. +function M.purename( apiobject, ... ) + local tag = apiobject.tag + if M.prettynametypes[tag] then + local prettyname = M.prettynametypes[tag](apiobject,...) + return prettyname + elseif not tag then + return nil, 'No pretty name available as no tag has been provided.' + end + return nil, string.format('No pretty name for `%s.', tag) +end + --- -- Just make a string print table in HTML. -- @function [parent = #docutils] securechevrons diff --git a/templateengine.lua b/templateengine.lua index f2a7465..2d004a2 100644 --- a/templateengine.lua +++ b/templateengine.lua @@ -90,7 +90,7 @@ end -- Default implementation is for HTML. local function purelinkto(o,...) local ref = M.env.linkto(o,...) - local name = o + local name = M.env.purename(o,...) if not ref then return name end From f34992f72e7ca6b16e7f608b26668d778ab30a0e Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 07:51:28 +0200 Subject: [PATCH 05/10] purename type --- template/functiontypedef.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/functiontypedef.lua b/template/functiontypedef.lua index 72e68c8..4de7d43 100644 --- a/template/functiontypedef.lua +++ b/template/functiontypedef.lua @@ -45,7 +45,7 @@ return [[# # local paramline = "" # if param.type then # local link = linkto( param.type ) -# local name = prettyname( param.type ) +# local name = purename( param.type ) # if link then # paramline = paramline .. '' .. name .. "" # else From d509439e463a9258821e137d1de0b8c7bf8a64ab Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 09:06:55 +0200 Subject: [PATCH 06/10] purelink typedefs --- template/index/recordtypedef.lua | 4 ++-- template/recordtypedef.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/template/index/recordtypedef.lua b/template/index/recordtypedef.lua index 2d4ab13..b23a6ae 100644 --- a/template/index/recordtypedef.lua +++ b/template/index/recordtypedef.lua @@ -16,13 +16,13 @@ return [[# # if calldef then - + # end # for _, item in sortedpairs( _recordtypedef.fields ) do - + # end diff --git a/template/recordtypedef.lua b/template/recordtypedef.lua index e5418c9..c5722b1 100644 --- a/template/recordtypedef.lua +++ b/template/recordtypedef.lua @@ -14,7 +14,7 @@ return [[# # -- Inheritance # -- #if _recordtypedef.supertype then - Extends $( fulllinkto(_recordtypedef.supertype)) + Extends $( purelinkto(_recordtypedef.supertype)) #end # -- # -- Descriptions From ec511f0ab274c0139dd6c03197057c8adcd2eed0 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 09:23:08 +0200 Subject: [PATCH 07/10] purelink --- template/file.lua | 2 +- template/item.lua | 6 +++--- template/recordtypedef.lua | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/template/file.lua b/template/file.lua index ef9e1f9..bb7d56f 100644 --- a/template/file.lua +++ b/template/file.lua @@ -42,7 +42,7 @@ return[[#
$( fulllinkto(calldef,_recordtypedef) )$( purelinkto(calldef,_recordtypedef) ) $( format(calldef.shortdescription) )
$( fulllinkto(item) )$( purelinkto(item) ) $( format(item.shortdescription) )
# for _, item in sortedpairs(_file.globalvars) do - + # end diff --git a/template/item.lua b/template/item.lua index 2faa026..5b88e6f 100644 --- a/template/item.lua +++ b/template/item.lua @@ -22,15 +22,15 @@ return # -- #if _item.type and (not typedef or typedef.tag ~= 'functiontypedef') then # --Show link only when available -# local link = fulllinkto(_item.type) +# local link = purelinkto(_item.type) # if link then $( link ) # else - $(prettyname(_item.type)) + $(purename(_item.type)) # end #end -$( prettyname(_item) ) +$( purename(_item) )
diff --git a/template/recordtypedef.lua b/template/recordtypedef.lua index c5722b1..97f7833 100644 --- a/template/recordtypedef.lua +++ b/template/recordtypedef.lua @@ -63,7 +63,7 @@ return [[#
- $( prettyname(calldef,_recordtypedef) ) + $( purename(calldef,_recordtypedef) )
From 56958452ec4db4db5fc2a032a5c2fe8c6d34404e Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 13:33:50 +0200 Subject: [PATCH 08/10] UTF-8 encoding in header. --- template/page.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/template/page.lua b/template/page.lua index d233efc..27f26a0 100644 --- a/template/page.lua +++ b/template/page.lua @@ -17,6 +17,7 @@ return # for _, header in ipairs(_page.headers) do $(header) # end + #end From 0bd3a3fc93940fb2b7ce52d54b65640b8d6a324f Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 13:36:15 +0200 Subject: [PATCH 09/10] Removed project file. --- .project | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .project diff --git a/.project b/.project deleted file mode 100644 index 0876484..0000000 --- a/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - luadocumentor - - - Penlight - - - - org.eclipse.dltk.core.scriptbuilder - - - - - - org.eclipse.ldt.nature - - From 9d8aef79ad3656014f644477a839ff478f93d625 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Wed, 23 May 2018 13:39:50 +0200 Subject: [PATCH 10/10] Documentation updates --- template/utils.lua | 3 ++- templateengine.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/template/utils.lua b/template/utils.lua index d777255..357552d 100644 --- a/template/utils.lua +++ b/template/utils.lua @@ -367,7 +367,8 @@ end -- Provide human readable overview from an API model element -- -- Resolve all element needed to summurize nicely an element form API model. --- @usage $ print( prettyname(item) ) +-- This element is not excaped. +-- @usage $ print( purename(item) ) -- module:somefunction(secondparameter) -- @function [parent = #docutils] -- @param apiobject Object form API model diff --git a/templateengine.lua b/templateengine.lua index 2d004a2..0f1bd00 100644 --- a/templateengine.lua +++ b/templateengine.lua @@ -86,7 +86,8 @@ local function format(string) end --- --- Provide a full link to an element using `prettyname` and `linkto`. +-- Provide a full link to an element using `purename` and `linkto`. +-- The purename is not escaped. -- Default implementation is for HTML. local function purelinkto(o,...) local ref = M.env.linkto(o,...)
$( fulllinkto(item) )$( purelinkto(item) ) $( format(item.shortdescription) )