浏览代码

:wrench: Explicit source file in aggregated list

DricomDragon 1 年之前
父节点
当前提交
bea6a9fd6b
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 1 1
      makefile
  2. 4 4
      src/templates/card.html

+ 1 - 1
makefile

@@ -22,7 +22,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 '. as $$item ireduce ([]; . + $$item ) | {"list": .}'
+LIST_GEN := yq eval-all '{"data": ., "source": filename} as $$item ireduce ([]; . + $$item) | {"list": .}'
 
 # Build
 .PHONY: build

+ 4 - 4
src/templates/card.html

@@ -1,13 +1,13 @@
 <!-- Project card component -->
 <div class="card">
-    <img class="card-img-top" src="$it.title-img.path$"$if(it.title-img.alt)$ alt="$it.title-img.alt$"$endif$>
+    <img class="card-img-top" src="$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.title-img.path$"$if(it.title-img.alt)$ alt="$it.title-img.alt$"$endif$>
-            $it.title$
+            <img src="$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.content-description$
+            $it.data.content-description$
         </p>
         <a href="todo" class="btn btn-success btn-block">
             Page du projet