Skip to content

Commit 5480582

Browse files
committed
Fixed --fullpaths not always showing correct paths.
Added links to website. Updated changelog.
1 parent 25e4351 commit 5480582

File tree

7 files changed

+42
-26
lines changed

7 files changed

+42
-26
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CSS files can also include code.
2222
- [Windows](#windows)
2323
- [Universal](#universal)
2424
- [Build Website](#build-website)
25-
- [Documentation](https://github.com/ReFreezed/LuaWebGen/wiki)
25+
- [Documentation](http://luawebgen.refreezed.com/docs/)
2626

2727

2828

@@ -80,6 +80,8 @@ Page layout template, `page.html`:
8080
{{ include"footer" }}
8181
```
8282

83+
See more examples in the [examples folder](https://github.com/ReFreezed/LuaWebGen/tree/master/examples).
84+
8385

8486

8587
## Installation / Usage
@@ -134,7 +136,7 @@ lua path/to/webgen.lua command [options]
134136
### Build Website
135137

136138
To generate a new empty website, run something like this from the
137-
[command line](https://github.com/ReFreezed/LuaWebGen/wiki/Command-Line):
139+
[command line](http://luawebgen.refreezed.com/docs/command-line/):
138140

139141
```batch
140142
webgen new site "my-website"
@@ -143,7 +145,7 @@ webgen new page "blog/first-post.md"
143145
webgen build
144146
```
145147

146-
LuaWebGen uses this [folder structure](https://github.com/ReFreezed/LuaWebGen/wiki/Home#folder-structure) for a website project:
148+
LuaWebGen uses this [folder structure](http://luawebgen.refreezed.com/docs/#folder-structure) for a website project:
147149

148150
```
149151
my-website/ -- Root of the website project.
@@ -159,6 +161,6 @@ my-website/ -- Root of the website project.
159161

160162
Everything in the *content* folder will be processed and end up in the *output* folder.
161163

162-
See the [wiki](https://github.com/ReFreezed/LuaWebGen/wiki) for the full documentation.
164+
See the [website](http://luawebgen.refreezed.com/docs/) for the full documentation.
163165

164166

build/Changelog.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Changelog
22
LuaWebGen
33

4+
v1.4 (2021-06-01)
5+
- Added syntax for heredoc strings.
6+
- Added functions: percent(), urlRaw().
7+
- Added options: --baseurloverride, --meta, --fullpaths, --nogc.
8+
- Added better example sites.
9+
- Better support for when baseUrl is pointing to a subdirectory. (url(), {{url}} and other related code now fixes relative paths.)
10+
- include() can now take take extra arguments for the target layout to receive.
11+
- A warning is printed when page.date hasn't been updated for a page (except for index and special pages).
12+
- Much faster getImageDimensions() for most images.
13+
- Fixed "#" in redirection targets getting messed up and messing other stuff up.
14+
- Fixed config.rewriteOutputPath() sometimes having the wrong context.
15+
- Fixed a couple of error messages missing some information.
16+
417
v1.3.1 (2021-05-25)
518
- Fixed non-page templates not getting processed before pages.
619
- Added minimal example site.

build/README.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
LuaWebGen
22
Developed by Marcus 'ReFreezed' Thunström
33

4-
Website: https://github.com/ReFreezed/LuaWebGen
5-
Documentation: https://github.com/ReFreezed/LuaWebGen/wiki
4+
Website: http://luawebgen.refreezed.com/
5+
Documentation: http://luawebgen.refreezed.com/docs/
6+
Repository: https://github.com/ReFreezed/LuaWebGen
67

78
1. Disclaimer
89
2. Installation / Usage
@@ -98,8 +99,8 @@ Everything in the 'content' folder will be processed and end up in the
9899
(Note: The 'output' folder is automatically cleaned from files and folders that
99100
do not exist in the 'content' folder, so don't save files in the 'output' folder!)
100101

101-
See the wiki for the full documentation:
102-
https://github.com/ReFreezed/LuaWebGen/wiki
102+
See the website for the full documentation:
103+
http://luawebgen.refreezed.com/docs/
103104

104105

105106

@@ -140,6 +141,8 @@ Page layout template, page.html:
140141

141142
{{include"footer"}}
142143

144+
See more examples in the [repository](https://github.com/ReFreezed/LuaWebGen/tree/master/examples).
145+
143146

144147

145148
==============================================================================

build/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.1
1+
1.4.0

examples/testsite/layouts/header.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
{{ site.title }}
1313
</title>
1414

15-
<link rel="canonical" href="{{ page.permalink }}">
15+
<link rel="canonical" href="{{ url(page.permalink) }}">
1616

17-
<link rel="alternate" type="application/rss+xml" href="{{ site.baseUrl.."feed.rss" }}" title="{{ site.title }}">
17+
<link rel="alternate" type="application/rss+xml" href="{{ url(site.baseUrl.."feed.rss") }}" title="{{ site.title }}">
1818

1919
<link rel="stylesheet" href="{{ /css/style.css }}">
2020

src/app.lua2p

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,17 +311,17 @@ local function setup()
311311
elseif arg == "--verbose" then
312312
_G.verbosePrint = true
313313

314-
elseif arg == "--meta" then -- @Doc?
314+
elseif arg == "--meta" then
315315
_G.outputMetaprograms = true
316316

317-
elseif arg == "--nogc" then -- @Doc?
317+
elseif arg == "--nogc" then
318318
_G.enableGc = false
319319
collectgarbage("stop")
320320

321-
elseif arg == "--fullpaths" then -- @Doc?
321+
elseif arg == "--fullpaths" then
322322
_G.useFullPaths = true
323323

324-
elseif arg == "--baseurloverride" then -- @Doc?
324+
elseif arg == "--baseurloverride" then
325325
i = i + 1
326326
_G.baseUrlOverride = programArguments[i] or errorNoPos("[Arguments] Missing URL after '%s'.", argRaw)
327327
arg = arg .. '"' .. baseUrlOverride .. '"'
@@ -1072,7 +1072,7 @@ local function setup()
10721072
scriptEnvironmentGlobals.echoRaw(s:format(...))
10731073
end,
10741074

1075-
include = function(htmlFileBasename, ...) -- @Doc: Extra arguments.
1075+
include = function(htmlFileBasename, ...)
10761076
assertContext("template", "include")
10771077
if htmlFileBasename:find"^/" then
10781078
errorf(2, "Filename is not valid: %s", htmlFileBasename)

src/functions.lua2p

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ do
830830
-- stringResult = parseAndRunTemplate( page, path, template, fileType=fromPage, useCache, onPageInit=nil, packedArguments=nil )
831831
-- onPageInit = function( wrappedPage )
832832
function _G.parseAndRunTemplate(page, path, template, fileType, useCache, onPageInit, args)
833-
-- timestampPrintVerbose("--> Template(start): %s", maybeFullPath(path))
834833
local result
835834

836835
if template == "" and not onPageInit then
@@ -864,7 +863,6 @@ do
864863
end
865864
end
866865

867-
-- timestampPrintVerbose("--> Template(finish): %s", maybeFullPath(path))
868866
return result
869867
end
870868

@@ -991,7 +989,7 @@ function _G.writeOutputFile(category, pathRel, url, data, modTime, sourcePath)
991989
if site._fileProcessors[extLower] then
992990
!PUSH_CONTEXT "none"
993991
local sourceSitePathRel = (sourcePath ~= "") and pathToSitePath(sourcePath) or ""
994-
data = site._fileProcessors[extLower](data, sourceSitePathRel) -- @Doc sourceSitePathRel?
992+
data = site._fileProcessors[extLower](data, sourceSitePathRel)
995993
!POP_CONTEXT()
996994

997995
if type(data) ~= "string" then
@@ -1901,10 +1899,10 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit)
19011899
local pathRelOut = page._pathOut
19021900

19031901
if page._isGenerated then
1904-
errorf(2, "Page has already generated. (%s)", maybeFullPath(pathRel))
1902+
errorf(2, "Page has already generated. (%s)", maybeFullPath(page._contentRealPath))
19051903
end
19061904
if page._isGenerating or site._pagesGenerating[pathRelOut] then
1907-
errorf(2, "Recursive page generation detected. (You may want to call lock() in '%s')", maybeFullPath(pathRel))
1905+
errorf(2, "Recursive page generation detected. (You may want to call lock() in '%s')", maybeFullPath(page._contentRealPath))
19081906
end
19091907

19101908
page._isGenerating = true
@@ -1914,7 +1912,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit)
19141912
local ext = getExtension(filename)
19151913
local extLower = ext:lower()
19161914

1917-
timestampPrintVerbose("--> Processing(start): %s", maybeFullPath(pathRel))
1915+
timestampPrintVerbose("--> Processing(start): %s", maybeFullPath(page._contentRealPath))
19181916
local result
19191917

19201918
if page.isPage.v then
@@ -1927,7 +1925,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit)
19271925
(page.isDraft.v and not includeDrafts ) or -- Is draft?
19281926
(datetimeToTime(page.publishDate:g()) > nowTime) -- Is in future?
19291927
then
1930-
timestampPrintVerbose("--> Processing(abort): %s", maybeFullPath(pathRel))
1928+
timestampPrintVerbose("--> Processing(abort): %s", maybeFullPath(page._contentRealPath))
19311929

19321930
page._isSkipped = true
19331931
site._outputFileSkippedPageCount = site._outputFileSkippedPageCount + 1
@@ -1939,7 +1937,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit)
19391937

19401938
if not (page.isIndex.v or page.isSpecial.v) and not page._dateHasBeenUpdated then
19411939
-- @UX: Should there be an option to disable this? Maybe an option for suppressing all warnings?
1942-
timestampPrintWarning("%s did not update page.date.", maybeFullPath(pathRel))
1940+
timestampPrintWarning("%s did not update page.date.", maybeFullPath(page._contentRealPath))
19431941
end
19441942

19451943
page.content.v = pageContent
@@ -1959,7 +1957,7 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit)
19591957
result = parseAndRunTemplate(page, page._contentRealPath, template, nil, false, onPageInit, nil)
19601958
end
19611959

1962-
timestampPrintVerbose("--> Processing(finish): %s", maybeFullPath(pathRel))
1960+
timestampPrintVerbose("--> Processing(finish): %s", maybeFullPath(page._contentRealPath))
19631961

19641962
writeOutputFile(page._category, pathRelOut, page.url.v, result, modTime, pathRel)
19651963
page._isGenerated = true
@@ -2129,7 +2127,7 @@ function _G.getLayoutTemplate(page)
21292127

21302128
local template, err = getFileContentsText(path)
21312129
if not template then
2132-
errorf("%s: Could not load layout '%s'. (%s)", maybeFullPath(page._path), page.layout.v, err)
2130+
errorf("%s: Could not load layout '%s'. (%s)", maybeFullPath(page._contentRealPath), page.layout.v, err)
21332131
end
21342132

21352133
site._layoutTemplates[path] = template

0 commit comments

Comments
 (0)