1. Shlomi Fish
  2. perl-begin

Commits

shl...@13c2ddb8-3aa7-4284-800b-8db07c650eef  committed 485ab17

Extracted a macro to render the perl-for-newbies page.

  • Participants
  • Parent commits ffcca1a
  • Branches default

Comments (0)

Files changed (2)

File lib/perl-for-newbies.wml

View file
  • Ignore whitespace
 
 %body
 </define-tag>
+
+<define-tag perl_for_newbies_tutorial_page>
+<preserve idx />
+<set-var %attributes />
+
+<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));
+
+    my $idx = "<get-var idx />";
+
+    binmode STDOUT, ":utf8";
+
+    my $contents = io()
+        ->file("../lib/tutorials/perl-for-newbies/lect$idx-all-in-one/index.html")
+        ->slurp()
+        ;
+
+    $contents =~ s{.*<body[^>]*>}{}ms;
+    $contents =~ s{</body>.*}{}ms;
+
+    print decode("UTF-8", $contents);
+}
+}:>
+<restore idx />
+</define-tag>

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

View file
  • Ignore whitespace
 #include '../template.wml'
+#include "perl-for-newbies.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);
-}
-}:>
+<perl_for_newbies_tutorial_page idx="1" />