| 1 | # | ||||||||||||||||||||||||||||
| 2 | # This file is part of Markdown::Pod::Embed. | ||||||||||||||||||||||||||||
| 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 Markdown::Pod::Embed::Constant; | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # Compiler pragma and package variables | ||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||
| 18 | 8 | ▶ | use strict qw(vars); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 8 | ▶ | use vars qw($VERSION @ISA @EXPORT $OPTION_HR $PANDOC_EXE | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 8 | $PANDOC_CMD_MD2TEXT_CR); | |||||||||||||||||||||||||||
| 21 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | # External packages | ||||||||||||||||||||||||||||
| 25 | # | ||||||||||||||||||||||||||||
| 26 | 8 | ▶ | use Config; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 8 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 8 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # Version and exports | ||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||
| 33 | 8 | $VERSION='1.012'; | |||||||||||||||||||||||||||
| 34 | 8 | @ISA=qw(Exporter); | |||||||||||||||||||||||||||
| 35 | 8 | @EXPORT=qw($OPTION_HR $PANDOC_EXE $PANDOC_CMD_MD2TEXT_CR); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | # Default processor options | ||||||||||||||||||||||||||||
| 39 | # | ||||||||||||||||||||||||||||
| 40 | 8 | $OPTION_HR={dialect => 'GitHub'}; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | # Find Pandoc when it is available for plain-text rendering | ||||||||||||||||||||||||||||
| 44 | # | ||||||||||||||||||||||||||||
| 45 | 8 | $PANDOC_EXE=''; | |||||||||||||||||||||||||||
| 46 | 8 | foreach my $dir (File::Spec->path()) { | |||||||||||||||||||||||||||
| 47 | 80 | foreach my $name (qw(pandoc pandoc.exe)) { | |||||||||||||||||||||||||||
| 48 | 160 | my $fn=File::Spec->catfile($dir, $name); | |||||||||||||||||||||||||||
| 49 | 160 | ▶ | if (-f $fn && -x $fn) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-f $fn and -x $fn
MC/DC0%0/2
-f $fn and -x $fn
-f $fn
-x $fn
Truth table33%1/3
A and B
A= -f $fnB= -x $fn
| |||||||||||||||||||||||||||||
| 50 | 0 | $PANDOC_EXE=$fn; | |||||||||||||||||||||||||||
| 51 | 0 | last; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | 80 | ▶ | last if $PANDOC_EXE; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # Construct the Markdown-to-text Pandoc command | ||||||||||||||||||||||||||||
| 59 | # | ||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $PANDOC_CMD_MD2TEXT_CR=sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 61 | 0 | return [shift(), '-f', 'gfm', '-t', 'plain', shift()]; | |||||||||||||||||||||||||||
| 62 | 8 | }; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # Done | ||||||||||||||||||||||||||||
| 66 | # | ||||||||||||||||||||||||||||
| 67 | 8 | 1; | |||||||||||||||||||||||||||
| 68 | __END__ | ||||||||||||||||||||||||||||