| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # This file is part of ASPEER::MakeMaker::Markdown::Pod. | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # Full license text is available at: | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # <http://dev.perl.org/licenses/> | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||||||||||||
| 13 | package ASPEER::MakeMaker::Markdown::Pod::MM; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # Compiler Pragma | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use strict qw(vars); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use vars qw($VERSION @ISA $IMPORTED); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | ▶ | sub BEGIN {local $^W=0} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | # Base packages and shared utility functions | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | use ASPEER::MakeMaker::MM (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | ▶ | use ASPEER::MakeMaker::MM::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | ▶ | use ASPEER::MakeMaker::Markdown::Pod::MM::Constant (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | @ISA=qw(ASPEER::MakeMaker::MM); | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # External Packages | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | use Digest::MD5 qw(md5_hex); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | # Version information in a formate suitable for CPAN etc. Must be | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # all on one line | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 6 | $VERSION='1.012'; | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # All done, init finished | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | #====================================================================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # Makefile targets from here down | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub doc { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
doc: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # Convert DocBook articles under doc to sibling Markdown files | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my ($self, $param_hr)=(shift(), arg(@_)); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | msg($self); | |||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (-d 'doc') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | require Docbook::Convert::Pandoc; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $docbook_or=Docbook::Convert::Pandoc->new(); | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $changed_fn_ar=$docbook_or->convert_articles('doc'); | |||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | msg('docbook: %s: updated', $_) foreach @{$changed_fn_ar}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | # Convert MD files to POD | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $exe_files_ar=$param_hr->{'EXE_FILES_AR'}; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my %exe_files=map {$_ => 1} @{$exe_files_ar}; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | require Markdown::Pod::Embed; | |||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | # Get manifest - only convert files in manifest | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | require ExtUtils::Manifest; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my $manifest_hr=ExtUtils::Manifest::maniread(); | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | # Hash to hold files we generate so not processed twice | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my %ignore_fn; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | # Look for all Markdown files ignoring ones we created ourselves | ||||||||||||||||||||||||||||||||||||||||||
| 87 | # | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | my @manifest_md_fn=sort grep {/\.md$/ && !m{^t/}} keys %{$manifest_hr}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
/\.md$/ && !m[^t/]
MC/DC0%0/2
/\.md$/ && !m[^t/]
/\.md$/
!m[^t/]
Truth table0%0/3
A && not(B)
A= /\.md$/B= !m[^t/]
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | @manifest_md_fn=grep {!$ignore_fn{$_}} @manifest_md_fn; | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | # Iterate | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | foreach my $fn (@manifest_md_fn) { | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | # Get target file name. If foo.pm.md, bar.pl.md and foo.pm or bar.pl exists, then | ||||||||||||||||||||||||||||||||||||||||||
| 97 | # convert Markdown to POD and install into target file. | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | # | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | (my $target_fn=$fn)=~s/\.md$//; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($target_fn=~/\.pm$/ || $target_fn=~/\.pl$/ || $exe_files{$target_fn}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$target_fn =~ /\.pm$/ or $target_fn =~ /\.pl$/ or $exe_files{$target_fn}
$target_fn =~ /\.pm$/ or $target_fn =~ /\.pl$/
MC/DC0%0/3
$target_fn =~ /\.pm$/ or $target_fn =~ /\.pl$/ or $exe_files{$target_fn}
$target_fn =~ /\.pm$/
$target_fn =~ /\.pl$/
$exe_files{$target_fn}
Truth table0%0/4
A or B or C
A= $target_fn =~ /\.pm$/B= $target_fn =~ /\.pl$/C= $exe_files{$target_fn}
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | unless (-f $target_fn) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | verbose("markpod: %s -> %s: skipped, missing target", $fn, $target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | msg("markpod: %s -> %s: starting merge", $fn, $target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $markpod_or=Markdown::Pod::Embed->new(); | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $pod_changed=$markpod_or->markpod_process_and_update($target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if (!defined $pod_changed) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | msg("markpod: %s -> %s: finished, skipped", $fn, $target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | elsif ($pod_changed) { | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | msg("markpod: %s -> %s: finished, updated pod", $fn, $target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | msg("markpod: %s -> %s: finished, no changes", $fn, $target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | verbose("markpod: %s -> %s: skipped, unsupported target", $fn, $target_fn); | |||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | # Done | ||||||||||||||||||||||||||||||||||||||||||
| 130 | # | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub readme { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readme: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | # Build README files from README.md or VERSION_FROM markdown | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my ($self, $param_hr)=(shift(), arg(@_)); | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | require Markdown::Pod::Embed; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | # Get manifest for any file additions we make | ||||||||||||||||||||||||||||||||||||||||||
| 146 | # | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | require ExtUtils::Manifest; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $manifest_hr=ExtUtils::Manifest::maniread(); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my @manifest_add; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $version_from_fn=$param_hr->{'VERSION_FROM'}; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $readme_md_fn='README.md'; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $readme_fn='README'; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $markpod_or=Markdown::Pod::Embed->new(); | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $md; | |||||||||||||||||||||||||||||||||||||||||
| 155 | my $source_fn; | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | # Use an existing Markdown README when one is available | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | if (-f $readme_md_fn) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $source_fn=$readme_md_fn; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $md=slurp($readme_md_fn); | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | ▶ | elsif (-e $readme_md_fn || -l $readme_md_fn) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
-e $readme_md_fn or -l $readme_md_fn
MC/DC0%0/2
-e $readme_md_fn or -l $readme_md_fn
-e $readme_md_fn
-l $readme_md_fn
Truth table0%0/3
A or B
A= -e $readme_md_fnB= -l $readme_md_fn
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | return err("$readme_md_fn exists and is not a regular file"); | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | ▶ | elsif (-e $readme_fn || -l $readme_fn) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
-e $readme_fn or -l $readme_fn
MC/DC0%0/2
-e $readme_fn or -l $readme_fn
-e $readme_fn
-l $readme_fn
Truth table0%0/3
A or B
A= -e $readme_fnB= -l $readme_fn
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | verbose('markpod: %s exists without %s, leaving both unchanged', $readme_fn, $readme_md_fn); | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | unless (defined $version_from_fn && length $version_from_fn) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $version_from_fn and length $version_from_fn
MC/DC0%0/2
defined $version_from_fn and length $version_from_fn
defined $version_from_fn
length $version_from_fn
Truth table0%0/3
A and B
A= defined $version_from_fnB= length $version_from_fn
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | verbose('markpod: no VERSION_FROM file, no README files created'); | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $md=$markpod_or->markpod_markdown_source($version_from_fn); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | unless (defined $md && length $md) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $md and length $md
MC/DC0%0/2
defined $md and length $md
defined $md
length $md
Truth table0%0/3
A and B
A= defined $mdB= length $md
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | msg('markpod: %s -> %s: skipped, no markdown source', $version_from_fn, $readme_fn); | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $readme_md=$md; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | $readme_md.=$/ unless $readme_md=~/\n\z/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | blurp($readme_md_fn, $readme_md) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | return err(); | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | push @manifest_add, $readme_md_fn unless exists $manifest_hr->{$readme_md_fn}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $source_fn=$readme_md_fn; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | msg('markpod: %s -> %s: starting render', $source_fn, $readme_fn); | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | # No markdown means nothing to render | ||||||||||||||||||||||||||||||||||||||||||
| 192 | # | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | unless (defined $md && length $md) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $md and length $md
MC/DC0%0/2
defined $md and length $md
defined $md
length $md
Truth table0%0/3
A and B
A= defined $mdB= length $md
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | msg('markpod: %s -> %s: finished, skipped empty markdown source', $source_fn, $readme_fn); | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | manifest_add(\@manifest_add) if @manifest_add; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | # Convert markdown to text | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $text=$markpod_or->markpod_markdown_text($md); | |||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | # Update README only when changed | ||||||||||||||||||||||||||||||||||||||||||
| 206 | # | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | my $existing_readme=-f $readme_fn ? slurp($readme_fn) : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if (md5_hex($existing_readme) ne md5_hex($text)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | $markpod_or->outfile($text, $readme_fn) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | return err(); | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | msg('markpod: %s -> %s: finished, updated', $source_fn, $readme_fn); | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | msg('markpod: %s -> %s: finished, no changes', $source_fn, $readme_fn); | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | push @manifest_add, $readme_fn unless exists $manifest_hr->{$readme_fn}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | manifest_add(\@manifest_add) if @manifest_add; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | sub manifest_add { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
manifest_add: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my ($file_ar)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | return undef unless @{$file_ar}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | require ExtUtils::Manifest; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my %add=map { $_ => '' } @{$file_ar}; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ExtUtils::Manifest::maniadd(\%add); | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | =begin markdown | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | # NAME | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | ASPEER::MakeMaker::Markdown::Pod::MM - MakeMaker integration for ASPEER::MakeMaker::Markdown::Pod | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | # SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | In `Makefile.PL`: | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | ```perl | ||||||||||||||||||||||||||||||||||||||||||
| 251 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 252 | use lib './lib'; | ||||||||||||||||||||||||||||||||||||||||||
| 253 | eval { | ||||||||||||||||||||||||||||||||||||||||||
| 254 | require ASPEER::MakeMaker::Markdown::Pod; | ||||||||||||||||||||||||||||||||||||||||||
| 255 | ASPEER::MakeMaker::Markdown::Pod->import; | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 1; | ||||||||||||||||||||||||||||||||||||||||||
| 257 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | ``` | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | Then run: | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | ```bash | ||||||||||||||||||||||||||||||||||||||||||
| 264 | perl Makefile.PL | ||||||||||||||||||||||||||||||||||||||||||
| 265 | make doc | ||||||||||||||||||||||||||||||||||||||||||
| 266 | make readme | ||||||||||||||||||||||||||||||||||||||||||
| 267 | ``` | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | # DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | `ASPEER::MakeMaker::Markdown::Pod::MM` generates and executes the documentation targets | ||||||||||||||||||||||||||||||||||||||||||
| 272 | used by `ExtUtils::MakeMaker`. DocBook article conversion is delegated to | ||||||||||||||||||||||||||||||||||||||||||
| 273 | `Docbook::Convert::Pandoc`. Markdown source selection, Markdown-to-POD conversion, | ||||||||||||||||||||||||||||||||||||||||||
| 274 | and Perl source updates are delegated to `Markdown::Pod::Embed`. | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | This class inherits the common MakeMaker namespace from | ||||||||||||||||||||||||||||||||||||||||||
| 277 | `ASPEER::MakeMaker::MM` and imports shared helper functions from | ||||||||||||||||||||||||||||||||||||||||||
| 278 | `ASPEER::MakeMaker::MM::Util`. | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | `ASPEER::MakeMaker::MM::Import` installs the MakeMaker lifecycle hooks and | ||||||||||||||||||||||||||||||||||||||||||
| 281 | appends the target template. This module handles the resulting `doc` and | ||||||||||||||||||||||||||||||||||||||||||
| 282 | `readme` invocations. | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | # MAKEFILE INTEGRATION | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | The module adds a postamble fragment containing targets that invoke | ||||||||||||||||||||||||||||||||||||||||||
| 287 | `ASPEER::MakeMaker::Markdown::Pod::MM` from the generated Makefile. | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | `doc` | ||||||||||||||||||||||||||||||||||||||||||
| 290 | : Recursively converts DocBook article XML beneath `doc/` to sibling Markdown | ||||||||||||||||||||||||||||||||||||||||||
| 291 | files without using `MANIFEST` as a discovery list. It then finds Markdown | ||||||||||||||||||||||||||||||||||||||||||
| 292 | files listed in `MANIFEST`, derives each target by removing the trailing | ||||||||||||||||||||||||||||||||||||||||||
| 293 | `.md`, and merges supported sidecars into matching `.pm`, `.pl`, or executable | ||||||||||||||||||||||||||||||||||||||||||
| 294 | files. Markdown files under `t/` are ignored so test fixtures are not rewritten. | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | `readme` | ||||||||||||||||||||||||||||||||||||||||||
| 297 | : Builds `README` from the best available Markdown source. | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | The generated status output is concise and goes to STDERR: | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | ```text | ||||||||||||||||||||||||||||||||||||||||||
| 302 | markpod: lib/My/Module.pm.md -> lib/My/Module.pm: starting merge | ||||||||||||||||||||||||||||||||||||||||||
| 303 | markpod: lib/My/Module.pm.md -> lib/My/Module.pm: finished, updated pod | ||||||||||||||||||||||||||||||||||||||||||
| 304 | ``` | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | Unsupported or missing targets are reported only when verbose output has been | ||||||||||||||||||||||||||||||||||||||||||
| 307 | enabled. | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | # README SOURCE PRECEDENCE | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | README generation observes the existing project files before creating anything: | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 1. If `README.md` exists, it is used to generate or update `README`. | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 2. If `README` exists without `README.md`, both are left unchanged. | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 3. If neither exists, Markdown is obtained from the sidecar or embedded | ||||||||||||||||||||||||||||||||||||||||||
| 316 | documentation of the file named by `VERSION_FROM` and written to a new, | ||||||||||||||||||||||||||||||||||||||||||
| 317 | regular `README.md` file. `README` is then rendered from that file. | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 4. If the `VERSION_FROM` file has no sidecar or embedded Markdown, no README | ||||||||||||||||||||||||||||||||||||||||||
| 319 | file is created. | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | The module never creates a `VERSION_FROM.md` sidecar. Generated README files are | ||||||||||||||||||||||||||||||||||||||||||
| 322 | added to `MANIFEST`. | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | `Markdown::Pod::Embed` renders the Markdown to plain text with `pandoc`. | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | # FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | ## arg | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | Converts the positional arguments passed through the generated Makefile target | ||||||||||||||||||||||||||||||||||||||||||
| 331 | into a named hash used by `doc` and `readme`. | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | ## doc | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | Converts DocBook article XML beneath `doc/` to sibling Markdown files, then | ||||||||||||||||||||||||||||||||||||||||||
| 336 | processes sidecar Markdown files from `MANIFEST` and updates supported Perl | ||||||||||||||||||||||||||||||||||||||||||
| 337 | targets in place. | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | ## readme | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | Renders the project README from Markdown according to the precedence described | ||||||||||||||||||||||||||||||||||||||||||
| 342 | above. | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | ## manifest_add | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | Adds generated support files to `MANIFEST`. | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | # CAVEATS | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | This module contains MakeMaker-specific target execution. Hook installation is | ||||||||||||||||||||||||||||||||||||||||||
| 351 | provided by `ASPEER::MakeMaker::MM::Import`, and Markdown/POD processing is | ||||||||||||||||||||||||||||||||||||||||||
| 352 | isolated in `Markdown::Pod::Embed`. | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | The implementation expects a traditional MakeMaker distribution layout with a | ||||||||||||||||||||||||||||||||||||||||||
| 355 | usable `MANIFEST` file. | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | # SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | `ASPEER::MakeMaker::Markdown::Pod`, `ASPEER::MakeMaker::MM::Import`, | ||||||||||||||||||||||||||||||||||||||||||
| 360 | `Markdown::Pod::Embed`, `ExtUtils::MakeMaker`, `ExtUtils::Manifest` | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | # AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | Andrew Speer <andrew.speer@isolutions.com.au> | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | # LICENSE and COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | This file is part of ASPEER::MakeMaker::Markdown::Pod. | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 373 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | Full license text is available at: | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | <http://dev.perl.org/licenses/> | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | =end markdown | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | ASPEER::MakeMaker::Markdown::Pod::MM - MakeMaker integration for ASPEER::MakeMaker::Markdown::Pod | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | In C<Makefile.PL>: | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 394 | use lib './lib'; | ||||||||||||||||||||||||||||||||||||||||||
| 395 | eval { | ||||||||||||||||||||||||||||||||||||||||||
| 396 | require ASPEER::MakeMaker::Markdown::Pod; | ||||||||||||||||||||||||||||||||||||||||||
| 397 | ASPEER::MakeMaker::Markdown::Pod->import; | ||||||||||||||||||||||||||||||||||||||||||
| 398 | 1; | ||||||||||||||||||||||||||||||||||||||||||
| 399 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | Then run: | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | perl Makefile.PL | ||||||||||||||||||||||||||||||||||||||||||
| 405 | make doc | ||||||||||||||||||||||||||||||||||||||||||
| 406 | make readme | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | C<ASPEER::MakeMaker::Markdown::Pod::MM> generates and executes the documentation targets | ||||||||||||||||||||||||||||||||||||||||||
| 411 | used by C<ExtUtils::MakeMaker>. DocBook article conversion is delegated to | ||||||||||||||||||||||||||||||||||||||||||
| 412 | C<Docbook::Convert::Pandoc>. Markdown source selection, Markdown-to-POD conversion, | ||||||||||||||||||||||||||||||||||||||||||
| 413 | and Perl source updates are delegated to C<Markdown::Pod::Embed>. | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | This class inherits the common MakeMaker namespace from | ||||||||||||||||||||||||||||||||||||||||||
| 416 | C<ASPEER::MakeMaker::MM> and imports shared helper functions from | ||||||||||||||||||||||||||||||||||||||||||
| 417 | C<ASPEER::MakeMaker::MM::Util>. | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | C<ASPEER::MakeMaker::MM::Import> installs the MakeMaker lifecycle hooks and | ||||||||||||||||||||||||||||||||||||||||||
| 420 | appends the target template. This module handles the resulting C<doc> and | ||||||||||||||||||||||||||||||||||||||||||
| 421 | C<readme> invocations. | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | =head1 MAKEFILE INTEGRATION | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | The module adds a postamble fragment containing targets that invoke | ||||||||||||||||||||||||||||||||||||||||||
| 427 | C<ASPEER::MakeMaker::Markdown::Pod::MM> from the generated Makefile. | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | C<doc> | ||||||||||||||||||||||||||||||||||||||||||
| 430 | : Recursively converts DocBook article XML beneath C<doc/> to sibling Markdown | ||||||||||||||||||||||||||||||||||||||||||
| 431 | files without using C<MANIFEST> as a discovery list. It then finds Markdown | ||||||||||||||||||||||||||||||||||||||||||
| 432 | files listed in C<MANIFEST>, derives each target by removing the trailing | ||||||||||||||||||||||||||||||||||||||||||
| 433 | C<.md>, and merges supported sidecars into matching C<.pm>, C<.pl>, or executable | ||||||||||||||||||||||||||||||||||||||||||
| 434 | files. Markdown files under C<t/> are ignored so test fixtures are not rewritten. | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | C<readme> | ||||||||||||||||||||||||||||||||||||||||||
| 437 | : Builds C<README> from the best available Markdown source. | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | The generated status output is concise and goes to STDERR: | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | markpod: lib/My/Module.pm.md -> lib/My/Module.pm: starting merge | ||||||||||||||||||||||||||||||||||||||||||
| 443 | markpod: lib/My/Module.pm.md -> lib/My/Module.pm: finished, updated pod | ||||||||||||||||||||||||||||||||||||||||||
| 444 | Unsupported or missing targets are reported only when verbose output has been | ||||||||||||||||||||||||||||||||||||||||||
| 445 | enabled. | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | =head1 README SOURCE PRECEDENCE | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | README generation observes the existing project files before creating anything: | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | =item 1. | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | If C<README.md> exists, it is used to generate or update C<README>. | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | =item 2. | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | If C<README> exists without C<README.md>, both are left unchanged. | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | =item 3. | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | If neither exists, Markdown is obtained from the sidecar or embedded | ||||||||||||||||||||||||||||||||||||||||||
| 467 | documentation of the file named by C<VERSION_FROM> and written to a new, | ||||||||||||||||||||||||||||||||||||||||||
| 468 | regular C<README.md> file. C<README> is then rendered from that file. | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | =item 4. | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | If the C<VERSION_FROM> file has no sidecar or embedded Markdown, no README | ||||||||||||||||||||||||||||||||||||||||||
| 474 | file is created. | ||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | The module never creates a C<VERSION_FROM.md> sidecar. Generated README files are | ||||||||||||||||||||||||||||||||||||||||||
| 480 | added to C<MANIFEST>. | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | C<Markdown::Pod::Embed> renders the Markdown to plain text with C<pandoc>. | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | =head2 arg | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | Converts the positional arguments passed through the generated Makefile target | ||||||||||||||||||||||||||||||||||||||||||
| 491 | into a named hash used by C<doc> and C<readme>. | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | =head2 doc | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | Converts DocBook article XML beneath C<doc/> to sibling Markdown files, then | ||||||||||||||||||||||||||||||||||||||||||
| 497 | processes sidecar Markdown files from C<MANIFEST> and updates supported Perl | ||||||||||||||||||||||||||||||||||||||||||
| 498 | targets in place. | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | =head2 readme | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | Renders the project README from Markdown according to the precedence described | ||||||||||||||||||||||||||||||||||||||||||
| 504 | above. | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | =head2 manifest_add | ||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | Adds generated support files to C<MANIFEST>. | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | =head1 CAVEATS | ||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | This module contains MakeMaker-specific target execution. Hook installation is | ||||||||||||||||||||||||||||||||||||||||||
| 515 | provided by C<ASPEER::MakeMaker::MM::Import>, and Markdown/POD processing is | ||||||||||||||||||||||||||||||||||||||||||
| 516 | isolated in C<Markdown::Pod::Embed>. | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | The implementation expects a traditional MakeMaker distribution layout with a | ||||||||||||||||||||||||||||||||||||||||||
| 519 | usable C<MANIFEST> file. | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | C<ASPEER::MakeMaker::Markdown::Pod>, C<ASPEER::MakeMaker::MM::Import>, | ||||||||||||||||||||||||||||||||||||||||||
| 525 | C<Markdown::Pod::Embed>, C<ExtUtils::MakeMaker>, C<ExtUtils::Manifest> | ||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | Andrew Speer L<mailto:andrew.speer@isolutions.com.au> | ||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | This file is part of ASPEER::MakeMaker::Markdown::Pod. | ||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | This software is copyright (c) 2026 by Andrew Speer | ||||||||||||||||||||||||||||||||||||||||||
| 538 | L<mailto:andrew.speer@isolutions.com.au>. | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 541 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | Full license text is available at: | ||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | L<http://dev.perl.org/licenses/> | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | =cut | ||||||||||||||||||||||||||||||||||||||||||