Skip to content

Commit

Permalink
New file hierarchy.
Browse files Browse the repository at this point in the history
  • Loading branch information
oscherler authored and obscherler committed Jul 5, 2020
1 parent d4b3d5a commit 6c35b3d
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 103 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/cards/*.pdf
/tmp/*.html
/.sass-cache
54 changes: 24 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
RECIPES = pancakes

MDS = $(RECIPES:=.md)
JSONS = $(RECIPES:=.json)
FJSONS = $(RECIPES:=.filtered.json)
HTMLS = $(RECIPES:=.html)
PDFS = $(RECIPES:=.pdf)

master: test.md
pandoc --standalone --output master.json $<
pandoc --standalone --output master.filtered.json --lua-filter recipe.lua $<

test: test.md master
pandoc --standalone --output test.json $<
php recipe.php < test.json > test.filtered.json
pandoc --standalone --template recipe.html --to html5 --output test.html test.filtered.json
diff -u master.filtered.json test.filtered.json
ASSET_DIR = assets
RECIPE_DIR = recipes
IMAGES_DIR = images
TEMP_DIR = tmp
CARDS_DIR = cards

CSS_NAME = recipe
SCSS = $(ASSET_DIR)/$(CSS_NAME).scss
CSS = $(ASSET_DIR)/$(CSS_NAME).css
FILTER = $(ASSET_DIR)/recipe.php
CARD_TEMPLATE = $(ASSET_DIR)/recipe.card.html
IMAGE_PATH = ../$(IMAGES_DIR)

RECIPES = $(wildcard $(RECIPE_DIR)/*.md)
HTMLS = $(patsubst $(RECIPE_DIR)/%.md,$(TEMP_DIR)/%.html,$(RECIPES))
PDFS = $(patsubst $(RECIPE_DIR)/%.md,$(CARDS_DIR)/%.pdf,$(RECIPES))

all: $(PDFS)

recipe.css: recipe.scss
$(CSS): $(SCSS)
scss $< $@

%.json: %.md
pandoc --standalone --output $@ $<
$(TEMP_DIR)/%.html: $(RECIPE_DIR)/%.md $(FILTER) $(CARD_TEMPLATE)
pandoc --standalone --filter $(FILTER) --template $(CARD_TEMPLATE) --variable image_path:$(IMAGE_PATH) --to html5 --output $@ $<

%.filtered.json: %.json recipe.php
php recipe.php < $< > $@

%.html: %.filtered.json recipe.html
pandoc --standalone --template recipe.html --to html5 --output $@ $<

%.pdf: %.html recipe.css
prince --style recipe.css --output $@ $<
$(CARDS_DIR)/%.pdf: $(TEMP_DIR)/%.html $(CSS)
prince --style $(CSS) --output $@ $<

clean:
rm -f $(HTMLS) $(PDFS) $(JSONS) $(FJSONS)
rm -f $(HTMLS) $(PDFS)

.PRECIOUS: $(TEMP_DIR)/%.html

.PRECIOUS: %.html %.json %.filtered.json
6 changes: 3 additions & 3 deletions recipe.html → assets/recipe.card.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
$if(title)$
<header>
<h1 class="title"><span class="content">$title$</span></h1>
$if(image)$
<div class="title-image-container">
<img src="$image$" class="title-image $if(image_class)$$image_class$$else$fit-height$endif$"/>
</div>
$if(image)$
<img src="$image_path$/$image$" class="title-image $if(image_class)$$image_class$$else$fit-height$endif$" $if(image_style)$style="$image_style$"$endif$/>
$endif$
</div>
$if(subtitle)$
<p class="subtitle">$subtitle$</p>
$endif$
Expand Down
File renamed without changes.
13 changes: 12 additions & 1 deletion recipe.scss → assets/recipe.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,16 @@ h1

table
{
td
{
vertical-align: top;
}

tr > td:first-child
{
padding-right: 0.5em;
text-align: center;
white-space: nowrap;

font-weight: $semibold;
color: $accent;
Expand Down Expand Up @@ -147,7 +153,12 @@ h1

p
{
margin: 0;
margin: 0.5em 0;

&:first-child
{
margin: 0;
}
}
}
}
Expand Down
Empty file added cards/.exist
Empty file.
Binary file added images/pancakes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 0 additions & 41 deletions recipe.lua

This file was deleted.

Empty file added recipes/.exist
Empty file.
File renamed without changes.
28 changes: 0 additions & 28 deletions test.md

This file was deleted.

Empty file added tmp/.exist
Empty file.

0 comments on commit 6c35b3d

Please sign in to comment.