Skip to content

Commit

Permalink
enhancments
Browse files Browse the repository at this point in the history
  • Loading branch information
22mahmoud committed Sep 18, 2023
1 parent 8882ef4 commit 10ee054
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
source = src
output = dist
bin = bin
tmp = .tmp
tmp_images = $(tmp)/images

md_files := $(shell find $(source) -name "*.md")
html_files := $(patsubst $(source)/%.md,$(output)/%.html,$(md_files))
Expand All @@ -9,7 +11,7 @@ thumb := $(bin)/thumb
rss := $(bin)/rss
sitemap := $(bin)/sitemap

install: html static dist/sitemap.xml dist/rss.xml
install: prepare html static dist/sitemap.xml dist/rss.xml

dev:
find src filters templates -type f | entr make install
Expand All @@ -34,4 +36,9 @@ static:
clean:
@rm -vrf $(output)

.PHONY: install html static clean
prepare:
@mkdir -p $(output)
@mkdir -p $(tmp_images)
@touch $(tmp_images)/.nomedia

.PHONY: install html static clean dev
7 changes: 3 additions & 4 deletions filters/img_filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ local function get_the_img(input_file, output_file, output_path)
return
end

-- 2. check if the output file existes on .tmp/images folder, if so, copy it to dist folder and return
-- 2. check if the output file existes on .tmp/images folder, if so, copy it to dist folder and return

-- replace / and . with _
-- replace / and . with _
local tmp_file = string.gsub(output_file, "/", "_")
tmp_file = string.gsub(tmp_file, "%.", "_")
tmp_file = ".tmp/images/" .. tmp_file
tmp_file = ".tmp/images/" .. "." .. tmp_file

if file_exists(tmp_file) then
os.execute("mkdir -p " .. output_path)
Expand All @@ -91,7 +91,6 @@ local function get_the_img(input_file, output_file, output_path)
end

function Image(img)
os.execute("mkdir -p .tmp/images")
img.attributes.loading = "lazy"

local absolute_path = remove_src_prefix(get_file_absolute_path(img.src))
Expand Down

0 comments on commit 10ee054

Please sign in to comment.