Skip to content

Commit

Permalink
Generated sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Apr 10, 2017
1 parent 26415b7 commit ed49a91
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 96 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# cache
/docs/.yummy
/docs/.meta
# experiments
/docs/content/xxx*
/docs/content/yyy*
# built site
/docs/_site
# man pages
jqt.1.gz
# other
Expand Down
7 changes: 7 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.log
*.bak
*.swp
/.meta/
/_site/
/content/xxx*
/content/yyy*
109 changes: 70 additions & 39 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Version := $(shell cat ../VERSION)
# Metadata directory
Metadata := .meta

# Do not build to clobber immediately
ifeq (clobber,$(MAKECMDGOALS))
ifeq (,$(wildcard $(Metadata)))
$(error Nothing to clobber)
endif
endif

# ======================================================================
-include $(Metadata)/globals.make
#
Expand All @@ -35,18 +42,17 @@ Metadata := .meta
# ======================================================================
include make.d/config.make
#
# Build files derived from user defined configuration.
# Build files derived from user defined configuration:
# config.{yaml,json} => config.json => site.json => globals.make
#
# Imported variables:
# Metadata
# Version
# Exported targets:
# Exported rules for:
# $(Metadata)
# $(Metadata)/config.json
# $(Metadata)/site.json
# $(Metadata)/globals.make
# Order of dependencies:
# config.{yaml,json} => config.json => site.json => globals.make
# ======================================================================

# Warning:
Expand Down Expand Up @@ -74,13 +80,14 @@ include make.d/pathnames.make
# NodesJSON
# Pages
# PagesJSON
# Exported targets:
# Exported rules for:
# $(Destination)
# all
# all paths starting at $(Destination) and $(Metadata)
# $(Destination)/.../
# $(Metadata)/.../
# all:: $(Pages)
# Additional dependencies defined:
# $(Destination)/.../page.html => $(Metadata)/pages/.../page.json
# $(Destination)/.../node/index.html => $(Metadata)/nodes/.../node.json
# $(Destination)/.../section/index.html => $(Metadata)/nodes/.../section.json
# ======================================================================

# ======================================================================
Expand All @@ -91,9 +98,9 @@ include make.d/front-matter.make
# Imported variables:
# Content
# Metadata
# Exported targets:
# Exported rules for:
# $(Metadata)/pages/.../page.json
# $(Metadata)/nodes/.../node.json
# $(Metadata)/nodes/.../section.json
# $(Metadata)/pages.json
# $(Metadata)/nodes.json
# $(Metadata)/sections.json
Expand All @@ -103,59 +110,55 @@ include make.d/front-matter.make
-include $(Metadata)/html.make
#
# Load rules for pages and nodes. If not exists is built when restarting with
# rule defined in `rules.make`.
# rule defined in `pages.make`.
#
# Exported variables:
# __html__
# Exported targets:
# Exported rules for:
# rules for all HTML files
# ======================================================================

ifdef __html__

# Options for `jqt`.
JQTFLAGS = \
-5 \
-I./ \
-iblocks/filters \
-msite:$(Metadata)/config.json \
-msnippets:$(Metadata)/snippets.json \
--toc-depth=4 \
# Options for `jqt`. To be extended in the site specific section.
JQTFLAGS = \
-I./ \
-msite:$(Metadata)/config.json \

endif

# ======================================================================
include make.d/rules.make
include make.d/pages.make
#
# Define rules for HTML pages and nodes.
# Define standard rules and rules for HTML pages and nodes.
#
# Imported variables:
# Assets
# Destination
# JQTFLAGS
# Layouts
# Metadata
# Exported targets:
# JQTFLAGS
# Exported rules for:
# $(Metadata)/html.make
# all
# all:: # assets
# build
# clean
# clobber
# clean::
# clobber::
# xbuild
# xxbuild
# ======================================================================

# ======================================================================
include make.d/tools.make
#
# Tools independent of any target.
include make.d/sitemap.make
#
# Define rules for sitemap.
#
# Parameters:
# vnudir
# Imported variables:
# Destination
# Exported targets:
# help
# valid
# lint
# Metadata
# Exported rules for:
# $(Destination)/sitemap.*
# all:: $(Destination)/sitemap.*
# ======================================================================

# ======================================================================
Expand All @@ -167,15 +170,39 @@ include make.d/styles.make
# Destination
# Blocks
# Styles
# Exported targets:
# Exported rules for:
# $(Destination)/styles.css
# all
# all:: $(Destination)/styles.css
# ======================================================================

# ======================================================================
include make.d/tools.make
#
# Tools independent of any target.
#
# Parameters:
# vnudir
# Imported variables:
# Destination
# Exported rules for:
# help
# valid
# lint
# ======================================================================

########################################################################
# Specific rules this web site
# Specific rules for this web site
########################################################################

ifdef __html__

# Options for `jqt`.
JQTFLAGS += \
-5 \
-iblocks/filters \
-msnippets:$(Metadata)/snippets.json \
--toc-depth=4 \

# Snippets
$(Metadata)/snippets.json: $(Content)/snippets.yaml \
| $(Metadata)
Expand Down Expand Up @@ -234,6 +261,10 @@ clobber::
| sed '1,7b;/^$$/d;s/_\([A-Z]\+\)_/\1/g;/^[^A-Z]/s/^/ /' \
> $@

clean::
@rm -f /tmp/help

endif # __html__
endif # __globals__

# vim:ai:sw=8:ts=8:noet:fileencoding=utf8:syntax=make
18 changes: 8 additions & 10 deletions docs/make.d/config.make
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
########################################################################
# config.make
#
# Build files derived from user defined configuration file.
# Build files derived from user defined configuration:
# config.{yaml,json} => config.json => site.json => globals.make
#
# Imported variables:
# Metadata
# Version
# Exported targets:
# Exported rules for:
# $(Metadata)
# $(Metadata)/config.json
# $(Metadata)/site.json
# $(Metadata)/globals.make
# Order of dependencies:
# config.{yaml,json} => config.json => site.json => globals.make

########################################################################
# Targets for directories
# Metadata directory for all generated metadata and make files
########################################################################

# Create metadata directory.
# Receive all generated metadata files and makefiles.
# Define targets with and without trailing slash.
$(Metadata) $(Metadata)/:
$(info ==> $@)
@mkdir --parents $@ >/dev/null 2>&1 || true

########################################################################
# Targets for configuration files
# Rules for configuration files
########################################################################

#
Expand Down Expand Up @@ -72,7 +70,7 @@ define m_SITE_JSON.jq :=
}
endef

#
# Global configuration file with some added members.
$(Metadata)/site.json: $(Metadata)/config.json
$(info ==> $@)
@jq --sort-keys '$(m_SITE_JSON.jq)' < $< > $@
Expand All @@ -94,7 +92,7 @@ define m_GLOBALS_MAKE.jq :=
"# vim:syntax=make"
endef

#
# Makefile to be included in `Makefile`.
$(Metadata)/globals.make: $(Metadata)/site.json
$(info ==> $@)
@jq --raw-output '$(m_GLOBALS_MAKE.jq)' < $< > $@
Expand Down
4 changes: 2 additions & 2 deletions docs/make.d/front-matter.make
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# Imported variables:
# Content
# Metadata
# Exported targets:
# Exported rules for:
# $(Metadata)/pages/.../page.json
# $(Metadata)/nodes/.../node.json
# $(Metadata)/nodes/.../section.json
# $(Metadata)/pages.json
# $(Metadata)/nodes.json
# $(Metadata)/sections.json
Expand Down
Loading

0 comments on commit ed49a91

Please sign in to comment.