diff --git a/README.md b/README.md index d34953e..0e417d3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ CSS files can also include code. - [Windows](#windows) - [Universal](#universal) - [Build Website](#build-website) -- [Documentation](https://github.com/ReFreezed/LuaWebGen/wiki) +- [Documentation](http://luawebgen.refreezed.com/docs/) @@ -80,6 +80,8 @@ Page layout template, `page.html`: {{ include"footer" }} ``` +See more examples in the [examples folder](https://github.com/ReFreezed/LuaWebGen/tree/master/examples). + ## Installation / Usage @@ -134,7 +136,7 @@ lua path/to/webgen.lua command [options] ### Build Website To generate a new empty website, run something like this from the -[command line](https://github.com/ReFreezed/LuaWebGen/wiki/Command-Line): +[command line](http://luawebgen.refreezed.com/docs/command-line/): ```batch webgen new site "my-website" @@ -143,7 +145,7 @@ webgen new page "blog/first-post.md" webgen build ``` -LuaWebGen uses this [folder structure](https://github.com/ReFreezed/LuaWebGen/wiki/Home#folder-structure) for a website project: +LuaWebGen uses this [folder structure](http://luawebgen.refreezed.com/docs/#folder-structure) for a website project: ``` my-website/ -- Root of the website project. @@ -159,6 +161,6 @@ my-website/ -- Root of the website project. Everything in the *content* folder will be processed and end up in the *output* folder. -See the [wiki](https://github.com/ReFreezed/LuaWebGen/wiki) for the full documentation. +See the [website](http://luawebgen.refreezed.com/docs/) for the full documentation. diff --git a/build/Changelog.txt b/build/Changelog.txt index f33a16d..de1ae01 100644 --- a/build/Changelog.txt +++ b/build/Changelog.txt @@ -1,6 +1,19 @@ Changelog LuaWebGen +v1.4 (2021-06-01) +- Added syntax for heredoc strings. +- Added functions: percent(), urlRaw(). +- Added options: --baseurloverride, --meta, --fullpaths, --nogc. +- Added better example sites. +- Better support for when baseUrl is pointing to a subdirectory. (url(), {{url}} and other related code now fixes relative paths.) +- include() can now take take extra arguments for the target layout to receive. +- A warning is printed when page.date hasn't been updated for a page (except for index and special pages). +- Much faster getImageDimensions() for most images. +- Fixed "#" in redirection targets getting messed up and messing other stuff up. +- Fixed config.rewriteOutputPath() sometimes having the wrong context. +- Fixed a couple of error messages missing some information. + v1.3.1 (2021-05-25) - Fixed non-page templates not getting processed before pages. - Added minimal example site. diff --git a/build/README.txt b/build/README.txt index 67638c5..1a288b4 100644 --- a/build/README.txt +++ b/build/README.txt @@ -1,8 +1,9 @@ LuaWebGen Developed by Marcus 'ReFreezed' Thunström -Website: https://github.com/ReFreezed/LuaWebGen -Documentation: https://github.com/ReFreezed/LuaWebGen/wiki +Website: http://luawebgen.refreezed.com/ +Documentation: http://luawebgen.refreezed.com/docs/ +Repository: https://github.com/ReFreezed/LuaWebGen 1. Disclaimer 2. Installation / Usage @@ -98,8 +99,8 @@ Everything in the 'content' folder will be processed and end up in the (Note: The 'output' folder is automatically cleaned from files and folders that do not exist in the 'content' folder, so don't save files in the 'output' folder!) -See the wiki for the full documentation: -https://github.com/ReFreezed/LuaWebGen/wiki +See the website for the full documentation: +http://luawebgen.refreezed.com/docs/ @@ -140,6 +141,8 @@ Page layout template, page.html: {{include"footer"}} +See more examples in the [repository](https://github.com/ReFreezed/LuaWebGen/tree/master/examples). + ============================================================================== diff --git a/build/version.txt b/build/version.txt index 6261a05..e21e727 100644 --- a/build/version.txt +++ b/build/version.txt @@ -1 +1 @@ -1.3.1 \ No newline at end of file +1.4.0 \ No newline at end of file diff --git a/examples/testsite/layouts/header.html b/examples/testsite/layouts/header.html index da49487..d19e1c3 100644 --- a/examples/testsite/layouts/header.html +++ b/examples/testsite/layouts/header.html @@ -12,9 +12,9 @@ {{ site.title }} - + - + diff --git a/src/app.lua2p b/src/app.lua2p index cdb6fd5..52588cc 100644 --- a/src/app.lua2p +++ b/src/app.lua2p @@ -311,17 +311,17 @@ local function setup() elseif arg == "--verbose" then _G.verbosePrint = true - elseif arg == "--meta" then -- @Doc? + elseif arg == "--meta" then _G.outputMetaprograms = true - elseif arg == "--nogc" then -- @Doc? + elseif arg == "--nogc" then _G.enableGc = false collectgarbage("stop") - elseif arg == "--fullpaths" then -- @Doc? + elseif arg == "--fullpaths" then _G.useFullPaths = true - elseif arg == "--baseurloverride" then -- @Doc? + elseif arg == "--baseurloverride" then i = i + 1 _G.baseUrlOverride = programArguments[i] or errorNoPos("[Arguments] Missing URL after '%s'.", argRaw) arg = arg .. '"' .. baseUrlOverride .. '"' @@ -1072,7 +1072,7 @@ local function setup() scriptEnvironmentGlobals.echoRaw(s:format(...)) end, - include = function(htmlFileBasename, ...) -- @Doc: Extra arguments. + include = function(htmlFileBasename, ...) assertContext("template", "include") if htmlFileBasename:find"^/" then errorf(2, "Filename is not valid: %s", htmlFileBasename) diff --git a/src/functions.lua2p b/src/functions.lua2p index 2eadd32..9da76ca 100644 --- a/src/functions.lua2p +++ b/src/functions.lua2p @@ -830,7 +830,6 @@ do -- stringResult = parseAndRunTemplate( page, path, template, fileType=fromPage, useCache, onPageInit=nil, packedArguments=nil ) -- onPageInit = function( wrappedPage ) function _G.parseAndRunTemplate(page, path, template, fileType, useCache, onPageInit, args) - -- timestampPrintVerbose("--> Template(start): %s", maybeFullPath(path)) local result if template == "" and not onPageInit then @@ -864,7 +863,6 @@ do end end - -- timestampPrintVerbose("--> Template(finish): %s", maybeFullPath(path)) return result end @@ -991,7 +989,7 @@ function _G.writeOutputFile(category, pathRel, url, data, modTime, sourcePath) if site._fileProcessors[extLower] then !PUSH_CONTEXT "none" local sourceSitePathRel = (sourcePath ~= "") and pathToSitePath(sourcePath) or "" - data = site._fileProcessors[extLower](data, sourceSitePathRel) -- @Doc sourceSitePathRel? + data = site._fileProcessors[extLower](data, sourceSitePathRel) !POP_CONTEXT() if type(data) ~= "string" then @@ -1901,10 +1899,10 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit) local pathRelOut = page._pathOut if page._isGenerated then - errorf(2, "Page has already generated. (%s)", maybeFullPath(pathRel)) + errorf(2, "Page has already generated. (%s)", maybeFullPath(page._contentRealPath)) end if page._isGenerating or site._pagesGenerating[pathRelOut] then - errorf(2, "Recursive page generation detected. (You may want to call lock() in '%s')", maybeFullPath(pathRel)) + errorf(2, "Recursive page generation detected. (You may want to call lock() in '%s')", maybeFullPath(page._contentRealPath)) end page._isGenerating = true @@ -1914,7 +1912,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit) local ext = getExtension(filename) local extLower = ext:lower() - timestampPrintVerbose("--> Processing(start): %s", maybeFullPath(pathRel)) + timestampPrintVerbose("--> Processing(start): %s", maybeFullPath(page._contentRealPath)) local result if page.isPage.v then @@ -1927,7 +1925,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit) (page.isDraft.v and not includeDrafts ) or -- Is draft? (datetimeToTime(page.publishDate:g()) > nowTime) -- Is in future? then - timestampPrintVerbose("--> Processing(abort): %s", maybeFullPath(pathRel)) + timestampPrintVerbose("--> Processing(abort): %s", maybeFullPath(page._contentRealPath)) page._isSkipped = true site._outputFileSkippedPageCount = site._outputFileSkippedPageCount + 1 @@ -1939,7 +1937,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit) if not (page.isIndex.v or page.isSpecial.v) and not page._dateHasBeenUpdated then -- @UX: Should there be an option to disable this? Maybe an option for suppressing all warnings? - timestampPrintWarning("%s did not update page.date.", maybeFullPath(pathRel)) + timestampPrintWarning("%s did not update page.date.", maybeFullPath(page._contentRealPath)) end page.content.v = pageContent @@ -1959,7 +1957,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit) result = parseAndRunTemplate(page, page._contentRealPath, template, nil, false, onPageInit, nil) end - timestampPrintVerbose("--> Processing(finish): %s", maybeFullPath(pathRel)) + timestampPrintVerbose("--> Processing(finish): %s", maybeFullPath(page._contentRealPath)) writeOutputFile(page._category, pathRelOut, page.url.v, result, modTime, pathRel) page._isGenerated = true @@ -2129,7 +2127,7 @@ function _G.getLayoutTemplate(page) local template, err = getFileContentsText(path) if not template then - errorf("%s: Could not load layout '%s'. (%s)", maybeFullPath(page._path), page.layout.v, err) + errorf("%s: Could not load layout '%s'. (%s)", maybeFullPath(page._contentRealPath), page.layout.v, err) end site._layoutTemplates[path] = template