From 68a8faf9069b1b0e8be9dac76790807af63b6bd9 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 16:36:14 +0000 Subject: [PATCH 01/38] Add a simple website --- .github/workflows/buildsite.yml | 52 ++++++++++++++++++ .gitignore | 1 + CNAME | 1 + bin/build | 61 +++++++++++++++++++++ cpanfile | 3 ++ in/index.tt | 26 +++++++++ in/style.css | 3 ++ lib/PPC.pm | 67 +++++++++++++++++++++++ ttlib/page.tt | 95 +++++++++++++++++++++++++++++++++ 9 files changed, 309 insertions(+) create mode 100644 .github/workflows/buildsite.yml create mode 100644 .gitignore create mode 100644 CNAME create mode 100755 bin/build create mode 100644 cpanfile create mode 100644 in/index.tt create mode 100644 in/style.css create mode 100644 lib/PPC.pm create mode 100644 ttlib/page.tt diff --git a/.github/workflows/buildsite.yml b/.github/workflows/buildsite.yml new file mode 100644 index 0000000..df78430 --- /dev/null +++ b/.github/workflows/buildsite.yml @@ -0,0 +1,52 @@ +name: Generate web page + +on: + push: + branches: 'main' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + container: perl:latest + + steps: + - name: Perl version + run: perl -v + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pandoc and cpanm + run: apt-get update && apt-get install -y pandoc cpanminus + + - name: Install modules + run: | + cpanm --installdeps --notest . + + - name: Create pages + env: + PERL5LIB: lib + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mkdir -p web + perl bin/build + + - name: Update pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: web/ + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73cf2e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +web/ diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..183766f --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +ppc.perlhacks.com diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..b9cb024 --- /dev/null +++ b/bin/build @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use v5.38; +use File::Copy; +use Template; +use Template::Provider::Pandoc; + +use PPC; + +my @ppcs; +my %status; + +my $outpath = './web'; +my $template_path = [ './ppcs', './docs', './in', './ttlib' ]; + +my $provider = Template::Provider::Pandoc->new({ + INCLUDE_PATH => $template_path, +}); + +my $tt = Template->new({ + LOAD_TEMPLATES => [ $provider ], + INCLUDE_PATH => $template_path, + OUTPUT_PATH => $outpath, + RELATIVE => 1, + WRAPPER => 'page.tt', +}); + +for () { + my $ppc = PPC->new_from_file($_); + push @ppcs, $ppc; + + $tt->process($ppc->in_path, {}, $ppc->out_path) + or warn $tt->error; +} + +my $vars = { + ppcs => \@ppcs, +}; + +$tt->process('index.tt', $vars, 'index.html') + or die $tt->error; + +for () { + s|^docs/||; + my $out = s|\.md|/index.html|r; + + $tt->process($_, {}, $out) + or die $tt->error; +} + +mkdir 'web/images'; +for () { + copy $_, "web/$_"; +} + +if (-f 'CNAME') { + copy 'CNAME', "web/CNAME"; +} diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..077649f --- /dev/null +++ b/cpanfile @@ -0,0 +1,3 @@ +requires 'File::Copy'; +requires 'Template'; +requires 'Template::Provider::Pandoc'; diff --git a/in/index.tt b/in/index.tt new file mode 100644 index 0000000..60c72d0 --- /dev/null +++ b/in/index.tt @@ -0,0 +1,26 @@ +

Proposed Perl Changes

+ +

Welcome to the Proposed Perl Changes web site.

+ + + + + + + + + + + + +[% FOR ppc IN ppcs -%] + + + + + + + +[% END -%] + +
IDStatusAuthor(s)SponsorTitle
[% ppc.id | html %][% ppc.status | html %][% ppc.author | html %][% ppc.sponsor | html %][% ppc.title | html %]
diff --git a/in/style.css b/in/style.css new file mode 100644 index 0000000..ff5ebd0 --- /dev/null +++ b/in/style.css @@ -0,0 +1,3 @@ +main > .container { + padding: 60px 15px 0; +} diff --git a/lib/PPC.pm b/lib/PPC.pm new file mode 100644 index 0000000..de64360 --- /dev/null +++ b/lib/PPC.pm @@ -0,0 +1,67 @@ +use experimental qw[builtin class signatures]; + +class PPC; + +use builtin 'trim'; + +field $author :param = ''; +field $id :param; +field $slug :param; +field $sponsor :param = ''; +field $status :param; +field $title :param; + +method author { return $author } +method id { return $id } +method slug { return $slug } +method sponsor { return $sponsor } +method status { return $status } +method title { return $title } + +method in_path { + return "$slug.md"; +} + +method out_path { + return "$slug/index.html"; +} + +# Very hacky parser + +sub new_from_file($class, $ppc_file) { + + open my $ppc_fh, '<', $ppc_file + or warn "Cannot open PPC [$_]: $!\n" and return; + + my (%ppc, $is_preamble); + + $ppc{slug} = $ppc_file; + $ppc{slug} =~ s|^ppcs/||; + $ppc{slug} =~ s|\.md$||; + + while (<$ppc_fh>) { + $. == 1 and m|#\s+(.*)| and $ppc{title} = $1; + + $is_preamble and /## abstract/i and last; + + $_ = trim($_); + + if ($is_preamble and $_) { + + my ($key, $value) = split(/\s*:\s*/, $_, 2); + + $ppc{lc $key} = $value; + } + + # 'pre.+mble' because Paul likes to use 'Preämble' + /## pre.+mble/i and $is_preamble = 1; + } + + if (exists $ppc{authors}) { + $ppc{author} = delete $ppc{authors} + } + + return $class->new(%ppc); +} + +1; diff --git a/ttlib/page.tt b/ttlib/page.tt new file mode 100644 index 0000000..2f5e2e0 --- /dev/null +++ b/ttlib/page.tt @@ -0,0 +1,95 @@ + + + + + + + + + Proposed Perl Changes + + + + + + + + + + + + + + + +
+ + +
+ + +
+
+[% content %] +
+
+ +
+
+ Place sticky footer content here. +
+
+ + + + From 07936cb99235d1df25044fdab996ea9d6fb94f94 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 17:16:59 +0000 Subject: [PATCH 02/38] Copy the CSS into place --- bin/build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/build b/bin/build index b9cb024..1ffbc6f 100755 --- a/bin/build +++ b/bin/build @@ -56,6 +56,10 @@ for () { copy $_, "web/$_"; } +if (-f 'in/style.css') { + copy 'in/style.css', 'web/style.css'; +} + if (-f 'CNAME') { copy 'CNAME', "web/CNAME"; } From f68f457ec65cc2fd8489cb5d793c44542cbf4c5e Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 18:16:27 +0000 Subject: [PATCH 03/38] Add JSON download --- bin/build | 10 ++++++++++ in/index.tt | 1 + lib/PPC.pm | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/bin/build b/bin/build index 1ffbc6f..da905d6 100755 --- a/bin/build +++ b/bin/build @@ -5,6 +5,7 @@ use warnings; use v5.38; use File::Copy; +use JSON; use Template; use Template::Provider::Pandoc; @@ -63,3 +64,12 @@ if (-f 'in/style.css') { if (-f 'CNAME') { copy 'CNAME', "web/CNAME"; } + +my $json = JSON->new->pretty->canonical->encode([ + map { $_->as_data } @ppcs +]); + +open my $json_fh, '>', 'web/ppcs.json' or die $!; + +print $json_fh $json; + diff --git a/in/index.tt b/in/index.tt index 60c72d0..dbaa06c 100644 --- a/in/index.tt +++ b/in/index.tt @@ -2,6 +2,7 @@

Welcome to the Proposed Perl Changes web site.

+

Download this data as JSON

diff --git a/lib/PPC.pm b/lib/PPC.pm index de64360..fbeaa03 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -26,6 +26,17 @@ method out_path { return "$slug/index.html"; } +method as_data { + return { + id => $id, + status => $status, + author => $author, + sponsor => $sponsor, + slug => $slug, + title => $title, + }; +} + # Very hacky parser sub new_from_file($class, $ppc_file) { From 98d7b9319a8fb6c4cee76d7382ef17bc485cb132 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 18:19:39 +0000 Subject: [PATCH 04/38] Forgot something :-/ --- cpanfile | 1 + 1 file changed, 1 insertion(+) diff --git a/cpanfile b/cpanfile index 077649f..f210f57 100644 --- a/cpanfile +++ b/cpanfile @@ -1,3 +1,4 @@ requires 'File::Copy'; +requires 'JSON'; requires 'Template'; requires 'Template::Provider::Pandoc'; From 74b905371b2d676fd1d4adbb64000b6688d600f8 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 14 Jan 2025 09:45:16 +0000 Subject: [PATCH 05/38] Obfuscate email addresses in main table --- lib/PPC.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PPC.pm b/lib/PPC.pm index fbeaa03..d076fbc 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -72,6 +72,8 @@ sub new_from_file($class, $ppc_file) { $ppc{author} = delete $ppc{authors} } + $ppc{author} =~ s|\@.+?>|\@XXXX>|g; + return $class->new(%ppc); } From 0c38d1cf6c90af9fd7939e389dd448c13f3bc7e1 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 14 Jan 2025 09:48:03 +0000 Subject: [PATCH 06/38] Add footer text --- ttlib/page.tt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ttlib/page.tt b/ttlib/page.tt index 2f5e2e0..c460bc0 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -84,7 +84,8 @@ From 3bdce96e5afe1d5db65fee0cf016e47822b55c82 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 14 Jan 2025 09:49:30 +0000 Subject: [PATCH 07/38] Same obfuscation for sponsors --- lib/PPC.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PPC.pm b/lib/PPC.pm index d076fbc..6a580ad 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -72,7 +72,7 @@ sub new_from_file($class, $ppc_file) { $ppc{author} = delete $ppc{authors} } - $ppc{author} =~ s|\@.+?>|\@XXXX>|g; + $ppc{$_} =~ s|\@.+?>|\@XXXX>|g for (qw[author sponsor]); return $class->new(%ppc); } From 4a170ee5d7996e67975c2c32f32d50a658592956 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 18 Jan 2025 16:15:39 +0000 Subject: [PATCH 08/38] Make some links relative (so hack works) --- docs/process.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/process.md b/docs/process.md index 063641e..1e5286c 100644 --- a/docs/process.md +++ b/docs/process.md @@ -21,7 +21,7 @@ Hence we need a process that We'd like to record proposals to improve the language and their status as "Request For Comment" documents in their own repository under the Perl organisation on GitHub. -We have a [template](template.md) for what an completed implemented PPC should end up as, but if all you have is an idea - don't worry, we'll help you get there. We're still figuring this process out, so for now we're doing it as mail messages sent to p5p, not as "pull requests" to the PPC repository (or "issues" on the source repository). This way we can see if the process works as hoped, and fix the parts that don't. +We have a [template](./template.md) for what an completed implemented PPC should end up as, but if all you have is an idea - don't worry, we'll help you get there. We're still figuring this process out, so for now we're doing it as mail messages sent to p5p, not as "pull requests" to the PPC repository (or "issues" on the source repository). This way we can see if the process works as hoped, and fix the parts that don't. ## What makes a good idea? @@ -46,7 +46,7 @@ Not every good idea belongs in the Perl core. Some are better implemented on CPA ## The Process -![a flowchart of the process described below](/images/flowchart.png) +![a flowchart of the process described below](./images/flowchart.png) ### Pre-PPC @@ -63,7 +63,7 @@ During this phase, you (the proposer) are responsible for moving things forward. ### Draft Proposal -The PSC has agreed that you should write a formal draft proposal. You get the [template document](template.md) and fill it out. You take its advice, thinking hard about what goes in each section. Then you post it to p5p as an email with the subject "PROPOSAL: my great idea". Members of the list will reply with more questions and suggested amendments. You should read them and amend the proposal to clarify your ideas or react to valid criticism. +The PSC has agreed that you should write a formal draft proposal. You get the [template document](./template.md) and fill it out. You take its advice, thinking hard about what goes in each section. Then you post it to p5p as an email with the subject "PROPOSAL: my great idea". Members of the list will reply with more questions and suggested amendments. You should read them and amend the proposal to clarify your ideas or react to valid criticism. During this phase, you (the proposer) are responsible for moving things forward. From 44f77aac37520d2a302dbe1bb7ae80580b4b9a47 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 18 Jan 2025 16:18:38 +0000 Subject: [PATCH 09/38] Support the use of a element --- .github/workflows/buildsite.yml | 8 ++++++-- CNAME | 1 - bin/build | 8 ++++++++ in/index.tt | 2 +- ttlib/page.tt | 17 ++++++++++------- 5 files changed, 25 insertions(+), 11 deletions(-) delete mode 100644 CNAME diff --git a/.github/workflows/buildsite.yml b/.github/workflows/buildsite.yml index df78430..80c559e 100644 --- a/.github/workflows/buildsite.yml +++ b/.github/workflows/buildsite.yml @@ -22,7 +22,11 @@ jobs: - name: Install modules run: | - cpanm --installdeps --notest . + cpanm --installdeps --notest . + + - name: Get repo name into environment + run: | + echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV - name: Create pages env: @@ -30,7 +34,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | mkdir -p web - perl bin/build + perl bin/build $REPO_NAME - name: Update pages artifact uses: actions/upload-pages-artifact@v3 diff --git a/CNAME b/CNAME deleted file mode 100644 index 183766f..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -ppc.perlhacks.com diff --git a/bin/build b/bin/build index da905d6..d573ca4 100755 --- a/bin/build +++ b/bin/build @@ -17,6 +17,11 @@ my %status; my $outpath = './web'; my $template_path = [ './ppcs', './docs', './in', './ttlib' ]; +my $base = shift || $outpath; +$base =~ s/^\.//; +$base = "/$base" if $base !~ m|^/|; +$base = "$base/" if $base !~ m|/$|; + my $provider = Template::Provider::Pandoc->new({ INCLUDE_PATH => $template_path, }); @@ -27,6 +32,9 @@ my $tt = Template->new({ OUTPUT_PATH => $outpath, RELATIVE => 1, WRAPPER => 'page.tt', + VARIABLES => { + base => $base, + } }); for () { diff --git a/in/index.tt b/in/index.tt index dbaa06c..6c12aa3 100644 --- a/in/index.tt +++ b/in/index.tt @@ -20,7 +20,7 @@ - + [% END -%] diff --git a/ttlib/page.tt b/ttlib/page.tt index c460bc0..16d5217 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -1,6 +1,9 @@ +[% IF base -%] + +[% END -%] @@ -43,29 +46,29 @@ + - [% FOR ppc IN ppcs -%] + - [% END -%] From 91f510360972fdaad2eaa809d6a12b0d0e9f3fa6 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 18 Jan 2025 16:58:50 +0000 Subject: [PATCH 11/38] Fix local css link --- ttlib/page.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttlib/page.tt b/ttlib/page.tt index 16d5217..073a8c7 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -38,7 +38,7 @@ - + From 307795f47e247cd3dfa385d771bc1a6713929b75 Mon Sep 17 00:00:00 2001 From: "Matthew O. Persico" Date: Fri, 10 Jan 2025 22:45:00 -0500 Subject: [PATCH 12/38] Link to related PPC --- ppcs/ppc0030-undef-aware-equality.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppcs/ppc0030-undef-aware-equality.md b/ppcs/ppc0030-undef-aware-equality.md index 8c2f791..fa1b05c 100644 --- a/ppcs/ppc0030-undef-aware-equality.md +++ b/ppcs/ppc0030-undef-aware-equality.md @@ -109,7 +109,7 @@ match( $x : equ ) { * Should we also provide negated versions of these operators? While much rarer in practice, it may be useful to provide a "not equ", perhaps spelled `nequ` or `neu`; and likewise `!===` or `!==` for the numerical version. These do not suffer the sorting order problem outlined above for more general comparisons. -* As an entirely alternate proposal, should we instead find ways to apply behaviour-modifying flags to the existing operators? That is, rather than adding a new `equ` and `===` could we instead consider some syntax such as `eq:u` and `==:u` as a modifier flag, similar to the flags on regexp patterns, as a way to modify operators? This would be extensible in a more general way to more operators, while also allowing more flexible flags in future, such as for instance a case-ignoring string comparison to be spelled `eq:i`. This alternate proposal may be the subject of an alternate PPC document. +* As an entirely alternate proposal, should we instead find ways to apply behaviour-modifying flags to the existing operators? That is, rather than adding a new `equ` and `===` could we instead consider some syntax such as `eq:u` and `==:u` as a modifier flag, similar to the flags on regexp patterns, as a way to modify operators? This would be extensible in a more general way to more operators, while also allowing more flexible flags in future, such as for instance a case-ignoring string comparison to be spelled `eq:i`. This alternate proposal is be the subject of an [alternate PPC document](ppc0031-metaoperator-flags.md). * How to pronounce the name of this new operator? I suggest "ee-koo", avoiding the "you" part of the sound. From 24edcc7b3c0731affec37940e31700cf40d56143 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 24 Jan 2025 15:26:33 +0000 Subject: [PATCH 13/38] Fix JSON link (and anchor text) --- in/index.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/in/index.tt b/in/index.tt index 974ae8e..2e7508b 100644 --- a/in/index.tt +++ b/in/index.tt @@ -2,7 +2,7 @@

Welcome to the Proposed Perl Changes web site.

-

Download this data as JSON

+

Download this data as JSON

[% ppc.status | html %] [% ppc.author | html %] [% ppc.sponsor | html %][% ppc.title | html %][% ppc.title | html %]
IDTitle Status Author(s) SponsorTitle
[% ppc.id | html %][% ppc.title | html %] [% ppc.status | html %] [% ppc.author | html %] [% ppc.sponsor | html %][% ppc.title | html %]
From 0fb48d4e17f56ac56058dd1742053de6c33ba3d3 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 24 Jan 2025 16:37:37 +0000 Subject: [PATCH 14/38] Add basic datatable support --- in/index.tt | 12 +++++++++++- ttlib/page.tt | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/in/index.tt b/in/index.tt index 2e7508b..9d5a6a4 100644 --- a/in/index.tt +++ b/in/index.tt @@ -3,7 +3,7 @@

Welcome to the Proposed Perl Changes web site.

Download this data as JSON

-
+
@@ -25,3 +25,13 @@ [% END -%]
ID
+ + diff --git a/ttlib/page.tt b/ttlib/page.tt index 073a8c7..9344f01 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -36,6 +36,12 @@ } } + + + + From 83bcd788ff2c1afc531a0292ccecd11309ddb02f Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 24 Jan 2025 16:40:48 +0000 Subject: [PATCH 15/38] Fix a couple of typos --- in/index.tt | 2 +- ttlib/page.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/in/index.tt b/in/index.tt index 9d5a6a4..3b4c623 100644 --- a/in/index.tt +++ b/in/index.tt @@ -2,7 +2,7 @@

Welcome to the Proposed Perl Changes web site.

-

Download this data as JSON

+

Download this data as JSON.

diff --git a/ttlib/page.tt b/ttlib/page.tt index 9344f01..6204d1e 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -94,7 +94,7 @@ From 3e0ee4e66203cc262690a6e00545a01a7125c96e Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 26 Jan 2025 08:59:08 +0000 Subject: [PATCH 16/38] Fix incorrect page metadata --- ttlib/page.tt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ttlib/page.tt b/ttlib/page.tt index 6204d1e..01abf1f 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -6,9 +6,9 @@ [% END -%] - - - + + + Proposed Perl Changes From bb4954993eb57b61c1aa46ea640453e51c10ad8c Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 26 Jan 2025 09:18:02 +0000 Subject: [PATCH 17/38] The title is Markdown - fix that --- lib/PPC.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/PPC.pm b/lib/PPC.pm index 6a580ad..da0e0e8 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -4,6 +4,8 @@ class PPC; use builtin 'trim'; +use Pandoc; + field $author :param = ''; field $id :param; field $slug :param; @@ -51,7 +53,7 @@ sub new_from_file($class, $ppc_file) { $ppc{slug} =~ s|\.md$||; while (<$ppc_fh>) { - $. == 1 and m|#\s+(.*)| and $ppc{title} = $1; + !$ppc{title} and m|^#\s+(.*)| and $ppc{title} = md2text($_); $is_preamble and /## abstract/i and last; @@ -77,4 +79,8 @@ sub new_from_file($class, $ppc_file) { return $class->new(%ppc); } +sub md2text($md_string) { + return pandoc->convert( markdown => 'plain', $md_string); +} + 1; From bd65c9db8c443c3c6e87028343ad5639f7a2af73 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 16:36:14 +0000 Subject: [PATCH 18/38] Add a simple website --- .github/workflows/buildsite.yml | 52 ++++++++++++++++++ .gitignore | 1 + CNAME | 1 + bin/build | 61 +++++++++++++++++++++ cpanfile | 3 ++ in/index.tt | 26 +++++++++ in/style.css | 3 ++ lib/PPC.pm | 67 +++++++++++++++++++++++ ttlib/page.tt | 95 +++++++++++++++++++++++++++++++++ 9 files changed, 309 insertions(+) create mode 100644 .github/workflows/buildsite.yml create mode 100644 .gitignore create mode 100644 CNAME create mode 100755 bin/build create mode 100644 cpanfile create mode 100644 in/index.tt create mode 100644 in/style.css create mode 100644 lib/PPC.pm create mode 100644 ttlib/page.tt diff --git a/.github/workflows/buildsite.yml b/.github/workflows/buildsite.yml new file mode 100644 index 0000000..df78430 --- /dev/null +++ b/.github/workflows/buildsite.yml @@ -0,0 +1,52 @@ +name: Generate web page + +on: + push: + branches: 'main' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + container: perl:latest + + steps: + - name: Perl version + run: perl -v + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pandoc and cpanm + run: apt-get update && apt-get install -y pandoc cpanminus + + - name: Install modules + run: | + cpanm --installdeps --notest . + + - name: Create pages + env: + PERL5LIB: lib + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mkdir -p web + perl bin/build + + - name: Update pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: web/ + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73cf2e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +web/ diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..183766f --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +ppc.perlhacks.com diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..b9cb024 --- /dev/null +++ b/bin/build @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use v5.38; +use File::Copy; +use Template; +use Template::Provider::Pandoc; + +use PPC; + +my @ppcs; +my %status; + +my $outpath = './web'; +my $template_path = [ './ppcs', './docs', './in', './ttlib' ]; + +my $provider = Template::Provider::Pandoc->new({ + INCLUDE_PATH => $template_path, +}); + +my $tt = Template->new({ + LOAD_TEMPLATES => [ $provider ], + INCLUDE_PATH => $template_path, + OUTPUT_PATH => $outpath, + RELATIVE => 1, + WRAPPER => 'page.tt', +}); + +for () { + my $ppc = PPC->new_from_file($_); + push @ppcs, $ppc; + + $tt->process($ppc->in_path, {}, $ppc->out_path) + or warn $tt->error; +} + +my $vars = { + ppcs => \@ppcs, +}; + +$tt->process('index.tt', $vars, 'index.html') + or die $tt->error; + +for () { + s|^docs/||; + my $out = s|\.md|/index.html|r; + + $tt->process($_, {}, $out) + or die $tt->error; +} + +mkdir 'web/images'; +for () { + copy $_, "web/$_"; +} + +if (-f 'CNAME') { + copy 'CNAME', "web/CNAME"; +} diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..077649f --- /dev/null +++ b/cpanfile @@ -0,0 +1,3 @@ +requires 'File::Copy'; +requires 'Template'; +requires 'Template::Provider::Pandoc'; diff --git a/in/index.tt b/in/index.tt new file mode 100644 index 0000000..60c72d0 --- /dev/null +++ b/in/index.tt @@ -0,0 +1,26 @@ +

Proposed Perl Changes

+ +

Welcome to the Proposed Perl Changes web site.

+ +
+ + + + + + + + + + +[% FOR ppc IN ppcs -%] + + + + + + + +[% END -%] + +
IDStatusAuthor(s)SponsorTitle
[% ppc.id | html %][% ppc.status | html %][% ppc.author | html %][% ppc.sponsor | html %][% ppc.title | html %]
diff --git a/in/style.css b/in/style.css new file mode 100644 index 0000000..ff5ebd0 --- /dev/null +++ b/in/style.css @@ -0,0 +1,3 @@ +main > .container { + padding: 60px 15px 0; +} diff --git a/lib/PPC.pm b/lib/PPC.pm new file mode 100644 index 0000000..de64360 --- /dev/null +++ b/lib/PPC.pm @@ -0,0 +1,67 @@ +use experimental qw[builtin class signatures]; + +class PPC; + +use builtin 'trim'; + +field $author :param = ''; +field $id :param; +field $slug :param; +field $sponsor :param = ''; +field $status :param; +field $title :param; + +method author { return $author } +method id { return $id } +method slug { return $slug } +method sponsor { return $sponsor } +method status { return $status } +method title { return $title } + +method in_path { + return "$slug.md"; +} + +method out_path { + return "$slug/index.html"; +} + +# Very hacky parser + +sub new_from_file($class, $ppc_file) { + + open my $ppc_fh, '<', $ppc_file + or warn "Cannot open PPC [$_]: $!\n" and return; + + my (%ppc, $is_preamble); + + $ppc{slug} = $ppc_file; + $ppc{slug} =~ s|^ppcs/||; + $ppc{slug} =~ s|\.md$||; + + while (<$ppc_fh>) { + $. == 1 and m|#\s+(.*)| and $ppc{title} = $1; + + $is_preamble and /## abstract/i and last; + + $_ = trim($_); + + if ($is_preamble and $_) { + + my ($key, $value) = split(/\s*:\s*/, $_, 2); + + $ppc{lc $key} = $value; + } + + # 'pre.+mble' because Paul likes to use 'Preämble' + /## pre.+mble/i and $is_preamble = 1; + } + + if (exists $ppc{authors}) { + $ppc{author} = delete $ppc{authors} + } + + return $class->new(%ppc); +} + +1; diff --git a/ttlib/page.tt b/ttlib/page.tt new file mode 100644 index 0000000..2f5e2e0 --- /dev/null +++ b/ttlib/page.tt @@ -0,0 +1,95 @@ + + + + + + + + + Proposed Perl Changes + + + + + + + + + + + + + + + +
+ + +
+ + +
+
+[% content %] +
+
+ +
+
+ Place sticky footer content here. +
+
+ + + + From a72078c0a55899cda62e4df25f555604c2efc537 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 17:16:59 +0000 Subject: [PATCH 19/38] Copy the CSS into place --- bin/build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/build b/bin/build index b9cb024..1ffbc6f 100755 --- a/bin/build +++ b/bin/build @@ -56,6 +56,10 @@ for () { copy $_, "web/$_"; } +if (-f 'in/style.css') { + copy 'in/style.css', 'web/style.css'; +} + if (-f 'CNAME') { copy 'CNAME', "web/CNAME"; } From 1a66ea826e4fa41c86c56a65d41ebc96d80aefef Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 18:16:27 +0000 Subject: [PATCH 20/38] Add JSON download --- bin/build | 10 ++++++++++ in/index.tt | 1 + lib/PPC.pm | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/bin/build b/bin/build index 1ffbc6f..da905d6 100755 --- a/bin/build +++ b/bin/build @@ -5,6 +5,7 @@ use warnings; use v5.38; use File::Copy; +use JSON; use Template; use Template::Provider::Pandoc; @@ -63,3 +64,12 @@ if (-f 'in/style.css') { if (-f 'CNAME') { copy 'CNAME', "web/CNAME"; } + +my $json = JSON->new->pretty->canonical->encode([ + map { $_->as_data } @ppcs +]); + +open my $json_fh, '>', 'web/ppcs.json' or die $!; + +print $json_fh $json; + diff --git a/in/index.tt b/in/index.tt index 60c72d0..dbaa06c 100644 --- a/in/index.tt +++ b/in/index.tt @@ -2,6 +2,7 @@

Welcome to the Proposed Perl Changes web site.

+

Download this data as JSON

diff --git a/lib/PPC.pm b/lib/PPC.pm index de64360..fbeaa03 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -26,6 +26,17 @@ method out_path { return "$slug/index.html"; } +method as_data { + return { + id => $id, + status => $status, + author => $author, + sponsor => $sponsor, + slug => $slug, + title => $title, + }; +} + # Very hacky parser sub new_from_file($class, $ppc_file) { From c90f466531f4776857d7b63cd0d10385b4d531cc Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 13 Jan 2025 18:19:39 +0000 Subject: [PATCH 21/38] Forgot something :-/ --- cpanfile | 1 + 1 file changed, 1 insertion(+) diff --git a/cpanfile b/cpanfile index 077649f..f210f57 100644 --- a/cpanfile +++ b/cpanfile @@ -1,3 +1,4 @@ requires 'File::Copy'; +requires 'JSON'; requires 'Template'; requires 'Template::Provider::Pandoc'; From 52a3d3be1ff13342269b218f99f3eb722a3dfe8f Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 14 Jan 2025 09:45:16 +0000 Subject: [PATCH 22/38] Obfuscate email addresses in main table --- lib/PPC.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PPC.pm b/lib/PPC.pm index fbeaa03..d076fbc 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -72,6 +72,8 @@ sub new_from_file($class, $ppc_file) { $ppc{author} = delete $ppc{authors} } + $ppc{author} =~ s|\@.+?>|\@XXXX>|g; + return $class->new(%ppc); } From 12ab7fbd11999e9a0344543533deb4be5e3381e0 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 14 Jan 2025 09:48:03 +0000 Subject: [PATCH 23/38] Add footer text --- ttlib/page.tt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ttlib/page.tt b/ttlib/page.tt index 2f5e2e0..c460bc0 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -84,7 +84,8 @@ From 76438a4c8847d9956bdda74211a95978f360296c Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 14 Jan 2025 09:49:30 +0000 Subject: [PATCH 24/38] Same obfuscation for sponsors --- lib/PPC.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PPC.pm b/lib/PPC.pm index d076fbc..6a580ad 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -72,7 +72,7 @@ sub new_from_file($class, $ppc_file) { $ppc{author} = delete $ppc{authors} } - $ppc{author} =~ s|\@.+?>|\@XXXX>|g; + $ppc{$_} =~ s|\@.+?>|\@XXXX>|g for (qw[author sponsor]); return $class->new(%ppc); } From f4638cd060a8f694d25fb8178af05d09658346f5 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 18 Jan 2025 16:15:39 +0000 Subject: [PATCH 25/38] Make some links relative (so hack works) --- docs/process.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/process.md b/docs/process.md index 063641e..1e5286c 100644 --- a/docs/process.md +++ b/docs/process.md @@ -21,7 +21,7 @@ Hence we need a process that We'd like to record proposals to improve the language and their status as "Request For Comment" documents in their own repository under the Perl organisation on GitHub. -We have a [template](template.md) for what an completed implemented PPC should end up as, but if all you have is an idea - don't worry, we'll help you get there. We're still figuring this process out, so for now we're doing it as mail messages sent to p5p, not as "pull requests" to the PPC repository (or "issues" on the source repository). This way we can see if the process works as hoped, and fix the parts that don't. +We have a [template](./template.md) for what an completed implemented PPC should end up as, but if all you have is an idea - don't worry, we'll help you get there. We're still figuring this process out, so for now we're doing it as mail messages sent to p5p, not as "pull requests" to the PPC repository (or "issues" on the source repository). This way we can see if the process works as hoped, and fix the parts that don't. ## What makes a good idea? @@ -46,7 +46,7 @@ Not every good idea belongs in the Perl core. Some are better implemented on CPA ## The Process -![a flowchart of the process described below](/images/flowchart.png) +![a flowchart of the process described below](./images/flowchart.png) ### Pre-PPC @@ -63,7 +63,7 @@ During this phase, you (the proposer) are responsible for moving things forward. ### Draft Proposal -The PSC has agreed that you should write a formal draft proposal. You get the [template document](template.md) and fill it out. You take its advice, thinking hard about what goes in each section. Then you post it to p5p as an email with the subject "PROPOSAL: my great idea". Members of the list will reply with more questions and suggested amendments. You should read them and amend the proposal to clarify your ideas or react to valid criticism. +The PSC has agreed that you should write a formal draft proposal. You get the [template document](./template.md) and fill it out. You take its advice, thinking hard about what goes in each section. Then you post it to p5p as an email with the subject "PROPOSAL: my great idea". Members of the list will reply with more questions and suggested amendments. You should read them and amend the proposal to clarify your ideas or react to valid criticism. During this phase, you (the proposer) are responsible for moving things forward. From c118eef5956ccddd1db4b00ae1f6041ef01e49a8 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 18 Jan 2025 16:18:38 +0000 Subject: [PATCH 26/38] Support the use of a element --- .github/workflows/buildsite.yml | 8 ++++++-- CNAME | 1 - bin/build | 8 ++++++++ in/index.tt | 2 +- ttlib/page.tt | 17 ++++++++++------- 5 files changed, 25 insertions(+), 11 deletions(-) delete mode 100644 CNAME diff --git a/.github/workflows/buildsite.yml b/.github/workflows/buildsite.yml index df78430..80c559e 100644 --- a/.github/workflows/buildsite.yml +++ b/.github/workflows/buildsite.yml @@ -22,7 +22,11 @@ jobs: - name: Install modules run: | - cpanm --installdeps --notest . + cpanm --installdeps --notest . + + - name: Get repo name into environment + run: | + echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV - name: Create pages env: @@ -30,7 +34,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | mkdir -p web - perl bin/build + perl bin/build $REPO_NAME - name: Update pages artifact uses: actions/upload-pages-artifact@v3 diff --git a/CNAME b/CNAME deleted file mode 100644 index 183766f..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -ppc.perlhacks.com diff --git a/bin/build b/bin/build index da905d6..d573ca4 100755 --- a/bin/build +++ b/bin/build @@ -17,6 +17,11 @@ my %status; my $outpath = './web'; my $template_path = [ './ppcs', './docs', './in', './ttlib' ]; +my $base = shift || $outpath; +$base =~ s/^\.//; +$base = "/$base" if $base !~ m|^/|; +$base = "$base/" if $base !~ m|/$|; + my $provider = Template::Provider::Pandoc->new({ INCLUDE_PATH => $template_path, }); @@ -27,6 +32,9 @@ my $tt = Template->new({ OUTPUT_PATH => $outpath, RELATIVE => 1, WRAPPER => 'page.tt', + VARIABLES => { + base => $base, + } }); for () { diff --git a/in/index.tt b/in/index.tt index dbaa06c..6c12aa3 100644 --- a/in/index.tt +++ b/in/index.tt @@ -20,7 +20,7 @@ - + [% END -%] diff --git a/ttlib/page.tt b/ttlib/page.tt index c460bc0..16d5217 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -1,6 +1,9 @@ +[% IF base -%] + +[% END -%] @@ -43,29 +46,29 @@ + - [% FOR ppc IN ppcs -%] + - [% END -%] From 7b9fed83ac323f636fda93cbd6215790e4f8f116 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 18 Jan 2025 16:58:50 +0000 Subject: [PATCH 28/38] Fix local css link --- ttlib/page.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttlib/page.tt b/ttlib/page.tt index 16d5217..073a8c7 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -38,7 +38,7 @@ - + From 1d4c43788fcc9dc247334ad190fc7b0dc193fde7 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 24 Jan 2025 15:26:33 +0000 Subject: [PATCH 29/38] Fix JSON link (and anchor text) --- in/index.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/in/index.tt b/in/index.tt index 974ae8e..2e7508b 100644 --- a/in/index.tt +++ b/in/index.tt @@ -2,7 +2,7 @@

Welcome to the Proposed Perl Changes web site.

-

Download this data as JSON

+

Download this data as JSON

[% ppc.status | html %] [% ppc.author | html %] [% ppc.sponsor | html %][% ppc.title | html %][% ppc.title | html %]
IDTitle Status Author(s) SponsorTitle
[% ppc.id | html %][% ppc.title | html %] [% ppc.status | html %] [% ppc.author | html %] [% ppc.sponsor | html %][% ppc.title | html %]
From 10d29a046d23851bad7cc16c3ccd4fd23257a60a Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 24 Jan 2025 16:37:37 +0000 Subject: [PATCH 30/38] Add basic datatable support --- in/index.tt | 12 +++++++++++- ttlib/page.tt | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/in/index.tt b/in/index.tt index 2e7508b..9d5a6a4 100644 --- a/in/index.tt +++ b/in/index.tt @@ -3,7 +3,7 @@

Welcome to the Proposed Perl Changes web site.

Download this data as JSON

-
+
@@ -25,3 +25,13 @@ [% END -%]
ID
+ + diff --git a/ttlib/page.tt b/ttlib/page.tt index 073a8c7..9344f01 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -36,6 +36,12 @@ } } + + + + From fbdd4e268a8490befda41051e8bad70dc7cd1af2 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 24 Jan 2025 16:40:48 +0000 Subject: [PATCH 31/38] Fix a couple of typos --- in/index.tt | 2 +- ttlib/page.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/in/index.tt b/in/index.tt index 9d5a6a4..3b4c623 100644 --- a/in/index.tt +++ b/in/index.tt @@ -2,7 +2,7 @@

Welcome to the Proposed Perl Changes web site.

-

Download this data as JSON

+

Download this data as JSON.

diff --git a/ttlib/page.tt b/ttlib/page.tt index 9344f01..6204d1e 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -94,7 +94,7 @@ From 88a6908ae604cc3ed9ff9413c4cd78eb95610b34 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 26 Jan 2025 08:59:08 +0000 Subject: [PATCH 32/38] Fix incorrect page metadata --- ttlib/page.tt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ttlib/page.tt b/ttlib/page.tt index 6204d1e..01abf1f 100644 --- a/ttlib/page.tt +++ b/ttlib/page.tt @@ -6,9 +6,9 @@ [% END -%] - - - + + + Proposed Perl Changes From 741cb1a3384913ae8375da9c1b54191da78b4c84 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 26 Jan 2025 09:18:02 +0000 Subject: [PATCH 33/38] The title is Markdown - fix that --- lib/PPC.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/PPC.pm b/lib/PPC.pm index 6a580ad..da0e0e8 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -4,6 +4,8 @@ class PPC; use builtin 'trim'; +use Pandoc; + field $author :param = ''; field $id :param; field $slug :param; @@ -51,7 +53,7 @@ sub new_from_file($class, $ppc_file) { $ppc{slug} =~ s|\.md$||; while (<$ppc_fh>) { - $. == 1 and m|#\s+(.*)| and $ppc{title} = $1; + !$ppc{title} and m|^#\s+(.*)| and $ppc{title} = md2text($_); $is_preamble and /## abstract/i and last; @@ -77,4 +79,8 @@ sub new_from_file($class, $ppc_file) { return $class->new(%ppc); } +sub md2text($md_string) { + return pandoc->convert( markdown => 'plain', $md_string); +} + 1; From 9dd4885667cd24d83f2d9e474c92f9dbaf453dde Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 2 Feb 2025 15:22:31 +0000 Subject: [PATCH 34/38] Remove unused variable --- bin/build | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/build b/bin/build index d573ca4..5349ae5 100755 --- a/bin/build +++ b/bin/build @@ -12,7 +12,6 @@ use Template::Provider::Pandoc; use PPC; my @ppcs; -my %status; my $outpath = './web'; my $template_path = [ './ppcs', './docs', './in', './ttlib' ]; From f833d798ea42f0a11ca24f302da0817182dfc4e7 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 2 Feb 2025 15:24:51 +0000 Subject: [PATCH 35/38] Don't need strict or warnings with use 5.38 --- bin/build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/build b/bin/build index 5349ae5..520f993 100755 --- a/bin/build +++ b/bin/build @@ -1,11 +1,8 @@ #!/usr/bin/perl -use strict; -use warnings; - use v5.38; -use File::Copy; use JSON; +use File::Copy; use Template; use Template::Provider::Pandoc; From 9f812eae85af67b3231f737e017d668e4d248651 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 4 Feb 2025 10:13:14 +0000 Subject: [PATCH 36/38] Require v5.38 in class too --- lib/PPC.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/PPC.pm b/lib/PPC.pm index da0e0e8..a7b18ed 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -1,3 +1,4 @@ +use v5.38; use experimental qw[builtin class signatures]; class PPC; @@ -82,5 +83,3 @@ sub new_from_file($class, $ppc_file) { sub md2text($md_string) { return pandoc->convert( markdown => 'plain', $md_string); } - -1; From a5f0fbc587c6007aacc27d139506d5e4cc442e70 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 4 Feb 2025 10:16:42 +0000 Subject: [PATCH 37/38] Fix "uninitialised" warning --- lib/PPC.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PPC.pm b/lib/PPC.pm index a7b18ed..10349f2 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -75,7 +75,10 @@ sub new_from_file($class, $ppc_file) { $ppc{author} = delete $ppc{authors} } - $ppc{$_} =~ s|\@.+?>|\@XXXX>|g for (qw[author sponsor]); + for (qw[author sponsor]) { + $ppc{$_} //= ''; + $ppc{$_} =~ s|\@.+?>|\@XXXX>|g; + } return $class->new(%ppc); } From 48f1228486f4263fcca72fff692860bcb89b42a2 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 5 Feb 2025 09:30:34 +0000 Subject: [PATCH 38/38] Update to using Perl 5.40 --- bin/build | 2 +- lib/PPC.pm | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/bin/build b/bin/build index 520f993..52b6eae 100755 --- a/bin/build +++ b/bin/build @@ -1,6 +1,6 @@ #!/usr/bin/perl -use v5.38; +use v5.40; use JSON; use File::Copy; use Template; diff --git a/lib/PPC.pm b/lib/PPC.pm index 10349f2..9674551 100644 --- a/lib/PPC.pm +++ b/lib/PPC.pm @@ -1,25 +1,16 @@ -use v5.38; -use experimental qw[builtin class signatures]; +use v5.40; +use experimental qw[class signatures]; class PPC; -use builtin 'trim'; - use Pandoc; -field $author :param = ''; -field $id :param; -field $slug :param; -field $sponsor :param = ''; -field $status :param; -field $title :param; - -method author { return $author } -method id { return $id } -method slug { return $slug } -method sponsor { return $sponsor } -method status { return $status } -method title { return $title } +field $author :param :reader = ''; +field $id :param :reader; +field $slug :param :reader; +field $sponsor :param :reader = ''; +field $status :param :reader; +field $title :param :reader; method in_path { return "$slug.md";