From 2b92504e4c597fe81250d8b137219e8a77ec1ecd Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Sun, 9 Nov 2014 11:31:55 -0500 Subject: [PATCH] Rationalizing tools. 1. Moving all commands into a Makefile (because we're handling file dependencies, and that's the right tool for it). 2. Ignoring the .html files produced in the root directory for now. 3. Switching to a single layout modeled on that used for workshop websites - will need to update this. --- .gitignore | 1 + pages/Makefile | 43 ++++++ pages/_layouts/lesson.html | 31 ---- pages/_layouts/reference.html | 31 ---- pages/_layouts/slides.html | 260 ---------------------------------- pages/_layouts/topic.html | 31 ---- pages/tools/check | 8 +- pages/tools/clean | 6 - pages/tools/preview | 12 -- pages/tools/update | 7 - 10 files changed, 47 insertions(+), 383 deletions(-) create mode 100644 pages/Makefile delete mode 100644 pages/_layouts/lesson.html delete mode 100644 pages/_layouts/reference.html delete mode 100644 pages/_layouts/slides.html delete mode 100644 pages/_layouts/topic.html delete mode 100755 pages/tools/clean delete mode 100755 pages/tools/preview delete mode 100755 pages/tools/update diff --git a/.gitignore b/.gitignore index db21e46..6ee631a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ *.pyc +*.html .DS_Store _site diff --git a/pages/Makefile b/pages/Makefile new file mode 100644 index 0000000..887e071 --- /dev/null +++ b/pages/Makefile @@ -0,0 +1,43 @@ +# Directories. +SRC_DIR = . +DST_DIR = .. + +# Files. +SRC_PAGES = $(wildcard *.md) +DST_PAGES = $(patsubst %.md,$(DST_DIR)/%.html,$(SRC_PAGES)) + +# Make sure everything is built. +all : commands + +## preview : Build website locally for checking. +preview : $(DST_PAGES) + +# Pattern to build a page with Pandoc. +$(DST_DIR)/%.html : $(SRC_DIR)/%.md + pandoc -s -t html --title-prefix='Software Carpentry' --template=_layouts/page -o $@ $< + +## commands : Display available commands. +commands : Makefile + @sed -n 's/^## //p' $< + +## check : Check consistency. +# FIXME: should run a Python script to do the checking. +# Note: the line below breaks the keyword into two strings to avoid a false match on the command. +check : + @tools/check Makefile $(SRC_PAGES) + +## update : Update the shared files from the GitHub repo holding them. +# FIXME: need to create that repo. +update : + git pull --rebase=false https://github.com/swcarpentry/lesson-template-shared.git master + +## settings : Show variables and settings. +settings : + @echo 'SRC_DIR:' $(SRC_DIR) + @echo 'DST_DIR:' $(DST_DIR) + @echo 'SRC_PAGES:' $(SRC_PAGES) + @echo 'DST_PAGES:' $(DST_PAGES) + +## clean : Clean up temporary and intermediate files. +clean : + @rm -rf $$(find .. -name '*~' -print) diff --git a/pages/_layouts/lesson.html b/pages/_layouts/lesson.html deleted file mode 100644 index 4489725..0000000 --- a/pages/_layouts/lesson.html +++ /dev/null @@ -1,31 +0,0 @@ ---- ---- - - - - {% if page.title %} - {{ page.title }} - {% endif %} - {% include header.html %} - - - -
- {% include banner.html %} - -
-
- - {% if page.title %} -

{{page.title}}

- {% endif %} - {{content}} - -
-
- - {% include footer.html %} -
- {% include javascript.html %} - - diff --git a/pages/_layouts/reference.html b/pages/_layouts/reference.html deleted file mode 100644 index 4489725..0000000 --- a/pages/_layouts/reference.html +++ /dev/null @@ -1,31 +0,0 @@ ---- ---- - - - - {% if page.title %} - {{ page.title }} - {% endif %} - {% include header.html %} - - - -
- {% include banner.html %} - -
-
- - {% if page.title %} -

{{page.title}}

- {% endif %} - {{content}} - -
-
- - {% include footer.html %} -
- {% include javascript.html %} - - diff --git a/pages/_layouts/slides.html b/pages/_layouts/slides.html deleted file mode 100644 index 65aa4f7..0000000 --- a/pages/_layouts/slides.html +++ /dev/null @@ -1,260 +0,0 @@ ---- ---- - - - - - {{page.title}} - - - - - - - - - - - - -
-
- -{{content}} - -
-
- - - - - - - - - diff --git a/pages/_layouts/topic.html b/pages/_layouts/topic.html deleted file mode 100644 index 4489725..0000000 --- a/pages/_layouts/topic.html +++ /dev/null @@ -1,31 +0,0 @@ ---- ---- - - - - {% if page.title %} - {{ page.title }} - {% endif %} - {% include header.html %} - - - -
- {% include banner.html %} - -
-
- - {% if page.title %} -

{{page.title}}

- {% endif %} - {{content}} - -
-
- - {% include footer.html %} -
- {% include javascript.html %} - - diff --git a/pages/tools/check b/pages/tools/check index d0e8545..e750ec7 100755 --- a/pages/tools/check +++ b/pages/tools/check @@ -1,8 +1,6 @@ #!/usr/bin/env bash -# check: Ensure that proper formatting has been used. -# Ensure we run from the lesson directory -cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. +# Placeholder for actual conformance checking script (which will +# probably be Python, not Bash). -# Show all of the FIXMEs in the lessons content -grep -i -n FIXME ??-*.md +grep -i -n 'FIX''ME' $* diff --git a/pages/tools/clean b/pages/tools/clean deleted file mode 100755 index 646f84b..0000000 --- a/pages/tools/clean +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# Delete junk files. -rm -rf $(find . -name '*~' -print) -rm -rf $(find . -name '*.pyc' -print) -rm -rf $(find . -name '.DS_Store' -print) -rm -rf _site diff --git a/pages/tools/preview b/pages/tools/preview deleted file mode 100755 index e3174ec..0000000 --- a/pages/tools/preview +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# build: Build the lesson site. - -# Ensure we run from the lesson directory -cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. - -# Run our checks first -tools/check - -SITE="_site" - -jekyll build -t -d $SITE diff --git a/pages/tools/update b/pages/tools/update deleted file mode 100755 index 3237442..0000000 --- a/pages/tools/update +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -# update: Get the latest versions of shared files - -# Ensure we run from the lesson directory -cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. - -git pull --rebase=false https://github.com/tbekolay/swc-shared.git master -- GitLab