-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,51 @@ | ||
# phase3.jq --arg Metadata $(Metadata) --arg Layouts $(Layouts) --arg Destination $(Destination) | ||
# | ||
# Generate phase3.make from pages.json | ||
# phase3.jq | ||
# --arg Metadata $(Metadata) | ||
# --arg Layouts $(Layouts) | ||
# --arg Destination $(Destination) | ||
# < $(Metadata)/pages-by-id.json > $(Metadata)/phase3.make | ||
|
||
def comment: | ||
"# vim:syntax=make" | ||
; | ||
def comment: "# vim:syntax=make"; | ||
|
||
def use: | ||
if .use | ||
then " "+(.use | join(" ")) | ||
then " " + (.use | join(" ")) | ||
else "" end | ||
; | ||
|
||
def flags: | ||
if .flags | ||
then .flags | join(" ") | ||
then " " + (.flags | join(" ")) | ||
else "" end | ||
; | ||
|
||
def layout: | ||
" " + $Layouts + "/" + .layout + ".html" | ||
; | ||
|
||
def data: | ||
if .data | ||
then .data | map("-m\(.):$(Metadata)/snippets.json") | join(" ") | ||
then " " + (.data | map("-m\(.):$(Metadata)/snippets.json") | join(" ")) | ||
else "" end | ||
; | ||
|
||
######################################################################## | ||
|
||
def page: | ||
" -mpage:" + $Metadata + "/pages/" + .id + ".json" | ||
; | ||
|
||
# makefile rule for HTML page | ||
def page_rule: | ||
$Destination+"/"+.url+": " + .source + " " + layout + use, | ||
"\t$(info ==> $@)", | ||
"\t@$(JQT) -d $< " + data + flags + page + layout + " | $(DETAILS) > $@" | ||
; | ||
|
||
# | ||
# Output makefile | ||
######################################################################## | ||
# | ||
|
||
"__phase_3 := 1", | ||
(.[] | ( # for each page | ||
$Destination+"/"+.url+": "+.source+" "+$Layouts+"/"+.layout+".html"+use, | ||
"\t$(info ==> $@)", | ||
"\t@$(JQT) "+data+" "+flags+" -mpage:"+$Metadata+"/pages/"+.id+".json -d $< "+$Layouts+"/"+.layout+".html | $(DETAILS) > $@" | ||
) | ||
), | ||
(.[] | page_rule), # for each page | ||
comment | ||
|
||
# vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=jq |