Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream update #87

Merged
merged 34 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d905d3a
Clarify that there may be funds associated with the Transparent P2PKH
Nov 5, 2024
e0529f8
Editorial changes to terminology and references.
daira Nov 8, 2024
cc9c2c9
Cosmetic changes.
daira Nov 8, 2024
38e4501
Block reward -> block subsidy where applicable.
daira Nov 8, 2024
58fc3f8
Less trivial editorial changes.
daira Nov 8, 2024
0265e07
Dark mode fix: make links from the dark mode spec reference the corre…
daira Nov 8, 2024
1a71e02
ZIP 231: add TBD for interaction with ZIP 302.
daira Nov 8, 2024
9aa5d97
ZIP 234: remove unused reference.
daira Nov 8, 2024
cf7b9ca
ZIP 2002: apply review suggestion
daira Nov 8, 2024
5ce0737
Re-render. (The protocol spec changes only affected the reference to
daira Nov 8, 2024
c28dbc9
Merge pull request #951 from daira/editorial-fixes
nuttycom Nov 8, 2024
c7022a3
Merge pull request #940 from daira/always-scan-diversifier-index-0
daira Nov 9, 2024
d63e722
#797 intended to remove the restriction on Revision 1 UA/UVKs having …
daira Nov 12, 2024
399e638
Merge pull request #959 from daira/zip-316-r1-transparent-fix
daira Nov 12, 2024
cd3f23e
CSS: Make the style of reference links and references (almost) consis…
daira Nov 8, 2024
d5d9643
ZIP 225: use math in some tables.
daira Nov 8, 2024
70ed5c5
ZIPs 231, 234, 235: Minor formatting and reference fixes.
daira Nov 9, 2024
49f2555
Support `$...$` for inline math in reStructuredText.
daira Nov 8, 2024
ba09951
Use `$...$` for inline math in existing reStructuredText ZIPs.
daira Nov 12, 2024
936223b
Switch from MathJax to KaTeX. fixes #432
daira Nov 9, 2024
e1ddb75
Various formatting tweaks.
daira Nov 9, 2024
673cbc7
Rewrite the rendering in a more functional style.
daira Nov 9, 2024
96dafb2
Re-render.
daira Nov 12, 2024
f3d5eb0
Merge pull request #953 from daira/easier-math-in-rst
daira Nov 19, 2024
c3ce2f5
Dockerfile: ensure `/zips` is treated as a safe directory.
daira Nov 19, 2024
098f9e8
Dockerfile: install MultiMarkdown-6.
daira Nov 19, 2024
efa3ec7
Use, and document how to install, MultiMarkdown-6.
daira Nov 19, 2024
cf9b843
Ensure that Markdown ZIPs also have section bookmarks.
daira Nov 23, 2024
668a006
CSS: fix rendering of citation links for Markdown.
daira Nov 24, 2024
4476360
ZIP 231: Fix a typo.
daira Nov 24, 2024
757f498
$\LaTeX$ works now in Markdown.
daira Nov 24, 2024
2bbe652
Re-render HTML.
daira Nov 24, 2024
998a97f
Merge pull request #963 from daira/use-multimarkdown
conradoplg Nov 29, 2024
47ab5b8
Merge branch 'main' into upstream_update_20241217
vivek-arte Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
*.save
*.save.*
*~
*.html.temp

.Makefile.uptodate
.zipfilelist.*
.draftfilelist.*

MultiMarkdown-6

protocol/aux/
protocol/protocol.ver
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM debian:latest

RUN apt-get update
RUN apt-get install -y \
gawk \
perl \
sed \
git \
cmake \
python3 \
python3-pip \
pandoc \
Expand All @@ -18,7 +18,12 @@ RUN apt-get install -y \
texlive-bibtex-extra

RUN rm /usr/lib/python3.11/EXTERNALLY-MANAGED
RUN pip install rst2html5
RUN pip install 'docutils==0.21.2' 'rst2html5==2.0.1'

RUN git config --global --add safe.directory /zips

# Use a fork so that we're running pinned code.
RUN git clone -b develop https://github.com/Electric-Coin-Company/MultiMarkdown-6 && cd MultiMarkdown-6 && make release && cd build && make && make install

ENV PATH=${PATH}:/root/.local/bin

Expand Down
30 changes: 10 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Dependencies: see zip-guide.rst and protocol/README.rst
# Dependencies: see zips/zip-guide.rst and protocol/README.rst

MARKDOWN_OPTION?=--mmd

.PHONY: all-zips all tag-release protocol all-protocol discard
all-zips: .Makefile.uptodate
Expand Down Expand Up @@ -31,30 +33,18 @@ all-specs: all-zips
discard:
git checkout -- 'rendered/*.html' 'README.rst' 'rendered/protocol/*.pdf'

.Makefile.uptodate: Makefile edithtml.sh
.Makefile.uptodate: Makefile render.sh
$(MAKE) clean
touch .Makefile.uptodate

define PROCESSRST
$(eval TITLE := $(shell echo '$(patsubst zips/%,%,$(basename $<))' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
rst2html5 -v --title="$(TITLE)" $< >$@
./edithtml.sh --rst $@
endef

define PROCESSMD
$(eval TITLE := $(shell echo '$(patsubst zips/%,%,$(basename $<))' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
pandoc --from=markdown --to=html $< --output=$@
./edithtml.sh --md $@ "${TITLE}"
endef

rendered/index.html: README.rst edithtml.sh
$(PROCESSRST)
rendered/index.html: README.rst render.sh
./render.sh --rst $< $@

rendered/%.html: zips/%.rst edithtml.sh
$(PROCESSRST)
rendered/%.html: zips/%.rst render.sh
./render.sh --rst $< $@

rendered/%.html: zips/%.md edithtml.sh
$(PROCESSMD)
rendered/%.html: zips/%.md render.sh
./render.sh $(MARKDOWN_OPTION) $< $@

README.rst: .zipfilelist.current .draftfilelist.current makeindex.sh README.template $(wildcard zips/zip-*.rst) $(wildcard zips/zip-*.md) $(wildcard zips/draft-*.rst) $(wildcard zips/draft-*.md)
./makeindex.sh | cat README.template - >README.rst
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Released ZIPs
<tr> <td>321</td> <td class="left"><a href="zips/zip-0321.rst">Payment Request URIs</a></td> <td>Proposed</td>
<tr> <td>401</td> <td class="left"><a href="zips/zip-0401.rst">Addressing Mempool Denial-of-Service</a></td> <td>Active</td>
<tr> <td>1014</td> <td class="left"><a href="zips/zip-1014.rst">Establishing a Dev Fund for ECC, ZF, and Major Grants</a></td> <td>Active</td>
<tr> <td>1015</td> <td class="left"><a href="zips/zip-1015.rst">Block Reward Allocation for Non-Direct Development Funding</a></td> <td>Proposed</td>
<tr> <td>1015</td> <td class="left"><a href="zips/zip-1015.rst">Block Subsidy Allocation for Non-Direct Development Funding</a></td> <td>Proposed</td>
<tr> <td>2001</td> <td class="left"><a href="zips/zip-2001.rst">Lockbox Funding Streams</a></td> <td>Implemented (zcashd and zebrad)</td>
</table></embed>

Expand Down Expand Up @@ -342,7 +342,7 @@ Index of ZIPs
<tr> <td><strike>1012</strike></td> <td class="left"><strike><a href="zips/zip-1012.rst">Dev Fund to ECC + ZF + Major Grants</a></strike></td> <td>Obsolete</td>
<tr> <td><strike>1013</strike></td> <td class="left"><strike><a href="zips/zip-1013.rst">Keep It Simple, Zcashers: 10% to ECC, 10% to ZF</a></strike></td> <td>Obsolete</td>
<tr> <td>1014</td> <td class="left"><a href="zips/zip-1014.rst">Establishing a Dev Fund for ECC, ZF, and Major Grants</a></td> <td>Active</td>
<tr> <td>1015</td> <td class="left"><a href="zips/zip-1015.rst">Block Reward Allocation for Non-Direct Development Funding</a></td> <td>Proposed</td>
<tr> <td>1015</td> <td class="left"><a href="zips/zip-1015.rst">Block Subsidy Allocation for Non-Direct Development Funding</a></td> <td>Proposed</td>
<tr> <td>2001</td> <td class="left"><a href="zips/zip-2001.rst">Lockbox Funding Streams</a></td> <td>Implemented (zcashd and zebrad)</td>
<tr> <td>2002</td> <td class="left"><a href="zips/zip-2002.rst">Explicit Fees</a></td> <td>Draft</td>
<tr> <td>2003</td> <td class="left"><a href="zips/zip-2003.rst">Disallow version 4 transactions</a></td> <td>Draft</td>
Expand Down
49 changes: 0 additions & 49 deletions edithtml.sh

This file was deleted.

4 changes: 2 additions & 2 deletions protocol/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Build dependencies on Debian-based systems include, at least:

.. code::
apt install python3-pip pandoc perl sed perl \
apt install python3-pip perl sed cmake \
texlive texlive-science texlive-fonts-extra texlive-bibtex-extra biber latexmk
Prior to Bullseye you may also need the ``awk`` and ``texlive-generic-recommended``
Expand All @@ -16,7 +16,7 @@ For link checking, you will also need the following Python packages:

.. code::
pip3 install docutils==0.19 rst2html5 certifi PyPDF2
pip3 install 'docutils==0.21.2' 'rst2html5==2.0.1' certifi PyPDF2
Building
Expand Down
6 changes: 5 additions & 1 deletion protocol/protocol.tex
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,11 @@
\newcommand{\labelcolor}{cream}

\iftoggle{isnusix}{
\providecommand{\baseurl}{https://zips.z.cash/protocol/protocol.pdf}
\iftoggle{darkmode}{
\providecommand{\baseurl}{https://zips.z.cash/protocol/protocol-dark.pdf}
}{
\providecommand{\baseurl}{https://zips.z.cash/protocol/protocol.pdf}
}
\toggletrue{isnufive}
\newcommand{\setnusix}{\color{\nusixcolor}}
\newcommand{\nusix}[1]{\texorpdfstring{{\setnusix{#1}}}{#1}}
Expand Down
2 changes: 1 addition & 1 deletion protocol/zcash.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ @misc{ZIP-1014
@misc{ZIP-1015,
presort={ZIP-1015},
author={Jason McGee and @Peacemonger and Kris Nuttycombe},
title={Block Reward Allocation for Non-Direct Development Funding},
title={Block Subsidy Allocation for Non-Direct Development Funding},
howpublished={Zcash Improvement Proposal 1015. Created August~26, 2024.},
url={https://zips.z.cash/zip-1015},
urldate={2024-09-24}
Expand Down
91 changes: 91 additions & 0 deletions render.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

set -euo pipefail

if ! ( ( [ "x$1" = "x--rst" ] || [ "x$1" = "x--pandoc" ] || [ "x$1" = "x--mmd" ] ) && [ $# -eq 3 ] ); then
cat - <<EndOfUsage
Usage: render.sh --rst|--pandoc|--mmd <inputfile> <htmlfile> <title>

--rst render reStructuredText using rst2html5
--pandoc render Markdown using pandoc
--mmd render Markdown using multimarkdown
EndOfUsage
exit
fi

inputfile="$2"
outputfile="$3"

if ! [ -f "${inputfile}" ]; then
echo "File not found: ${inputfile}"
exit
fi

if [ "x$1" = "x--rst" ]; then
filetype='.rst'
else
filetype='.md'
fi
title="$(basename -s ${filetype} ${inputfile} | sed -E 's|zip-0{0,3}|ZIP |; s|draft-|Draft |')$(grep -E '^(\.\.)?\s*Title: ' ${inputfile} |sed -E 's|.*Title||')"
echo " ${title}"

Math1='<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">'
Math2='<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>'
Math3='<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>'
ViewAndStyle='<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css">'

cat <(
if [ "x$1" = "x--rst" ]; then
# These are basic regexps so \+ is needed, not +.
# We use the Unicode 💲 character to move an escaped $ out of the way,
# which is much easier than trying to handle escapes within a capture.

cat "${inputfile}" \
| sed 's|[\][$]|💲|g;
s|[$]\([^$]\+\)[$]\([.,:;!?)-]\)|:math:`\1\\!`\2|g;
s|[$]\([^$]\+\)[$]|:math:`\1`|g;
s|💲|$|g' \
| rst2html5 -v --title="${title}" - \
| sed "s|<script src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"></script>|${Math1}\n ${Math2}\n ${Math3}|;
s|</head>|${ViewAndStyle}</head>|"
else
if [ "x$1" = "x--pandoc" ]; then
# Not actually MathJax. KaTeX is compatible if we use the right headers.
pandoc --mathjax --from=markdown --to=html "${inputfile}" --output="${outputfile}.temp"
else
multimarkdown ${inputfile} -o "${outputfile}.temp"
fi

# Both pandoc and multimarkdown just output the HTML body.
echo "<!DOCTYPE html>"
echo "<html>"
echo "<head>"
echo " <title>${title}</title>"
echo " <meta charset=\"utf-8\" />"
if grep -q -E 'class="math( inline)?"' "${outputfile}.temp"; then
echo " ${Math1}"
echo " ${Math2}"
echo " ${Math3}"
fi
echo " ${ViewAndStyle}"
echo "</head>"
echo "<body>"
cat "${outputfile}.temp"
rm -f "${outputfile}.temp"
echo "</body>"
echo "</html>"
fi
) \
| sed \
's|<a href="[^":]*">Protocol Specification</a>|<span class="lightmode"><a href="https://zips.z.cash/protocol/protocol.pdf">Protocol Specification</a></span>|g;
s|\s*<a href="[^":]*">(dark mode version)</a>|<span class="darkmode" style="display: none;"><a href="https://zips.z.cash/protocol/protocol-dark.pdf">Protocol Specification</a></span>|g;
s|<a \(class=[^ ]* \)*href="\([^":]*\)\.rst\(\#[^"]*\)*">|<a \1href="\2\3">|g;
s|<a \(class=[^ ]* \)*href="\([^":]*\)\.md\(\#[^"]*\)*">|<a \1href="\2\3">|g;
s|&lt;\(https:[^&]*\)&gt;|\&lt;<a href="\1">\1</a>\&gt;|g;
s|src="../rendered/|src="|g;
s|<a href="rendered/|<a href="|g;
s|<a \(class=[^ ]* \)*href="zips/|<a \1href="|g' \
| perl -p0e \
's|<section id="([^"]*)">\s*.?\s*<h([1-9])>([^<]*(?:<code>[^<]*</code>[^<]*)?)</h([1-9])>|<section id="\1"><h\2><span class="section-heading">\3</span><span class="section-anchor"> <a rel="bookmark" href="#\1"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h\4>|g;
s|<h([1-9]) id="([^"]*)">([^<]*(?:<code>[^<]*</code>[^<]*)?)</h([1-9])>|<h\1 id="\2"><span class="section-heading">\3</span><span class="section-anchor"> <a rel="bookmark" href="#\2"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h\4>|g;' \
> "${outputfile}"
Loading