2023-01-30 10:58:46 -05:00
|
|
|
.POSIX:
|
|
|
|
|
|
|
|
TEST_DJ=$(shell find . -name '*.dj' | sort)
|
|
|
|
TEST=${TEST_DJ:.dj=}
|
|
|
|
|
|
|
|
DJOT_JS=../../modules/djot.js
|
|
|
|
DJOT_JS_SRC=$(shell find ${DJOT_JS}/src -name '.ts')
|
|
|
|
|
2023-04-28 14:58:08 -04:00
|
|
|
ref.rs: ${TEST_DJ} html
|
|
|
|
echo "use crate::compare;" > $@
|
2023-01-30 10:58:46 -05:00
|
|
|
for name in ${TEST}; do \
|
2023-04-10 05:29:40 -04:00
|
|
|
name_snake=$$(basename -a $$name); \
|
2023-02-11 09:33:50 -05:00
|
|
|
skip_reason=$$(grep -E "^$${name_snake}:" skip | cut -d: -f2); \
|
|
|
|
[ -n "$$skip_reason" ] && echo "#[ignore = \"$${skip_reason}\"]"; \
|
|
|
|
echo "#[test]"; \
|
|
|
|
echo "fn $$name_snake() {"; \
|
|
|
|
printf ' let src = r###"'; \
|
|
|
|
cat $$name.dj; \
|
|
|
|
echo '"###;'; \
|
2023-04-28 14:58:08 -04:00
|
|
|
printf ' let expected = "%s";' "$$name.html"; \
|
|
|
|
echo " compare!(src, expected);"; \
|
2023-02-11 09:33:50 -05:00
|
|
|
echo "}"; \
|
|
|
|
done >> $@
|
2023-01-30 10:58:46 -05:00
|
|
|
|
|
|
|
html: djot-js ${TEST_DJ}
|
|
|
|
echo ${TEST}
|
|
|
|
for name in ${TEST}; do cat $$name.dj | ./djot-js > $$name.html; done
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
djot-js: ${DJOT_JS_SRC}
|
|
|
|
(cd "${DJOT_JS}" && npm install && npm run build)
|
|
|
|
echo "#!/bin/sh" > $@
|
|
|
|
echo 'node ${DJOT_JS}/lib/cli.js "$$@"' >> $@
|
|
|
|
chmod +x $@
|
|
|
|
|
|
|
|
clean:
|
2023-04-28 14:58:08 -04:00
|
|
|
rm -f ref.rs
|
|
|
|
rm -f *.html
|
2023-01-30 10:58:46 -05:00
|
|
|
rm -f html
|
|
|
|
rm -f djot-js
|