Skip to content

Commit 85db359

Browse files
committed
Updated comments.
1 parent bb603f1 commit 85db359

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/app.lua2p

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,9 @@ _G.scriptEnvironmentGlobals = {
623623
end,
624624

625625
validateUrls = function(urls)
626-
-- @Robustness: Should we restrict context here?
626+
-- @Robustness: Should we restrict context here? (I think not. 2021-05-01)
627627
local ok = true
628+
628629
for _, url in ipairs(urls) do
629630
if not urlExists(url) then
630631
timestampPrintError("URL is missing: %s", url)
@@ -1044,7 +1045,7 @@ local function buildWebsite()
10441045
_G.autoLockPages = getV("autoLockPages", false, "boolean")
10451046
_G.noTrailingSlash = getV("removeTrailingSlashFromPermalinks", false, "boolean") -- @Doc? @Hack? Also, this affects page.url too now. 2021-04-28
10461047

1047-
_G.redirectionLayout = getV("redirectionLayout", redirectionLayout, "string") -- @Doc
1048+
_G.redirectionLayout = getV("redirectionLayout", redirectionLayout, "string")
10481049

10491050
for k in pairs(config) do
10501051
timestampPrintWarning("Unknown config field '%s'.", k)
@@ -1527,7 +1528,7 @@ if autobuild then
15271528
end
15281529
end
15291530

1530-
if somethingChanged then buildWebsite() end -- @UX: Should we pcall this?
1531+
if somethingChanged then buildWebsite() end -- @UX: Should we pcall this? Probably!
15311532

15321533
if configChanged then
15331534
-- Recheck everything in case config.ignore* changed.

src/functions.lua2p

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ do
428428
blockContents:find!("^ *for%s+"..PATTERN_IDENT.."%s*[,=]") or
429429
blockContents:find!("^ *for%s+"..PATTERN_IDENT.."%s+in"..PATTERN_IDENT_END)
430430
then
431-
table.insert(out, blockContents) -- @Robustness: Surround value in parenthesis.
431+
table.insert(out, blockContents) -- @Robustness: Surround value in parenthesis, when possible.
432432
table.insert(out, " do ")
433433

434434
!!(TRIM_POS_AFTER_BLOCK)
@@ -684,8 +684,8 @@ do
684684
if not ok then error(errObj) end
685685

686686
local templateResult = (table.concat(ctx.out)
687-
:gsub("[ \t]+\n", "\n" ) -- :Beautify
688-
:gsub("\n\n\n+", "\n\n") -- :Beautify @UX Not sure if this line is actually good.
687+
:gsub("[ \t]+\n", "\n" ) -- :Beautify spaces at the end of lines.
688+
:gsub("\n\n\n+", "\n\n") -- :Beautify empty lines. @Robustness: Not sure this is actually good. Might mess up <pre> tag contents.
689689
)
690690

691691
return templateResult
@@ -774,15 +774,7 @@ end
774774

775775

776776
function _G.getLineNumber(s, pos)
777-
local lineCount = 1
778-
for posCurrent in s:gmatch"()\n" do -- @Speed
779-
if posCurrent < pos then
780-
lineCount = lineCount+1
781-
else
782-
break
783-
end
784-
end
785-
return lineCount
777+
return 1 + countSubStrings(s, 1, pos-1, "\n", true)
786778
end
787779

788780

@@ -1906,7 +1898,7 @@ do
19061898
local modTimeThumb = lfs.attributes(DIR_OUTPUT.."/"..pathThumbOutputRel, "modification")
19071899

19081900
if modTimeImage and modTimeImage == modTimeThumb and not ignoreModificationTimes then
1909-
-- @Note: This will bypass any file processor for JPG files. Not sure if OK. 2018-06-30
1901+
-- Note: This will bypass any file processor for JPG files. Not sure if OK. 2018-06-30 @Consistency
19101902
preserveExistingOutputFile("raw", pathThumbRel, "/"..pathThumbRel, pathImageRel)
19111903

19121904
else
@@ -2427,7 +2419,7 @@ function _G.cleanupPath(someKindOfPath)
24272419

24282420
repeat
24292421
local count
2430-
path, count = path:gsub("/[^/]+/%.%./", "/", 1) -- Not completely fool proof! @Robustness
2422+
path, count = path:gsub("/[^/]+/%.%./", "/", 1) -- Not completely fool proof! We may need to properly parse the path, I think. @Robustness
24312423
until count == 0
24322424

24332425
return path
@@ -2561,7 +2553,7 @@ do
25612553
socket.sleep(duration)
25622554
else
25632555
local endTime = getTimeBetter() + duration
2564-
repeat until getTimeBetter() >= endTime -- @Incomplete: Do something to waste time?
2556+
repeat until getTimeBetter() >= endTime -- Should we do some better operation to waste time?
25652557
end
25662558
end
25672559
end

0 commit comments

Comments
 (0)