Use code block instead of pre for markdown

This commit is contained in:
Anthony Towns 2025-02-08 20:04:18 +10:00
parent ea7aae8d1f
commit 726df6f4d5
4 changed files with 17 additions and 8 deletions

View File

@ -1,4 +1,4 @@
<pre> ```
BIP: 348 BIP: 348
Layer: Consensus (soft fork) Layer: Consensus (soft fork)
Title: CHECKSIGFROMSTACK Title: CHECKSIGFROMSTACK
@ -9,7 +9,7 @@
Type: Standards Track Type: Standards Track
Created: 2024-11-26 Created: 2024-11-26
License: BSD-3-Clause License: BSD-3-Clause
</pre> ```
## Abstract ## Abstract

View File

@ -1,4 +1,4 @@
<pre> ```
BIP: 349 BIP: 349
Layer: Consensus (soft fork) Layer: Consensus (soft fork)
Title: OP_INTERNALKEY Title: OP_INTERNALKEY
@ -9,7 +9,7 @@
Type: Standards Track Type: Standards Track
Created: 2024-11-14 Created: 2024-11-14
License: BSD-3-Clause License: BSD-3-Clause
</pre> ```
## Abstract ## Abstract

View File

@ -1,4 +1,4 @@
<pre> ```
BIP: 379 BIP: 379
Layer: Applications Layer: Applications
Title: Miniscript Title: Miniscript
@ -13,7 +13,7 @@
Type: Informational Type: Informational
Created: 2023-10-10 Created: 2023-10-10
License: CC0-1.0 License: CC0-1.0
</pre> ```
## Abstract ## Abstract

View File

@ -96,19 +96,28 @@ my %emails;
my $bipnum = 0; my $bipnum = 0;
while (++$bipnum <= $topbip) { while (++$bipnum <= $topbip) {
my $fn = sprintf "bip-%04d.mediawiki", $bipnum; my $fn = sprintf "bip-%04d.mediawiki", $bipnum;
my $is_markdown = 0;
if (!-e $fn) { if (!-e $fn) {
$fn = sprintf "bip-%04d.md", $bipnum; $fn = sprintf "bip-%04d.md", $bipnum;
$is_markdown = 1;
} }
-e $fn || next; -e $fn || next;
open my $F, "<$fn"; open my $F, "<$fn";
while (<$F> !~ m[^(?:\xef\xbb\xbf)?<pre>$]) { if ($is_markdown) {
while (<$F> !~ m[^(?:\xef\xbb\xbf)?```$]) {
die "No ``` in $fn" if eof $F;
}
} else {
while (<$F> !~ m[^(?:\xef\xbb\xbf)?<pre>$]) {
die "No <pre> in $fn" if eof $F; die "No <pre> in $fn" if eof $F;
}
} }
my %found; my %found;
my ($title, $author, $status, $type, $layer); my ($title, $author, $status, $type, $layer);
my ($field, $val); my ($field, $val);
while (<$F>) { while (<$F>) {
m[^</pre>$] && last; last if ($is_markdown && m[^```$]);
last if (!$is_markdown && m[^</pre>$]);
if (m[^ ([\w-]+)\: (.*\S)$]) { if (m[^ ([\w-]+)\: (.*\S)$]) {
$field = $1; $field = $1;
$val = $2; $val = $2;