From 93cdffb76eee6081b5c16b85a3282446613e7087 Mon Sep 17 00:00:00 2001 From: Louis Burke Date: Wed, 16 Oct 2024 00:23:48 -0400 Subject: [PATCH] Removed currently unused files --- Makefile | 124 +------ assets.cue | 4 +- assets.toml | 44 --- assets.yaml | 45 +++ build.sh | 42 --- cards.yaml.recovered | 838 ------------------------------------------- cardtopng.sh | 9 - configure.jq | 15 +- configure.py | 98 ----- configure.sh | 141 -------- make.py | 120 ------- make_mako.py | 37 -- rules.ninja | 9 + scantex.old.sh | 50 --- 14 files changed, 74 insertions(+), 1502 deletions(-) delete mode 100644 assets.toml delete mode 100755 build.sh delete mode 100644 cards.yaml.recovered delete mode 100755 cardtopng.sh delete mode 100644 configure.py delete mode 100755 configure.sh delete mode 100755 make.py delete mode 100644 make_mako.py delete mode 100644 scantex.old.sh diff --git a/Makefile b/Makefile index 0a00f59..26ec845 100644 --- a/Makefile +++ b/Makefile @@ -1,122 +1,8 @@ -.PHONY: all clean check printrun cardrun decks prototype -.PRECIOUS: %.pdf %.png +default: everything -GENERATED_DIR?=generated -SENTINEL=$(GENERATED_DIR)/.sentinel +build.ninja: $(wildcard *.cue) $(wildcard *.yaml) configure.jq + cue export -- *.cue *.yaml | ./configure.jq --args -- *.cue *.yaml -default: check decks -all: check decks export -prototype: mini +everything: build.ninja + ninja -ASSET_TOML=assets.toml - -include rules/*.mk - -RAW_DECK_LIST=$(shell ./scripts/decklist.sh) first second third -DECK_LIST=$(RAW_DECK_LIST:%=$(GENERATED_DIR)/%) -DECK_DEPENDENCIES=$(DECK_LIST:%=%.d) -DECK_EXPORT_DIRS=$(DECK_LIST:%=outputs/%) - -$(SENTINEL): cards.sql - ./scripts/generate_cards.sh $(GENERATED_DIR) - -rm $(GENERATED_DIR)/first.list - -rm $(GENERATED_DIR)/second.list - -rm $(GENERATED_DIR)/third.list - touch $(GENERATED_DIR)/first.list - touch $(GENERATED_DIR)/second.list - touch $(GENERATED_DIR)/third.list - for card in legs/first/*.tex; do echo $${card%tex}pdf >> $(GENERATED_DIR)/first.list; done - for card in legs/second/*.tex; do echo $${card%tex}pdf >> $(GENERATED_DIR)/second.list; done - for card in legs/third/*.tex; do echo $${card%tex}pdf >> $(GENERATED_DIR)/third.list; done - mkdir -p $(DECK_EXPORT_DIRS) - touch $@ - -%.d: %.list - echo -n 'outputs/$(*F).pdf:' > $@ - tr '\n' ' ' < $< >> $@ - echo -e '\n\tpdfunite $$+ $$@' >> $@ - cat $< | sed '/^$$/d' | sort | uniq -c | sed -e 's@ *\([[:digit:]]\+\) \(.\+/\)*\(.\+\).pdf@export: outputs/$*/\3[\1].png@' >> $@ - cat $< | sed '/^$$/d' | sort | uniq -c | sed -e 's@ *\([[:digit:]]\+\) \(.\+/\)*\(.\+\).pdf@outputs/$*/\3[\1].png: \2\3[\1].png; cp \2\3[\1].png outputs/$*/\3[\1].png@' >> $@ - mkdir -p outputs/$(*D) - echo 'decks: outputs/$(*F).pdf' >> $@ - -Makefile.deps: $(SENTINEL) $(DECK_DEPENDENCIES) - cat $^ > $@ - -#include Makefile.deps - -export: outputs/cardback.png -export: outputs/iditaboard[face].png -export: instructions.pdf - -%.pdf: %.tex - $(XELATEX) -interaction=batchmode -halt-on-error --shell-escape --output-directory=$(@D) $< - rm $*.aux - rm $*.log - -instructions.pdf: instructions.tex instructions-anatomy.pdf - $(XELATEX) -interaction=batchmode -halt-on-error --shell-escape --output-directory=$(@D) $< - $(XELATEX) -interaction=batchmode -halt-on-error --shell-escape --output-directory=$(@D) $< # Twice, for TOC - -mini: decks - pdfunite outputs/*.pdf tmp.pdf - pdfjam --nup 3x3 tmp.pdf --no-landscape --delta '0.5cm 0.5cm' --scale 0.9 -o outputs/mini_printrun.pdf - rm tmp.pdf - -force-make: - -clean: - -find cards -name '*.pdf' -delete - -find cards -name '*].png' -delete - -find cards -name '*-raw.png' -delete - -find outputs -name '*.pdf' -delete - -find outputs -name '*].png' -delete - -find outputs -name '*.d' -delete - -find legs -name '*.pdf' -delete - -find legs -name '*].png' -delete - -find legs -name '*-raw.png' -delete - -find . -name '*.aux' -delete - -find . -name '*.log' -delete - -rm -rf $(GENERATED_DIR) - -rm Makefile.deps - -print-% : ; @echo $* = $($*) - -# Rules for each multiplicity of png -%[1].png: %.pdf; ./cardtopng.sh $@ -%[2].png: %.pdf; ./cardtopng.sh $@ -%[3].png: %.pdf; ./cardtopng.sh $@ -%[4].png: %.pdf; ./cardtopng.sh $@ -%[5].png: %.pdf; ./cardtopng.sh $@ -%[6].png: %.pdf; ./cardtopng.sh $@ -%[7].png: %.pdf; ./cardtopng.sh $@ -%[8].png: %.pdf; ./cardtopng.sh $@ -%[9].png: %.pdf; ./cardtopng.sh $@ -%[10].png: %.pdf; ./cardtopng.sh $@ -%[11].png: %.pdf; ./cardtopng.sh $@ -%[12].png: %.pdf; ./cardtopng.sh $@ -%[13].png: %.pdf; ./cardtopng.sh $@ -%[14].png: %.pdf; ./cardtopng.sh $@ -%[15].png: %.pdf; ./cardtopng.sh $@ -%[16].png: %.pdf; ./cardtopng.sh $@ -%[17].png: %.pdf; ./cardtopng.sh $@ -%[18].png: %.pdf; ./cardtopng.sh $@ -%[19].png: %.pdf; ./cardtopng.sh $@ -%[20].png: %.pdf; ./cardtopng.sh $@ -%[21].png: %.pdf; ./cardtopng.sh $@ -%[22].png: %.pdf; ./cardtopng.sh $@ -%[23].png: %.pdf; ./cardtopng.sh $@ -%[24].png: %.pdf; ./cardtopng.sh $@ -%[25].png: %.pdf; ./cardtopng.sh $@ -%[26].png: %.pdf; ./cardtopng.sh $@ -%[27].png: %.pdf; ./cardtopng.sh $@ -%[28].png: %.pdf; ./cardtopng.sh $@ -%[29].png: %.pdf; ./cardtopng.sh $@ -%[30].png: %.pdf; ./cardtopng.sh $@ -%[31].png: %.pdf; ./cardtopng.sh $@ -%[32].png: %.pdf; ./cardtopng.sh $@ -%[33].png: %.pdf; ./cardtopng.sh $@ -%[34].png: %.pdf; ./cardtopng.sh $@ -%[35].png: %.pdf; ./cardtopng.sh $@ -%[36].png: %.pdf; ./cardtopng.sh $@ -%[image].png: %.pdf; ./cardtopng.sh $@ diff --git a/assets.cue b/assets.cue index 977607d..ebd311d 100644 --- a/assets.cue +++ b/assets.cue @@ -2,7 +2,7 @@ package iditacards -#AssetKind: "image" | "tex" | "texdoc" | "template" | "cat" +#AssetKind: "image" | "tex" | "texdoc" | "template" | "cat" | "svg" #Asset: { // passed to convert to create the "print" version (usually to add bleed) @@ -33,7 +33,7 @@ package iditacards contents: [...string] } - if kind == "tex" { + if kind == "tex" || kind == "svg" { source: string size: #Dimensions } diff --git a/assets.toml b/assets.toml deleted file mode 100644 index 6f98093..0000000 --- a/assets.toml +++ /dev/null @@ -1,44 +0,0 @@ -# This file describes the assets of iditacards - -# It is processed to produce the various source files that are then compiled -# into assets - -# NOTE: [a. b] indicates that the object will be processed through the mako -# template templates/a.mako and output to generated/b. (templates/ and -# generated/ specified by arguments) - -[card. "a_hat.tex"] -name = "A Hat" -costs.energy = 2 -costs.health = 2 -effects = { daydraw = "+1" } -image = "hat" -type = "attachment" -flavour = "I bet its a valve hat." - -[card. "dog_chow.tex"] -name = "Dog Chow" -costs.energy = 3 -cards.health = 3 -effects = { speed = "+1" } -image = "dog_chow" -type = "attachment" -flavour = "A hungry dog is a slow dog." - -[card. "good_dog.tex"] -name = "Good Dog" -costs.energy = 3 -costs.health = 3 -effects = { daydraw = "+1" } -image = "good_dog" -type = "dog" -flavour = "Good boy." - -[deck. "starter1.mk"] -name = "starter1" -[deck. "starter1.mk". contents] -"A hat" = 1 -"Breakfast" = 2 - - - diff --git a/assets.yaml b/assets.yaml index 4145373..ab394c5 100644 --- a/assets.yaml +++ b/assets.yaml @@ -8,6 +8,21 @@ assets: kind: image source: cardback.png + cardback-firstleg: + kind: image + source: cardback.png + print: +level-colors black,"#9117FF" + + cardback-secondleg: + kind: image + source: cardback.png + print: +level-colors black,"#17FF91" + + cardback-thirdleg: + kind: image + source: cardback.png + print: +level-colors black,"#FF9117" + iditaboard: kind: tex source: iditaboard.tex @@ -20,3 +35,33 @@ assets: instructions-anatomy: kind: texdoc source: instructions-anatomy.tex + + die/cloud: + kind: svg + source: images/die/cloud.svg + size: 180x180 + + die/rain: + kind: svg + source: images/die/rain.svg + size: 180x180 + + die/snowflake: + kind: svg + source: images/die/snowflake.svg + size: 180x180 + + die/storm: + kind: svg + source: images/die/storm.svg + size: 180x180 + + die/sun: + kind: svg + source: images/die/sun.svg + size: 180x180 + + die/wind: + kind: svg + source: images/die/wind.svg + size: 180x180 diff --git a/build.sh b/build.sh deleted file mode 100755 index e565208..0000000 --- a/build.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - - -# Incremental build script. -# Main inputs are from the *.cue and *.yaml files in the top-level directory -# Assets are taken from raw/ tex/ mako/ etc and put into the output/ directory -# The output/ directory is populated with a ninja build script to do the -# actual build, along with source files that are updated for a build. -# Thus to build a full output in dir you would run: build.sh dir/ && cd dir/ && ninja build -# Once built once, a simple `ninja` in the output directory should suffice - -# echo "new" | update file -# updates file with new content only if the content differs -update() { - fname="$1" - data="$(cat)" - new="$(echo "$data" | sha256sum | cut -d " " -f 1)" - old="$(sha256sum "$fname" | cut -d " " -f 1)" - if [ "$new" != "$old" ]; then - echo "Updating $fname" - echo "$data" > "$fname" - fi -} - -outdir="${1:-output}/" - -mkdir -p "$outdir" - -json="$(cue export *.cue *.yaml)" - -{ - echo "# Generated by build.sh on $(date)" - - echo "include ../rules.ninja" - -EOF -} | update "$outdir/build.ninja" - -# TODO: get json via `cue export *.cue *.yaml` - - - diff --git a/cards.yaml.recovered b/cards.yaml.recovered deleted file mode 100644 index dab9b65..0000000 --- a/cards.yaml.recovered +++ /dev/null @@ -1,838 +0,0 @@ -# vi: sw=2:ts=2:sts=2:et -cards: - a_hat: &a_hat - name: 'A Hat' - costs: - energy: 2 - health: 2 - effects: - daydraw: 1 - image: hat - type: attachment - flavour: 'I bet its a valve hat.' - - - &dog_chow - name: 'Dog Chow' - costs: - energy: 3 - health: 3 - effects: - speed: 1 - image: dog_chow - type: attachment - flavour: 'A hungry dog is a slow dog.' - - - &good_dog - name: 'Good Dog' - costs: - energy: 3 - health: 3 - effects: - - '\daydraw{+1}' - image: good_dog - type: dog - flavour: 'Good boy.' - - - &husky - name: 'Husky' - costs: - energy: 2 - health: 2 - risk: 2 - effects: - - '\daydraw{+1}' - - '\speed{+1}' - image: husky - type: dog - flavour: 'Standard mushing fare.' - - - &wheel_dog - name: 'Wheel Dog' - costs: - energy: 3 - health: 3 - effects: - - '\speed{+1}' - - '\discardonkill' - - '\inplayatstart' - image: wheel_dog - type: dog - flavour: 'The dog right in front of the sled. Strong and steady.' - - - &breakfast - name: 'Breakfast' - costs: - health: 3 - effects: - - '\draw{3}' - image: breakfast - type: food - flavour: 'The most important meal of the day.' - - - &lunch - name: 'Lunch' - costs: - energy: 3 - effects: - - '\draw{3}' - image: lunch - type: food - flavour: 'What about second breakfast?' - - - &dinner - name: 'Dinner' - costs: - energy: 2 - health: 2 - effects: - - '\draw{7}' - image: dinner - type: food - flavour: 'I hope you like salted fish.' - - - &move - name: 'Move' - effects: - - '\move{1}' - image: move - type: movement - flavour: 'Just another day.' - - - &mush - name: 'Mush' - costs: - energy: 2 - health: 2 - risk: 1 - effects: - - '\move{10}' - image: mush - type: movement - flavour: "Comes from the french word ``Marche''." - - - &first_aid - name: First Aid - costs: - energy: 2 - health: 2 - effects: - - '\see{3}' - - '\destroy{1}' - image: first_aid - type: personal - flavour: 'Reduces swelling.' - - - &grandma_soup - name: Grandma Soup - costs: - energy: 1 - health: 2 - risk: 1 - effects: - - '\see{10}' - - '\destroy{2}' - image: grandma_soup - type: personal - flavour: 'Cures what ails you.' - - - &repair_sled - name: Repair Sled - costs: - energy: 1 - health: 3 - effects: - - '\supply{1}' - - '\take{2}' - image: repair_sled - type: sled - flavour: "It doesn't need to be pretty. It just has to work." - - - &upgrade_sled - name: Upgrade Sled - costs: - energy: 2 - health: 2 - effects: - - '\supply{3}' - - '\take{1}' - image: upgrade_sled - type: sled - flavour: 'You have to keep your ride in top shape.' - - - &buffer_panel - name: Buffer Panel - costs: - energy: 2 - health: 2 - effects: - - '\immortal' - - '\safepass' - image: buffer_panel - type: attachment - flavour: 'Did the primary buffer panel just fall of my gorram ship for no apparent reason?' - - - &nuclear_reactor - name: Nuclear Reactor - costs: - energy: 2 - health: 2 - effects: - - '\speed{+5}' - - '\passdie' - image: nuclear_reactor - type: attachment - flavour: 'What could go wrong?' - - - &engineer_dog - name: Engineer Dog - costs: - energy: 3 - health: 5 - risk: 1 - effects: - - '\speed{$\times 2$}' - - '\nohold' - image: engineer_dog - type: dog - flavour: 'Nails and Gears.' - - - &moose - name: Moose - costs: - energy: 5 - risk: 3 - effects: - - '\speed{+5}' - - '\immortal' - image: moose - type: dog - flavour: 'Majestic creatures. Hard to tame.' - - - &waffle - name: Waffle - effects: - - '\draw{2}' - image: waffles - type: food - flavour: 'Waffles are \textbf{delicious}.' - - - &whale_meat - name: Whale Meat - costs: - energy: 1 - health: 1 - effects: - - '\draw{5}' - - '\nohypothermia' - image: whale_meat - type: food - flavour: "It's like rubber." - - - &hitch_a_ride - name: Hitch a Ride - costs: - energy: 1 - effects: - - '\move{6}' - - '\damage{1}' - image: hitch_a_ride - type: movement - flavour: 'Probably not in the spirit of the race.' - - - &tactical_play - name: Tactical Play - costs: - energy: 1 - risk: 1 - effects: - - '\move{0}' - - '\doubledistance' - image: tactical_play - type: movement - flavour: 'Make the most of it.' - - - &meditate - name: Meditate - costs: - energy: 1 - health: 1 - effects: - - '\see{all}' - - '\destroy{0}' - image: meditate - type: personal - flavour: 'It \textit{is} just sitting.' - - - &diamorphine - name: Diamorphine - costs: - energy: 1 - health: 1 - risk: 1 - effects: - - '\see{all}' - - '\destroy{all}' - image: diamorphine - type: personal - flavour: 'Highly addicting.' - - - &desperate_times - name: Desperate Times - costs: - energy: all - effects: - - '\supply{10}' - - '\take{5}' - image: desparate_times - type: sled - flavour: 'Desperate measures hotline, how may I help you?' - - - &lead_sled - name: Lead Sled - costs: - energy: 1 - health: 1 - risk: 1 - effects: - - '\supply{10}' - - '\take{10}' - image: lead_sled - type: sled - flavour: "At least it's not a zeppelin." - - - &damaged - name: Damaged - costs: - energy: 1 - health: 1 - effects: - - '\damagetext' - image: damaged - type: damage - flavour: 'You have been hurt.' - - - &dog_shoes - name: Dog Shoes - costs: - energy: 2 - health: 3 - effects: - - '\speed{+2}' - image: dog_shoes - type: attachment - flavour: 'Dogs look cute in shoes.' - - - &squirrel - name: Squirrel - costs: - energy: 2 - health: 2 - risk: 1 - effects: - - '\speed{+3}' - image: squirrel - type: attachment - flavour: 'Dogs \emph{hate} squirrels.' - - - &tiara - name: Tiara - costs: - energy: 2 - health: 2 - risk: 1 - effects: - - '\daydraw{+1}' - - '\speed{+1}' - image: tiara - type: attachment - flavour: 'Makes the dog feel special.' - - - &bear - name: Bear - costs: - energy: 2 - health: 2 - risk: 2 - effects: - - '\speed{+5}' - image: bear - type: dog - flavour: 'In hindsight, not the best idea.' - - - &big_dog - name: Big Dog - costs: - energy: 2 - health: 2 - effects: - - '\speed{+3}' - image: big_dog - type: dog - flavour: "He's not red though." - - - &greyhound - name: Greyhound - costs: - risk: 2 - effects: - - '\speed{+3}' - - '\nohold' - image: greyhound - type: dog - flavour: 'What happens when you mix the colours on a husky? You get a grey hound.' - - - &malamute - name: Malamute - costs: - energy: 2 - health: 2 - risk: 1 - effects: - - '\daydraw{+2}' - image: malamute - type: dog - flavour: 'A common sled hauling breed.' - - - &problem_dog - name: Problem Dog - costs: - energy: 1 - health: 1 - risk: 1 - effects: - - '\daydraw{-1}' - - '\speed{+3}' - image: problem_dog - type: dog - flavour: "I swear, if you weren't so fast." - - - &bison - name: Bison - costs: - energy: 2 - risk: 1 - effects: - - '\draw{5}' - image: bison - type: food - flavour: "It's very lean." - - - &poutine - name: Poutine - costs: - health: 2 - effects: - - '\draw{1}' - - '\nohypothermia' - image: poutine - type: food - flavour: 'The great Canadian carb!' - - - &venison - name: Venison - costs: - health: 2 - effects: - - '\draw{3}' - image: venison - type: food - flavour: 'Better than breakfast.' - - - &steak - name: Steak - effects: - - '\draw{1}' - image: steak - type: food - flavour: "Well aren't you fancy." - - - &jerky - name: Jerky - costs: - energy: 1 - health: 1 - effects: - - '\draw{3}' - image: jerky - type: food - flavour: 'Watch your sodium!' - - - &midnight_sun - name: Midnight Sun - costs: - energy: 1 - health: 1 - risk: 1 - effects: - - '\move{10}' - image: midnight_sun - type: movement - flavour: 'Strange things are done in the midnight sun.' - - - &push - name: Push - costs: - energy: 1 - effects: - - '\move{5}' - image: push - type: movement - flavour: 'Not a full mush, but still putting in some effort.' - - - &slow_and_steady - name: Slow and Steady - effects: - - '\draw{1}' - - '\move{0}' - image: slow_and_steady - type: movement - flavour: 'Maybe a bit too slow.' - - - &band_aid - name: Band Aid - effects: - - '\see{1}' - - '\destroy{1}' - image: band_aid - type: personal - flavour: 'Not much.' - - - &bandage - name: Bandage - costs: - energy: 1 - effects: - - '\see{5}' - - '\destroy{1}' - image: bandage - type: personal - flavour: 'Make sure you wrap it tight.' - - - &brandy - name: Brandy - costs: - risk: 1 - effects: - - '\see{5}' - - '\destroy{1}' - image: brandy - type: personal - flavour: 'Brought by a St.\ Bernard' - - - &caffeine - name: Caffeine - costs: - health: 2 - effects: - - '\draw{1}' - - '\see{2}' - - '\destroy{1}' - image: caffeine - type: personal - flavour: 'The greatest addiction ever.' - - - &improvise - name: Improvise - effects: - - '\take{1}' - image: improvise - type: sled - flavour: 'MacGyver of the north.' - - - &makeshift_sled - name: Makeshift Sled - costs: - energy: 1 - health: 1 - effects: - - '\supply{2}' - - '\take{6}' - image: makeshift_sled - type: sled - flavour: "Rickety, but it'll hold." - - - &salvage - name: Salvage - costs: - energy: 1 - health: 1 - effects: - - '\supply{3}' - - '\take{2}' - image: salvage - type: sled - flavour: 'Take the good with the bad.' - - - &antique_sled - name: Antique Sled - costs: - health: 5 - effects: - - '\supply{2}' - - '\take{8}' - image: antique_sled - type: sled - flavour: 'Withstood the test of the time.' - - - &rush - name: Rush - costs: - health: 3 - risk: 1 - effects: - - '\move{8}' - image: rush - type: movement - flavour: 'Hurry up!' - - - &supply_run - name: Supply Run - effects: - - '\move{3}' - image: supply_run - type: movement - flavour: 'Not as easy as dropping by the grocery store.' - -# The decks that the cards are in -# TODO: Add rarity? -decks: - - name: Starter1 - cards: - - *a_hat - - *breakfast - - *breakfast - - *dinner - - *dog_chow - - *first_aid - - *first_aid - - *good_dog - - *grandma_soup - - *husky - - *lunch - - *lunch - - *move - - *move - - *move - - *move - - *mush - - *repair_sled - - *repair_sled - - *upgrade_sled - - *upgrade_sled - - *wheel_dog - - - name: Starter2 - cards: - - *a_hat - - *breakfast - - *breakfast - - *dinner - - *dog_chow - - *first_aid - - *first_aid - - *good_dog - - *grandma_soup - - *husky - - *lunch - - *lunch - - *move - - *move - - *move - - *move - - *mush - - *repair_sled - - *repair_sled - - *upgrade_sled - - *upgrade_sled - - *wheel_dog - - - name: Starter3 - cards: - - *a_hat - - *breakfast - - *breakfast - - *dinner - - *dog_chow - - *first_aid - - *first_aid - - *good_dog - - *grandma_soup - - *husky - - *lunch - - *lunch - - *move - - *move - - *move - - *move - - *mush - - *repair_sled - - *repair_sled - - *upgrade_sled - - *upgrade_sled - - *wheel_dog - - - name: Starter4 - cards: - - *a_hat - - *breakfast - - *breakfast - - *dinner - - *dog_chow - - *first_aid - - *first_aid - - *good_dog - - *grandma_soup - - *husky - - *lunch - - *lunch - - *move - - *move - - *move - - *move - - *mush - - *repair_sled - - *repair_sled - - *upgrade_sled - - *upgrade_sled - - *wheel_dog - - - name: Damage - cards: - - *damaged - - *damaged - - *damaged - - *damaged - - *damaged - - *damaged - - *damaged - - *damaged - - *damaged - - *damaged - - - name: Legendary - cards: - - *buffer_panel - - *desperate_times - - *diamorphine - - *engineer_dog - - *hitch_a_ride - - *lead_sled - - *meditate - - *moose - - *nuclear_reactor - - *tactical_play - - *waffle - - *whale_meat - - - name: Race - cards: - - *bear - - *bear - - *big_dog - - *big_dog - - *dog_shoes - - *dog_shoes - - *greyhound - - *greyhound - - *improvise - - *improvise - - *midnight_sun - - *midnight_sun - - *problem_dog - - *problem_dog - - *push - - *push - - *rush - - *rush - - *slow_and_steady - - *slow_and_steady - - *squirrel - - *squirrel - - *supply_run - - *supply_run - - *tiara - - *tiara - - - name: Survival - cards: - - *antique_sled - - *antique_sled - - *band_aid - - *band_aid - - *bandage - - *bandage - - *bison - - *bison - - *brandy - - *brandy - - *caffeine - - *caffeine - - *jerky - - *jerky - - *makeshift_sled - - *makeshift_sled - - *malamute - - *malamute - - *poutine - - *poutine - - *salvage - - *salvage - - *steak - - *steak - - *venison - - *venison - -Legs: - - &farm - name: Farm - effects: - - '\allowednot{\includegraphics[width=1cm]{icons/starve.png}}' - spaces: - 3: hypo - 5: damage - 7: hypo - - - &fishing_hole - name: Fishing Hole - effects: - - '\daydraw{3}' - spaces: - 3: damage - 5: hypo - 7: damage - - - &hospital - name: Hospital - effects: - - '\freecardtype{personal}' - spaces: - 3: starve - 5: hypo - 7: starve - - - &new_moon - name: New Moon - effects: - - '\freecardtype{dog}' - spaces: - 3: hypo - 5: starve - 7: hypo - - - &repair_shop - name: Repair Shop - effects: - - '\freecardtype{sled}' - - -Legdecks: - - name: First - legs: - - *farm - - *fishing_hole - - *hospital - - *new_moon - - - -# TODO: add legs diff --git a/cardtopng.sh b/cardtopng.sh deleted file mode 100755 index a986e7d..0000000 --- a/cardtopng.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Syntax: cardtopng.sh cardname.png -OUTPUT=$1 -INTERMEDIATE=$(echo "$1" | sed 's/\[.*\]\..*//')-raw.png -PDFNAME=$(echo "$1" | sed 's/\[.*\]\..*//').pdf - -pdftoppm -scale-to-x 750 -scale-to-y 1050 -png $PDFNAME > $INTERMEDIATE -convert $INTERMEDIATE -set option:distort:viewport 825x1125-37-37 -virtual-pixel Edge -distort SRT 0 +repage $OUTPUT diff --git a/configure.jq b/configure.jq index b0eccbc..a4e5bc7 100755 --- a/configure.jq +++ b/configure.jq @@ -102,17 +102,28 @@ def generate_cat_builds: (.contents | map("output/" + . + ".raw.png") | join(" ")) as $rawcontents | (.name | dirof) as $dir | (.name | rawof) as $raw | " -build output/\($dir)\($raw).pdf: pdfunite \($pdfcontents) +build output/\($dir)\($raw).pdf | output/\($dir)\($raw)-mini.pdf: pdfunite \($pdfcontents) build output/\($dir)\($raw).png: pngunite \($pngcontents) build output/\($dir)\($raw).raw.png: pngunite \($rawcontents) "; +def generate_svg_builds: + (.size | split("x")[0]) as $w | + (.size | split("x")[1]) as $h | + (.name | dirof) as $dir | + (.name | rawof) as $raw | " +build output/\($dir)\($raw).png: svg2png \(.source) + w = \($w) + h = \($h) +"; + def generate_builds: (select(.kind == "template") | generate_template_builds), (select(.kind == "image") | generate_image_builds), (select(.kind == "tex") | generate_tex_builds), (select(.kind == "texdoc") | generate_texdoc_builds), - (select(.kind == "cat") | generate_cat_builds); + (select(.kind == "cat") | generate_cat_builds), + (select(.kind == "svg") | generate_svg_builds); def expandout: to_entries[] | .value + { name: .key }; def everything: (.assets, .pseudoassets) | expandout; diff --git a/configure.py b/configure.py deleted file mode 100644 index 47dacc7..0000000 --- a/configure.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python3 - -""" Generates build.ninja for iditacards build in output/. """ - -import glob -import subprocess -import json -import os - -cue_sources = glob.glob(f'*.cue') -yaml_sources = glob.glob(f'*.yaml') -sources = cue_sources + yaml_sources - -everything = json.loads(subprocess.run(['cue', 'export', '--'] + sources, stdout=subprocess.PIPE).stdout) - -assets = everything['assets'] -pseudos = everything['pseudoassets'] -all_assets = { **assets, **pseudos } - -print('# Generated from configure.sh, do not edit this file!\n') - -with open(f'{script_dir}/rules.ninja', 'r') as f: - print(f.read()) - -print(f''' -base = . - -rule configure - description = recreate $out using $in - command = $in > $out - generator = 1 - restat = 1 - -build build.ninja: configure ./configure.py | {' '.join(sources)} - -build output/.everything.json: cuegen {' '.join(sources)} - filter = . -''') - -for name, asset in all_assets.items(): - assetdir = os.path - if asset['kind'] == 'template': - print(f''' -build output/.{name}.update | .{name}.json: extract .everything.json - filter = --arg asset '{name}' '.assets[$$asset].data' - target = .{name}.json - -build tex/{name}.tex: template2tex .{name}.json | ../templates/{asset["template"]} - template = ../templates/{asset["template"]} - -build {name}.pdf: tex2pdf tex/{name}.tex || .{name}.pdf.dd - dyndep = .{name}.pdf.dd - -build .{name}.pdf.dd: scantex tex/{name}.tex - target = {name}.pdf - -build {name}.{'raw.' if 'print' in asset else ''}png: pdf2png {name}.pdf - w = {asset['size'].split('x')[0]} - h = {asset['size'].split('x')[1]} -''') - - if asset['kind'] == 'image': - print(f''' -build {name}.{'raw.' if 'print' in asset else ''}png: copy ../{asset['source']} -''') - - if asset['kind'] == 'tex': - print(f''' -build {name}.pdf: tex2pdf ../{asset['source']} || .{name}.pdf.dd - dyndep = .{name}.pdf.dd - -build .{name}.pdf.dd: scantex ../{asset['source']} - target = {name}.pdf - -build {name}.{'raw.' if 'print' in asset else ''}png: pdf2png {name}.pdf - w = {asset['size'].split('x')[0]} - h = {asset['size'].split('x')[1]} -''') - - if asset['kind'] == 'texdoc': - print(f''' -build {name}.pdf: tex2pdf2x ../{asset['source']} || .{name}.pdf.dd - dyndep = .{name}.pdf.dd - -build .{name}.pdf.dd: scantex ../{asset['source']} - target = {name}.pdf -''') - - if asset['kind'] == 'cat': - print(f''' -build {name}.pdf: pdfunite {' '.join(content + '.pdf' for content in asset['contents'])} -''') - - if 'print' in asset: - print(f''' -build {name}.png: convert {name}.raw.png - args = {asset['print']} -''') diff --git a/configure.sh b/configure.sh deleted file mode 100755 index 23b3277..0000000 --- a/configure.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -# Outputs a build.ninja script for placing into $1 (or output/ if omitted) - -scriptdir="$(dirname -- "${BASH_SOURCE[0]}")" -builddir="${1-output}" - -cue_sources=( "$scriptdir"/*.cue "$scriptdir"/*.yaml ) -everything="$(cue export -- "${cue_sources[@]}" | jq -c)" -ASSET_TO_JSON="| to_entries[] | .value + { name: .key }" -mapfile -t assets < <(jq -c ".assets $ASSET_TO_JSON" <<<"$everything") -mapfile -t pseudos < <(jq -c ".pseudoassets $ASSET_TO_JSON" <<<"$everything") - -# base is the directory that contains the script -base="$(realpath -s --relative-to="$builddir" "$scriptdir")" - -# root is the directory that the assets are generated into -root=. - -relative_cue_sources=( ) -for cue_source in "${cue_sources[@]}"; do - relative_cue_sources+=( "$base/$cue_source" ) -done - -cat <&2 - ;; - esac - - # always run convert if print is non-empty - if [ -n "$print" ]; then - cat </dev/null + pool = ink_pool diff --git a/scantex.old.sh b/scantex.old.sh deleted file mode 100644 index 60fdcd7..0000000 --- a/scantex.old.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - - -# TODO: there should be some way to use -recorder to get list of dependencies -# somehow, though I'd hate to regenerate the whole PDF just to make dependencies -# note that the snapshot package is even better - -# NOTE: next thing to try is the create temporary document with -# \RequirePackage{snapshot} appended to the top, then run xelatex normally and -# process the output *.dep (or *.log) file to extract the necessary -# requirements. It may be possible to use additional xelatex flags to reduce -# unnecessary work - -echo 'ninja_dyndep_version = 1' - -src="$1" -dst="$2" -tgt="${dst%%.*}.pdf" -aux="${dst%%.*}.aux" -log="${dst%%.*}.log" - -# get_tex command -# returns the argument of \command{...} in the src document -get_tex() { - grep "[\]$1" "$src" | sed 's/.*{\(.*\)}.*/\1/' -} - -deps=( ) - -if grep -q '\\documentclass{iditacard}' "$src"; then - deps+=( - # The class file - 'iditacard.cls' - - # The artwork - "images/card/$(get_tex art).png" - - # The deckmark - "images/deck/$(get_tex deck).png" - ) -fi - -read -r -a rawimages <<<"$(grep -o '\\includegraphics[^}]*}' "$src" | sed 's/.*{\(.*\)}.*/images\/\1/')" -deps+=( "${rawimages[@]}" ) - -if [ "${#deps[@]}" -gt 0 ]; then - echo "build $tgt | $aux $log : dyndep | ${deps[*]}" -else - echo "build $tgt | $aux $log : dyndep" -fi