Stump
view release on metacpan or search on metacpan
lib/Stump/Heavy.pm view on Meta::CPAN
use strict; use warnings;
package Stump::Heavy;
# What follows is an ongoing refactoring of Larry's original code as given to
# Ingy @ YAPC::Riga 2011:
use utf8;
my %COLOR = qw(
S Red
E Purple
B Blue
G Green
C Cyan
M Magenta
Y Yellow
O Orange
R Red
L Lavender
P Purple
K Black
g Gray
W White
);
binmode(STDIN, ':utf8');
binmode(STDOUT, ':utf8');
binmode(STDERR, ':utf8');
sub para2odp {
my $input = 'stump.input';
my $build = 'stump';
my $template = 'stump.odp';
die "Invalid template" unless -e $template;
system "mkdir $build; cd $build; unzip ../$template"
unless -d $build;
open CONTENT, ">:utf8", "$build/content.xml"
or die "Can't create $build/content.xml: $!";
system "rm -rf $build/Pictures/*";
my $text;
my @para;
{
open IN, '<:utf8', $input or die "Can't open $input: $!";
local $/ = "";
chomp(@para = <IN>);
close IN;
}
print CONTENT <<'END';
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:rpt='http://openoffice.org/2005/report' grddl:transformation='http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl' xmlns:math='http://www.w3.org/1998/Ma...
<office:scripts />
<office:automatic-styles>
<style:style style:name='dp1' style:family='drawing-page'>
<style:drawing-page-properties presentation:background-visible='true' presentation:display-date-time='true' draw:fill='solid' draw:fill-image-width='0cm' draw:fill-color='#ffffff' presentation:display-page-number='false' presentation:display-fo...
</style:style>
<style:style style:name='dp2' style:family='drawing-page'>
<style:drawing-page-properties presentation:display-date-time='true' presentation:display-page-number='false' presentation:display-footer='true' presentation:display-header='true' />
</style:style>
<style:style style:name='dp3' style:family='drawing-page'>
<style:drawing-page-properties presentation:background-visible='true' presentation:display-date-time='true' presentation:display-page-number='false' presentation:display-footer='true' presentation:background-objects-visible='true' />
</style:style>
<style:style style:parent-style-name='standard' style:name='middling' style:family='graphic'>
<style:graphic-properties svg:stroke-color='#000000' draw:stroke='none' fo:max-height='0cm' draw:fill='none' draw:fill-color='#ffffff' draw:auto-grow-height='true' draw:textarea-vertical-align='middle' fo:min-height='0cm' draw:auto-grow-width='...
</style:style>
<style:style style:name='gr2' style:family='graphic'>
<style:graphic-properties style:protect='size' />
</style:style>
<style:style style:parent-style-name='standard' style:name='takahashi' style:family='graphic'>
<style:graphic-properties svg:stroke-color='#000000' draw:stroke='none' fo:min-width='3.296cm' draw:textarea-horizontal-align='center' draw:textarea-vertical-align='middle' draw:fill='none' draw:fill-color='#ffffff' draw:auto-grow-height='true'...
</style:style>
<style:style style:parent-style-name='standard' style:name='gr4' style:family='graphic'>
<style:graphic-properties draw:red='0%' draw:stroke='none' draw:contrast='0%' draw:textarea-horizontal-align='center' draw:blue='0%' draw:fill='none' fo:clip='rect(0cm, 0cm, 0cm, 0cm)' draw:textarea-vertical-align='middle' draw:gamma='100%' dra...
</style:style>
<style:style style:parent-style-name='Default-notes' style:name='pr1' style:family='presentation'>
<style:graphic-properties draw:fill-color='#ffffff' draw:auto-grow-height='true' fo:min-height='12.573cm' />
</style:style>
<style:style style:parent-style-name='Default-notes' style:name='pr2' style:family='presentation'>
<style:graphic-properties fo:min-width='16.771cm' draw:fill-color='#ffffff' draw:auto-grow-height='true' fo:min-height='12.573cm' />
</style:style>
<style:style style:name='P1' style:family='paragraph'>
<style:paragraph-properties fo:text-align='start' />
<style:text-properties style:font-size-complex='12pt' fo:font-family=''Liberation Mono'' style:font-family-generic='modern' style:font-size-asian='12pt' style:font-pitch='fixed' fo:font-size='12pt' />
</style:style>
<style:style style:name='P2' style:family='paragraph'>
<style:text-properties fo:font-size='20pt' />
</style:style>
<style:style style:name='P3' style:family='paragraph'>
<style:paragraph-properties fo:text-align='center' />
<style:text-properties style:font-size-complex='20pt' style:font-size-asian='20pt' fo:font-size='20pt' />
</style:style>
<style:style style:name='P4' style:family='paragraph'>
<style:paragraph-properties fo:text-align='center' />
</style:style>
END
for my $pt (5..20,25,30,40,50) {
print CONTENT <<"END";
<style:style style:name='M$pt' style:family='text'>
<style:text-properties style:font-size-complex='${pt}pt' fo:font-family=''Liberation Mono'' style:font-family-generic='modern' style:font-size-asian='${pt}pt' style:font-pitch='fixed' fo:color='#000000' fo:font-size='${pt}pt' />
</style:style>
<style:style style:name='S$pt' style:family='text'>
<style:text-properties style:font-size-complex='${pt}pt' fo:font-family=''Liberation Sans'' style:font-family-generic='modern' style:font-size-asian='${pt}pt' fo:color='#000000' fo:font-size='${pt}pt' />
</style:style>
( run in 1.436 second using v1.01-cache-2.11-cpan-5e09290becf )