Makefile: fix a bug in local rendering that could include unintended

'zip-*.{md,rst}' files from under the `.git` directory in the index.

Also make the rendering of the "Drafts without assigned ZIP numbers"
section conditional on whether there are any such drafts.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira-Emma Hopwood 2024-07-01 15:33:07 +01:00
parent c204c8f700
commit ca22568386
2 changed files with 18 additions and 11 deletions

View File

@ -2,9 +2,12 @@
.PHONY: all all-zips tag-release protocol discard
all-zips: .Makefile.uptodate
find . -name 'zip-*.rst' -o -name 'zip-*.md' |sort >.zipfilelist.new
echo "$(sort $(wildcard zip-*.rst) $(wildcard zip-*.md))" >.zipfilelist.new
diff .zipfilelist.current .zipfilelist.new || cp -f .zipfilelist.new .zipfilelist.current
rm -f .zipfilelist.new
echo "$(sort $(wildcard draft-*.rst) $(wildcard draft-*.md))" >.draftfilelist.new
diff .draftfilelist.current .draftfilelist.new || cp -f .draftfilelist.new .draftfilelist.current
rm -f .draftfilelist.new
$(MAKE) README.rst
$(MAKE) index.html $(addsuffix .html,$(filter-out README,$(basename $(sort $(wildcard *.rst) $(wildcard *.md)))))
@ -19,7 +22,7 @@ protocol:
discard:
git checkout -- '*.html' 'README.rst' 'protocol/*.pdf'
.Makefile.uptodate: Makefile
.Makefile.uptodate: Makefile edithtml.sh
$(MAKE) clean
touch .Makefile.uptodate
@ -44,7 +47,7 @@ index.html: README.rst edithtml.sh
%.html: %.md edithtml.sh
$(PROCESSMD)
README.rst: .zipfilelist.current makeindex.sh README.template $(sort $(wildcard zip-*.rst) $(wildcard zip-*.md))
README.rst: .zipfilelist.current .draftfilelist.current makeindex.sh README.template $(wildcard zip-*.rst) $(wildcard zip-*.md) $(wildcard draft-*.rst) $(wildcard draft-*.md)
./makeindex.sh | cat README.template - >README.rst
.PHONY: linkcheck

View File

@ -20,8 +20,11 @@ for zipfile in $(cat .zipfilelist.current); do
echo " <tr> <td>`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</td> <td class=\"left\"><a href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
fi
done
cat <<EndOfBlock
</table></embed>
echo " </table></embed>"
if [ $(wc -c <.draftfilelist.current) -gt 1 ]
then
cat <<EndOfDraftHeader
Drafts without assigned ZIP numbers
-----------------------------------
@ -35,9 +38,10 @@ be deleted.
<embed><table>
<tr> <th>Title</th> </tr>
EndOfBlock
for draftfile in $(find . -name 'draft-*.rst' -o -name 'draft-*.md' | sort); do
echo Adding $draftfile to index. >/dev/stderr
echo " <tr> <td class=\"left\"><a href=\"`echo $draftfile`\">`grep '^\s*Title:' $draftfile | sed -E 's@\s*Title:\s*@@'`</a></td>"
done
echo " </table></embed>"
EndOfDraftHeader
for draftfile in $(cat .draftfilelist.current); do
echo Adding $draftfile to index of drafts. >/dev/stderr
echo " <tr> <td class=\"left\"><a href=\"`echo $draftfile`\">`grep '^\s*Title:' $draftfile | sed -E 's@\s*Title:\s*@@'`</a></td>"
done
echo " </table></embed>"
fi