Commits

Shlomi Fish committed 1f147a6

Output the <h3> too.

Comments (0)

Files changed (2)

lib/PerlBegin/TopicsExamples.pm

 use CGI ();
 use Text::VimColor;
 
+has 'title' => (isa => 'Str', is => 'ro');
 has 'id_base' => (isa => 'Str', is => 'ro');
 has 'examples' => (isa => 'ArrayRef[HashRef]', is => 'ro');
 
         ;
 }
 
+sub html_with_title
+{
+    my $self = shift;
+
+    return
+        qq[<h3 id="] . CGI::escapeHTML($self->id_base())
+        . qq[">] . CGI::escapeHTML($self->title()) . qq[</h3>\n\n]
+        . $self->render()
+        ;
+}
+
 1;

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

     });
 </script>
 
-<h3 id="copying_a_file">Copying a file</h3>
-
 <:{
     use PerlBegin::TopicsExamples;
 
     print PerlBegin::TopicsExamples->new(
         {
+            title => "Copying a file",
             id_base => "copying_a_file",
             examples =>
             [
                 },
             ],
         }
-    )->render();
+    )->html_with_title();
 }:>
 
 <h3 id="overwrite_a_file">Overwriting a file with text.</h3>