Ver código fonte

:truck: Make the images relative to content folder

DricomDragon 1 ano atrás
pai
commit
ea249bb25e
2 arquivos alterados com 4 adições e 4 exclusões
  1. 1 1
      makefile
  2. 3 3
      src/templates/card.html

+ 1 - 1
makefile

@@ -23,7 +23,7 @@ DIST_EMB_FILES := $(EMBEDDED_FILES:src/%=$(DIST_DIR)/%)
 DIST_FILES := $(DIST_GEN_FILES) $(DIST_INC_FILES) $(DIST_DWN_FILES) $(DIST_EMB_FILES) $(DIST_DIR)/favicon.ico
 
 PANDOC_GEN := pandoc --standalone --wrap=none --template src/templates/main.html --metadata-file src/meta.yml
-LIST_GEN := yq eval-all '{"data": ., "link": filename | sub("meta.yml", "html") | sub("src", "")} as $$item ireduce ([]; . + $$item) | {"list": .}'
+LIST_GEN := yq eval-all '{"data": ., "target": {"content": filename | sub("meta.yml", "html") | sub(".*/", ""), "dir": filename | sub("$(DIR_OF_PROJECTS)/", "") | sub("/[^/]*.yml", "")}} as $$item ireduce ([]; . + $$item) | {"list": .}'
 
 # Build
 .PHONY: build

+ 3 - 3
src/templates/card.html

@@ -1,15 +1,15 @@
 <!-- Project card component -->
 <div class="card">
-    <img class="card-img-top" src="$it.data.title-img.path$"$if(it.title-img.alt)$ alt="$it.data.title-img.alt$"$endif$>
+    <img class="card-img-top" src="$it.target.dir$/$it.data.title-img.path$"$if(it.title-img.alt)$ alt="$it.data.title-img.alt$"$endif$>
     <div class="card-body">
         <h4 class="card-title">
-            <img src="$it.data.title-img.path$"$if(it.title-img.alt)$ alt="$it.data.title-img.alt$"$endif$>
+            <img src="$it.target.dir$/$it.data.title-img.path$"$if(it.title-img.alt)$ alt="$it.data.title-img.alt$"$endif$>
             $it.data.title$
         </h4>
         <p class="card-text">
             $it.data.content-description$
         </p>
-        <a href="$it.link$" class="btn btn-success btn-block">
+        <a href="$it.target.dir$/$it.target.content$" class="btn btn-success btn-block">
             Page du projet
         </a>
     </div>