Skip to content

Instantly share code, notes, and snippets.

@prakashk
Created June 10, 2010 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prakashk/433567 to your computer and use it in GitHub Desktop.
Save prakashk/433567 to your computer and use it in GitHub Desktop.
diff --git a/bin/book-to-latex b/bin/book-to-latex
index a909a46..f3f1018 100644
--- a/bin/book-to-latex
+++ b/bin/book-to-latex
@@ -12,6 +12,7 @@ print <<'HEADER';
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage[colorlinks=true,pagebackref]{hyperref}
+\usepackage{wrapfig}
\makeindex
@@ -38,3 +39,34 @@ print <<'FOOTER';
\end{document}
FOOTER
+
+package Pod::PseudoPod::LaTeX;
+
+sub start_sidebar
+{
+ my ( $self, $flags ) = @_;
+ $self->{scratch} .= "\\begin{wrapfigure}[]{O}[0pt]{3.5in}\n"
+ . "\\framebox{\n"
+ . "\\begin{minipage}{3.5in}\n"
+ . "\\vspace{3pt}\n\n";
+
+ if ( $flags->{title} )
+ {
+ my $title = $self->encode_text( $flags->{title} );
+ $self->{scratch} .= "\\begin{center}\n"
+ . "\\large{\\bfseries{" . $title . "}}\n"
+ . "\\end{center}\n\n";
+ }
+}
+
+sub end_sidebar
+{
+ my $self = shift;
+ $self->{scratch} .= "\\vspace{3pt}\n"
+ . "\\end{minipage}\n"
+ # end framebox
+ . "}\n"
+ . "\\end{wrapfigure}\n";
+}
+
+1;
diff --git a/src/multi-dispatch.pod b/src/multi-dispatch.pod
index 86292a0..9f8d1c9 100644
--- a/src/multi-dispatch.pod
+++ b/src/multi-dispatch.pod
@@ -153,6 +153,13 @@ The first C<$counter> output is always C<0>, since the nominal types
alone already determine which candidate matches best, so the where-block
is never executed.
+=begin sidebar
+
+You I<can> do this, but you should avoid it in anything other than example
+code. Relying on the side effects of type checks produces unreliable code.
+
+=end sidebar
+
The second output is at least C<1>. The compiler has to execute the
where-block at least once to check if the third candidate can be called, but
the specification does not require the minimal possible number of runs.
@@ -167,13 +174,6 @@ Verify Rakudo * behavior at press time.
=end for
-=begin sidebar
-
-You I<can> do this, but you should avoid it in anything other than example
-code. Relying on the side effects of type checks produces unreliable code.
-
-=end sidebar
-
=head1 Narrowness
There's one candidate not yet explained from the JSON example:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment