Anonymous avatar Anonymous committed 6842c8c

Now rendering and uploading part1 of the Perl for Newbies.

Comments (0)

Files changed (3)

 
 DOCS_COMMON_DEPS = template.wml lib/books.wml
 
-all: latemp_targets
+all: latemp_targets perl_for_newbies_extra_data
 
 include include.mak
 include rules.mak
+include p4n.mak
 
 upload: upload_hexten
 
 use warnings;
 
 use HTML::Latemp::GenMakeHelpers;
+use File::Find::Object::Rule;
 
 my $generator = 
     HTML::Latemp::GenMakeHelpers->new(
     
 $generator->process_all();
 
+{
+    open my $out_fh, ">", "p4n.mak";
+
+    my @targets;
+    foreach my $part_idx (1 .. 4)
+    {
+         # find all the .pm files in @INC
+         my @files = 
+            File::Find::Object::Rule
+                ->any(
+                    (File::Find::Object::Rule
+                        ->name(qr/\.svn/)
+                        ->prune()
+                        ->discard()
+                    ),
+                    (File::Find::Object::Rule
+                        ->file()
+                        ->exec(sub { 
+                                $_[0] ne "index\.html" 
+                        })
+                    ),
+                )->in("lib/tutorials/perl-for-newbies/lect${part_idx}-all-in-one/")
+                ;
+        
+        foreach my $f (@files)
+        {
+            my $target = $f;
+
+            # print $f, "\n";
+            $target =~ s{\Alib/}{};
+           
+            $target =~ s{/lect(\d+)-all-in-one/}{/part$1/};
+            
+            $target = "\$(BERLIOS_DEST)/$target";
+
+            push @targets, $target;
+
+            print {$out_fh} "$target: $f\n\tmkdir -p `dirname \$\@`\n\tcp -f \$< \$\@\n\n";
+        }
+    }
+
+    my $makefile_var_name = "DEST_TUTORIALS_PERL_FOR_NEWBIES_TARGETS";
+
+    print {$out_fh} "$makefile_var_name = " . join(" ", @targets) . "\n\n";
+
+    print {$out_fh} "perl_for_newbies_extra_data: \$($makefile_var_name)\n\n";
+
+    close($out_fh);
+}
 1;
 

src/tutorials/perl-for-newbies/part1/index.html.wml

+#include '../template.wml'
+
+<latemp_extra_head_elements>
+<link rel="stylesheet" href="style.css" />
+</latemp_extra_head_elements>
+
+<:{
+{
+    use strict;
+    use warnings;
+    use IO::All;
+
+    use Encode (qw(decode));
+
+    binmode STDOUT, ":utf8";
+
+    my $contents = io()
+        ->file("../lib/tutorials/perl-for-newbies/lect1-all-in-one/index.html")
+        ->slurp()
+        ;
+
+    $contents =~ s{.*<body[^>]*>}{}ms;
+    $contents =~ s{</body>.*}{}ms;
+
+    print decode("UTF-8", $contents);
+}
+}:>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.