edithtml.sh: make it work on macOS (by using perl instead of sed).

Also add permalink anchors to headers containing <code>...</code>.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2020-06-15 13:13:04 +01:00
parent 5ef8079d32
commit aaf0c04f79
3 changed files with 13 additions and 15 deletions

View File

@ -35,8 +35,6 @@ fi
sed -i.sedbak 's|<a href="\([^":]*\).rst">|<a href="\1">|g' $2
# Put <section id="..."> and <hN>...</hN> on the same line. <https://unix.stackexchange.com/a/337399/82702>
sed -i.sedbak -n '$!N;s|<section id="\([^"]*\)">\s*\n\s*<h|<section id="\1"><h|;P;D' $2
sed -i.sedbak 's|<section id="\([^"]*\)"><h\([1-9]\)>\([^<]*\)</h\([1-9]\)>|<section id="\1"><h\2><span class="section-heading">\3</span><span class="section-anchor"> <a href="#\1"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h\4>|' $2
perl -i.sedbak -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 href="#\1"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h\4>|g' "$2"
rm -f *.sedbak

View File

@ -65,13 +65,13 @@ License: MIT</pre>
</ol>
<section id="field-definitions"><h3><span class="section-heading">Field definitions</span><span class="section-anchor"> <a href="#field-definitions"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The items 7, 9, 10a, 10d have the same meaning as the original algorithm from Bitcoin. <a id="id15" class="footnote_reference" href="#wiki-checksig">2</a></p>
<section id="header"><h4>1: <code>header</code></h4>
<section id="header"><h4><span class="section-heading">1: <code>header</code></span><span class="section-anchor"> <a href="#header"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>Deserialized into two transaction properties: <code>fOverwintered</code> and <code>nVersion</code>. For transactions that use this transaction digest algorithm, <code>fOverwintered</code> is always set. <a id="id16" class="footnote_reference" href="#zip-0202">12</a></p>
</section>
<section id="nversiongroupid"><h4>2: <code>nVersionGroupId</code></h4>
<section id="nversiongroupid"><h4><span class="section-heading">2: <code>nVersionGroupId</code></span><span class="section-anchor"> <a href="#nversiongroupid"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>Provides domain separation of <code>nVersion</code>. It is only defined if <code>fOverwintered</code> is set, which means that it is always defined for transactions that use this algorithm. <a id="id17" class="footnote_reference" href="#zip-0202">12</a></p>
</section>
<section id="hashprevouts"><h4>3: <code>hashPrevouts</code></h4>
<section id="hashprevouts"><h4><span class="section-heading">3: <code>hashPrevouts</code></span><span class="section-anchor"> <a href="#hashprevouts"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If the <code>ANYONECANPAY</code> flag is not set, <code>hashPrevouts</code> is the BLAKE2b-256 hash of the serialization of all input outpoints;
<ul>
@ -81,7 +81,7 @@ License: MIT</pre>
<li>Otherwise, <code>hashPrevouts</code> is a <code>uint256</code> of <code>0x0000......0000</code>.</li>
</ul>
</section>
<section id="hashsequence"><h4>4: <code>hashSequence</code></h4>
<section id="hashsequence"><h4><span class="section-heading">4: <code>hashSequence</code></span><span class="section-anchor"> <a href="#hashsequence"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If none of the <code>ANYONECANPAY</code>, <code>SINGLE</code>, <code>NONE</code> sighash type is set, <code>hashSequence</code> is the BLAKE2b-256 hash of the serialization of <code>nSequence</code> of all inputs;
<ul>
@ -92,7 +92,7 @@ License: MIT</pre>
</ul>
<p>Note: the encoding of the sighash type is masked with <code>0x1F</code> when checking whether or not the <code>SINGLE</code> and <code>NONE</code> flags are set.</p>
</section>
<section id="hashoutputs"><h4>5: <code>hashOutputs</code></h4>
<section id="hashoutputs"><h4><span class="section-heading">5: <code>hashOutputs</code></span><span class="section-anchor"> <a href="#hashoutputs"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If the sighash type is neither <code>SINGLE</code> nor <code>NONE</code>, <code>hashOutputs</code> is the BLAKE2b-256 hash of the serialization of all output amount (8-byte little endian) with <code>scriptPubKey</code> (serialized as scripts inside CTxOuts);</li>
<li>If sighash type is <code>SINGLE</code> and the input index is smaller than the number of outputs, <code>hashOutputs</code> is the BLAKE2b-256 hash of the output (serialized as above) with the same index as the input;
@ -104,7 +104,7 @@ License: MIT</pre>
</ul>
<p>Note: the encoding of the sighash type is masked with <code>0x1F</code> when checking whether or not the <cite>SINGLE`</cite> and <code>NONE</code> flags are set.</p>
</section>
<section id="hashjoinsplits"><h4>6: <code>hashJoinSplits</code></h4>
<section id="hashjoinsplits"><h4><span class="section-heading">6: <code>hashJoinSplits</code></span><span class="section-anchor"> <a href="#hashjoinsplits"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If <code>vjoinsplits</code> is non-empty, <code>hashJoinSplits</code> is the BLAKE2b-256 hash of the serialization of all JoinSplits (in their canonical transaction serialization format) concatenated with the joinSplitPubKey;
<ul>
@ -115,10 +115,10 @@ License: MIT</pre>
<li>Otherwise, <code>hashJoinSplits</code> is a <code>uint256</code> of <code>0x0000......0000</code>.</li>
</ul>
</section>
<section id="nexpiryheight"><h4>8: <code>nExpiryHeight</code></h4>
<section id="nexpiryheight"><h4><span class="section-heading">8: <code>nExpiryHeight</code></span><span class="section-anchor"> <a href="#nexpiryheight"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The block height after which the transaction becomes unilaterally invalid, and can never be mined. <a id="id19" class="footnote_reference" href="#zip-0203">13</a></p>
</section>
<section id="b-scriptcode"><h4>10b: <code>scriptCode</code></h4>
<section id="b-scriptcode"><h4><span class="section-heading">10b: <code>scriptCode</code></span><span class="section-anchor"> <a href="#b-scriptcode"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>The script being currently executed: <code>redeemScript</code> for P2SH, or <code>scriptPubKey</code> in the general case. This is the same script as serialized in the Sprout transaction digest algorithm.</p>
</section>
<section id="c-value"><h4><span class="section-heading">10c: value</span><span class="section-anchor"> <a href="#c-value"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>

View File

@ -57,7 +57,7 @@ License: MIT</pre>
<p>Semantics of the original sighash types are as in ZIP 143 <a id="id9" class="footnote_reference" href="#zip-0143">4</a>.</p>
<section id="field-definitions"><h3><span class="section-heading">Field definitions</span><span class="section-anchor"> <a href="#field-definitions"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h3>
<p>The items 1, 2, 3, 4, 5, 9, 10, 12, and 13 have the same meaning as in ZIP 143 <a id="id10" class="footnote_reference" href="#zip-0143">4</a>.</p>
<section id="hashjoinsplits"><h4>6: <code>hashJoinSplits</code></h4>
<section id="hashjoinsplits"><h4><span class="section-heading">6: <code>hashJoinSplits</code></span><span class="section-anchor"> <a href="#hashjoinsplits"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If <code>vjoinsplits</code> is non-empty, <code>hashJoinSplits</code> is the BLAKE2b-256 hash of the serialization of all JoinSplit descriptions (in their canonical v4 transaction serialization format) concatenated with the <code>joinSplitPubKey</code>;
<ul>
@ -68,7 +68,7 @@ License: MIT</pre>
<li>Otherwise, <code>hashJoinSplits</code> is a <code>uint256</code> of <code>0x0000......0000</code>.</li>
</ul>
</section>
<section id="hashshieldedspends"><h4>7: <code>hashShieldedSpends</code></h4>
<section id="hashshieldedspends"><h4><span class="section-heading">7: <code>hashShieldedSpends</code></span><span class="section-anchor"> <a href="#hashshieldedspends"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If <code>vShieldedSpend</code> is non-empty, <code>hashShieldedSpends</code> is the BLAKE2b-256 hash of the serialization of all Spend Descriptions (in their canonical transaction serialization format minus <code>spendAuthSig</code>);
<ul>
@ -79,7 +79,7 @@ License: MIT</pre>
<li>Otherwise, <code>hashShieldedSpends</code> is a <code>uint256</code> of <code>0x0000......0000</code>.</li>
</ul>
</section>
<section id="hashshieldedoutputs"><h4>8: <code>hashShieldedOutputs</code></h4>
<section id="hashshieldedoutputs"><h4><span class="section-heading">8: <code>hashShieldedOutputs</code></span><span class="section-anchor"> <a href="#hashshieldedoutputs"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<ul>
<li>If <code>vShieldedOutput</code> is non-empty, <code>hashShieldedOutputs</code> is the BLAKE2b-256 hash of the serialization of all Output Descriptions (in their canonical transaction serialization format);
<ul>
@ -90,7 +90,7 @@ License: MIT</pre>
<li>Otherwise, <code>hashShieldedOutputs</code> is a <code>uint256</code> of <code>0x0000......0000</code>.</li>
</ul>
</section>
<section id="valuebalance"><h4>11: <code>valueBalance</code></h4>
<section id="valuebalance"><h4><span class="section-heading">11: <code>valueBalance</code></span><span class="section-anchor"> <a href="#valuebalance"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h4>
<p>An 8-byte signed two's-complement little-endian value of the net amount, in zatoshi, exiting the Sapling value pool. For clarity, a negative value corresponds to an amount <em>entering</em> the Sapling value pool.</p>
</section>
</section>