Skip to content

Commit

Permalink
Fixed bug at page_base
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Nov 28, 2018
1 parent 06b065f commit 8a2cd77
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
7 changes: 7 additions & 0 deletions docs/Sakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ JQTFLAGS += -5 --toc-depth=4
# experimental
########################################################################

print-%: ; @echo $* = $($*)

depend: $(Meta)/phase3d.make
cat $< | egrep -v '^#|^$$' | cut -c -72 - | sed 's/$$/.../'

# TODO: new, help, man page, SITE section on web, taxonomies (flags, series...)
# TODO: enhance `dag` command
# TODO: -t -W -B

# TODO: show content pending to render?
#newer: $(Meta)/lastbuild
Expand Down
10 changes: 7 additions & 3 deletions share/sake.d/phase2.make
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ $(PagesJSON): $(Meta)/config.json $(MDIR)/phase2_page.jq $(THIS) \
# Content example for `$(Meta)/phase2.make`:

# __phase_2 := 1
# destination_paths := _site/jqt/ _site/jqt/blog/
#
# destination_paths := _site/ _site/blog/
# metadata_paths := .meta/pages/ .meta/pages/blog/
#
# data_md := .meta/snippets.json
# data_yaml :=
# data_json :=
# data_csv :=
# PagesHTML := _site/jqt/content.html _site/jqt/blog/2017-04-13-hello.html _site/jqt/blog/index.html
# PagesJSON := .meta/pages/content.json .meta/pages/blog/2017-04-13-hello.json .meta/pages/blog/index.json
#
# PagesHTML := _site/content.html _site/data.html _site/index.html _site/engine.html _site/structure.html _site/blog/2017-04-13-hello.html _site/blog/index.html
# PagesJSON := .meta/pages/content.json .meta/pages/data.json .meta/pages/index.json .meta/pages/engine.json .meta/pages/structure.json .meta/pages/blog/2017-04-13-hello.json .meta/pages/blog/index.json
#
# .meta/pages/content.json: content/content.md
# $(info ==> $@)
# @$(EXTRACT_FRONT_MATTER) < $< | $(BUILD_PAGE_JSON) > $@
Expand Down
7 changes: 3 additions & 4 deletions share/sake.d/phase2_page.jq
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ def notdir:
sub("^.*/"; "")
;

# `$(Meta)/pages/path/to/page.json` => `(../)+`
# BUG! No usar Meta en input!!!
# `$(Content)/path/to/page.md` => `(../)+`
def page_base:
# . as $target
("../" * (((. / "/") | length) - 3)) // ""
$Source
| ("../" * (((. / "/") | length) - 2)) // ""
;

# `$(Meta)/pages/path/to/page.json` => `path/to/page`
Expand Down
19 changes: 12 additions & 7 deletions share/sake.d/phase3.make
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ $(Meta)/phase3_json.json: $(SCRIPT) $(THIS)
--from-file $(MDIR)/phase3_json.jq \
> $@

$(Meta)/phase3d.make: $(Meta)/pages-by-id.json $(Meta)/phase3_json.json $(SCRIPT) $(THIS)
$(Meta)/phase3.make: $(SUPER) $(THIS)
$(Meta)/phase3d.make: $(Meta)/pages-by-id.json $(Meta)/phase3_json.json $(SCRIPT)
$(info ==> $@)
jq --raw-output \
--arg Layouts $(Layouts) \
Expand Down Expand Up @@ -80,16 +81,20 @@ $(PagesHTML): $(Meta)/phase3.make \
# Content example for `$(Meta)/phase3.make`:

# __phase_3 := 1
# _site/jqt/index.html: content/index.md content/macros.m content/LINKS.txt content/EXAMPLE.txt .meta/snippets.json
#
# %.html: _site/%.html ;
# blog/%.html: _site/blog/%.html ;
#
# _site/content.html: content/content.md content/macros.m content/LINKS.txt content/FLOW.txt content/opt/[4DdiT].txt .meta/snippets.json
# $(info ==> $@)
# @$(JQT) -d $< -mpage:.meta/pages/index.json layouts/page.html | $(DETAILS) > $@
# @$(JQT) -d $< -msnippets:.meta/snippets.json -mpage:.meta/pages/content.json $(Layouts)/page-toc.html | $(DETAILS) > $@
# ...
# _site/jqt/blog/2017-04-13-hello.html: content/blog/2017-04-13-hello.md .meta/snippets.json
# _site/blog/2017-04-13-hello.html: content/blog/2017-04-13-hello.md content/macros.m content/LINKS.txt .meta/snippets.json
# $(info ==> $@)
# @$(JQT) -d $< -mpage:.meta/pages/blog/2017-04-13-hello.json layouts/page.html | $(DETAILS) > $@
# _site/jqt/blog/index.html: content/blog/index.md .meta/snippets.json
# @$(JQT) -d $< -msnippets:.meta/snippets.json -mpage:.meta/pages/blog/2017-04-13-hello.json $(Layouts)/page.html | $(DETAILS) > $@
# _site/blog/index.html: content/blog/index.md content/macros.m content/LINKS.txt .meta/snippets.json
# $(info ==> $@)
# @$(JQT) -d $< -mpage:.meta/pages/blog/index.json layouts/blog.html | $(DETAILS) > $@
# @$(JQT) -d $< -msnippets:.meta/snippets.json -mpage:.meta/pages/blog/index.json $(Layouts)/blog.html | $(DETAILS) > $@

endif # __phase_3

Expand Down

0 comments on commit 8a2cd77

Please sign in to comment.