1
0
mirror of https://github.com/bitcoin/bips.git synced 2025-07-21 12:58:14 +00:00

10 Commits

Author SHA1 Message Date
Yuval Kogman
cd19d89e58 scripted-diff: fix BIP 2 field order violations
-BEGIN VERIFY SCRIPT-
set -e
perl <<'-END PERL-'
use strict;
use warnings;

my $topbip = 9999;

my @FieldOrder = qw(
	BIP
	Layer
	Title
	Author
	Authors
	Editor
	Deputies
	Discussions-To
	Comments-Summary
	Comments-URI
	Status
	Type
	Created
	License
	License-Code
	Discussion
	Post-History
	Version
	Requires
	Replaces
	Proposed-Replacement
	Superseded-By
);

my $bipnum = 0;
while (++$bipnum <= $topbip) {
	my $fn = sprintf "bip-%04d.mediawiki", $bipnum;
	my $is_markdown = 0;
	if (!-e $fn) {
		$fn = sprintf "bip-%04d.md", $bipnum;
		$is_markdown = 1;
	}
	-e $fn || next;
	open my $F, "<", $fn or die "$!";

	my (@before, %preamble, @after);

	if ($is_markdown) {
		while (<$F>) {
			push @before, $_;
			last if m[^(?:\xef\xbb\xbf)?```$]
		}
		die "No ``` in $fn" if eof $F;
	} else {
		while (<$F>) {
			push @before, $_;
			last if m[^(?:\xef\xbb\xbf)?<pre>$];
		}
		die "No <pre> in $fn" if eof $F;
	}
	my %found;
	my ($title, $author, $status, $type, $layer);
	my ($field, $val, @field_order);
	while (<$F>) {
		push @after, $_ and last if ($is_markdown && m[^```$]);
		push @after, $_ and last if (!$is_markdown && m[^</pre>$]);

		if (m[^  ([\w-]+)\: (.*\S)$]) {
			$field = $1;
			$val = $2;
		} elsif (m[^  ( +)(.*\S)$]) {
			$val = $2;
		} else {
			die "Bad line in $fn preamble";
		}

		push @{$preamble{$field} ||= []}, $_;
	}
	push @after, <$F>;
	close $F or die $!;

	open my $W, ">", "$fn" or die "$!";

	print $W @before;
	print $W map { @$_ } grep { defined } delete @preamble{@FieldOrder};
	die "Unknown fields: @{[ keys %preamble ]}" if %preamble;
	print $W @after;

	close $W or die $!;
}
-END PERL-
-END VERIFY SCRIPT-
2025-07-20 14:29:13 -06:00
cocoyeal
46a2440718 remove duplicated words 2024-05-29 16:18:11 +08:00
Christian Lewe
9b03e64c93 Mark bech32m as final 2023-05-18 18:08:00 +02:00
Luke Dashjr
faeb2ccd24
Merge pull request #1066 from SomberNight/202002_bip350_fix_links
bip-0350: fix links for reference implementations
2021-02-09 22:04:33 +00:00
SomberNight
b58dd7bc1a
bip-0350: fix links for reference implementations 2021-02-05 18:38:42 +01:00
Pieter Wuille
c5b392cce1 Add back a few lost improvements 2021-02-03 16:22:46 -08:00
Pieter Wuille
6446f2af0a Update bip-0350.mediawiki
Co-authored-by: andrewtoth <andrewstoth@gmail.com>
2021-01-29 13:41:08 -08:00
Pieter Wuille
d3874ff3ec Update bip-0350.mediawiki
Co-authored-by: andrewtoth <andrewstoth@gmail.com>
2021-01-29 13:41:08 -08:00
Pieter Wuille
e192983f5b Update bip-0350.mediawiki
Co-authored-by: andrewtoth <andrewstoth@gmail.com>
2021-01-29 13:41:08 -08:00
Pieter Wuille
6128a7bcb6 Add BIP 350 (bech32m) 2021-01-29 13:41:08 -08:00