Shlomi Fish avatar Shlomi Fish committed 3acfd44

Start converting to PerlBegin::TopicsExamples.

Comments (0)

Files changed (2)

lib/PerlBegin/TopicsExamples.pm

 EOF
 
         my $tvc = Text::VimColor->new(
-            string => \$s,
+            string => \$code,
             filetype => 'perl',
         );
 

src/topics/files-and-directories/index.html.wml

 
 <h3 id="copying_a_file">Copying a file</h3>
 
-<div class="tabs">
+<:{
+    use PerlBegin::TopicsExamples;
 
-<ul>
-
-<li><a href="#copying_a_file_io_all">IO-All</a></li>
-
-<li><a href="#copying_a_file_core">Core Perl</a></li>
-
-</ul>
-
-<div id="copying_a_file_io_all">
-
-<perl_code>
+    print PerlBegin::TopicsExamples->new(
+        {
+            id_base => "copying_a_file",
+            examples =>
+            [
+                {
+                    id => "io_all",
+                    label => "IO-All",
+                    code => <<'EOF',
 use IO::All;
 
 my ($source_filename, $dest_filename) = @_;
 io->file($source_filename) > io->file($dest_filename);
-</perl_code>
+EOF
 
-</div>
-
-<div id="copying_a_file_core">
-
-<perl_code>
-
+                },
+                {
+                    id => "core",
+                    label => "Core Perl",
+                    code => <<'EOF',
 use File::Copy qw(copy);
 
 my ($source_filename, $dest_filename) = @_;
 
 copy($source_filename, $dest_filename);
-</perl_code>
-
-</div>
-
-</div>
+EOF
+                },
+            ],
+        }
+    )->render();
+}:>
 
 <h3 id="overwrite_a_file">Overwriting a file with text.</h3>
 
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.