From: Vincent Pit Date: Wed, 22 Apr 2015 20:14:31 +0000 (-0300) Subject: Make sure POD headings are linkable X-Git-Tag: v0.03~4 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=commitdiff_plain;h=61a93a58351bf2d238dcf81a1a557112b0c0ee85 Make sure POD headings are linkable --- diff --git a/lib/LaTeX/TikZ.pm b/lib/LaTeX/TikZ.pm index 57f2433..1c12cad 100644 --- a/lib/LaTeX/TikZ.pm +++ b/lib/LaTeX/TikZ.pm @@ -83,7 +83,9 @@ The two TikZ concepts of I and I have been unified with the modif =head2 Containers -=head3 C<< Tikz->union(@seq) >> +=head3 C + + Tikz->union(@seq) Creates a L object out of the paths C<@kids>. @@ -97,14 +99,18 @@ Creates a L object out of the paths C<@kids>. 'even odd rule', ); -=head3 C<< Tikz->join($connector, @kids) >> +=head3 C + + Tikz->join($connector, @kids) Creates a L object that joins the paths C<@kinds> with the given C<$connector> which can be, according to L, a string, an array reference or a code reference. # A stair Tikz->join('-|', map [ $_, $_ ], 0 .. 5); -=head3 C<< Tikz->chain($kid0, $link0, $kid1, $link1, ... $kidn) >> +=head3 C + + Tikz->chain($kid0, $link0, $kid1, $link1, ... $kidn) Creates a L object that chains C<$kid0> to C<$kid1> with the string C<$link0>, C<$kid1> to C<$kid2> with C<$link1>, and so on. @@ -114,7 +120,9 @@ Creates a L object that chains C<$kid0> to C<$kid1> wit => '.. controls (0.75, 0.25) and (1, 1.5) ..' => [ 0, 1 ] ); -=head3 C<< Tikz->seq(@kids) >> +=head3 C + + Tikz->seq(@kids) Creates a L object out of the sequences or paths C<@kids>. @@ -124,7 +132,9 @@ Creates a L object out of the sequences or paths C<@ Those are the building blocks of your geometrical figure. -=head3 C<< Tikz->point($point) >> +=head3 C + + Tikz->point($point) Creates a L object by coercing C<$point> into a L. The following rules are available : @@ -166,14 +176,18 @@ If C<$point> is a L object, the L by writing your own C class. See L for the rationale and L for an example. -=head3 C<< Tikz->line($from => $to) >> +=head3 C + + Tikz->line($from => $to) Creates a L object between the points C<$from> and C<$to>. my $x_axis = Tikz->line(-5 => 5); my $y_axis = Tikz->line([ 0, -5 ] => [ 0, 5 ]); -=head3 C<< Tikz->polyline(@points) >> +=head3 C + + Tikz->polyline(@points) Creates a L object that links the successive elements of C<@points> by segments. @@ -184,7 +198,9 @@ Creates a L object that links the successive element Tikz->point(1, 1), ); -=head3 C<< Tikz->closed_polyline(@points) >> +=head3 C + + Tikz->closed_polyline(@points) Creates a L object that cycles through successive elements of C<@points>. @@ -195,7 +211,10 @@ Creates a L object that cycles through successive el Tikz->point(1, 0), ); -=head3 C<< Tikz->rectangle($from => $to), Tikz->rectangle($from => { width => $width, height => $height }) >> +=head3 C + + Tikz->rectangle($from => $to) + Tikz->rectangle($from => { width => $width, height => $height }) Creates a L object with opposite corners C<$from> and C<$to>, or with anchor point C<$from> and dimensions C<$width> and C<$height>. @@ -204,13 +223,17 @@ Creates a L object with opposite corners C<$from> a Tikz->point(2, 1), ); -=head3 C<< Tikz->circle($center, $radius) >> +=head3 C + + Tikz->circle($center, $radius) Creates a L object of center C<$center> and radius C<$radius>. my $unit_circle = Tikz->circle(0, 1); -=head3 C<< Tikz->arc($from => $to, $center) >> +=head3 C + + Tikz->arc($from => $to, $center) Creates a L structure that represents an arc going from C<$from> to C<$to> with center C<$center>. @@ -220,14 +243,19 @@ Creates a L structure that represents an arc going from C<$fro [ 0, 0 ] ); -=head3 C<< Tikz->arrow($from => $to), Tikz->arrow($from => dir => $dir) >> +=head3 C + + Tikz->arrow($from => $to) + Tikz->arrow($from => dir => $dir) Creates a L structure that represents an arrow going from C<$from> towards C<$to>, or starting at C<$from> in direction C<$dir>. # An horizontal arrow my $arrow = Tikz->arrow(0 => 1); -=head3 C<< Tikz->raw($content) >> +=head3 C + + Tikz->raw($content) Creates a L object that will instantiate to the raw TikZ code C<$content>. @@ -236,7 +264,9 @@ Creates a L object that will instantiate to the raw TikZ Modifiers are applied onto sets by calling the C<< ->mod >> method, like in C<< $set->mod($mod) >>. This method returns the C<$set> object, so it can be chained. -=head3 C<< Tikz->clip($path) >> +=head3 C + + Tikz->clip($path) Creates a L object that can be used to clip a given sequence by the (closed) path C<$path>. @@ -249,7 +279,9 @@ Clips can also be directly applied to sets with the C<< ->clip >> method. my $set = Tikz->circle(0, 1.5) ->clip(Tikz->rectangle([-1, -1] => [1, 1])); -=head3 C<< Tikz->layer($name, above => \@above, below => \@below) >> +=head3 C + + Tikz->layer($name, above => \@above, below => \@below) Creates a L object with name C<$name> and optional relative positions C<@above> and C<@below>. @@ -268,35 +300,45 @@ Layers can also be directly applied to sets with the C<< ->layer >> method. ->mod(Tikz->pattern(class => 'Dots')) ->layer('top'); -=head3 C<< Tikz->scale($factor) >> +=head3 C + + Tikz->scale($factor) Creates a L object that scales the sets onto which it apply by the given C<$factor>. my $circle_of_radius_2 = Tikz->circle(0 => 1) ->mod(Tikz->scale(2)); -=head3 C<< Tikz->width($line_width) >> +=head3 C + + Tikz->width($line_width) Creates a L object that sets the line width to C<$line_width> when applied. my $thick_arrow = Tikz->arrow(0 => 1) ->mod(Tikz->width(5)); -=head3 C<< Tikz->color($color) >> +=head3 C + + Tikz->color($color) Creates a L object that sets the line color to C<$color> (given in the C syntax). # Paint the previous $thick_arrow in red. $thick_arrow->mod(Tikz->color('red')); -=head3 C<< Tikz->fill($color) >> +=head3 C + + Tikz->fill($color) Creates a L object that fills the interior of a path with the solid color C<$color> (given in the C syntax). my $red_box = Tikz->rectangle(0 => { width => 1, height => 1 }) ->mod(Tikz->fill('red')); -=head3 C<< Tikz->pattern(class => $class, %args) >> +=head3 C + + Tikz->pattern(class => $class, %args) Creates a L object of class C<$class> and arguments C<%args> that fills the interior of a path with the specified pattern. C<$class> is prepended with C when it doesn't contain C<::>. @@ -305,7 +347,9 @@ See L and L f my $hatched_circle = Tikz->circle(0 => 1) ->mod(Tikz->pattern(class => 'Lines')); -=head3 C<< Tikz->raw_mod($content) >> +=head3 C + + Tikz->raw_mod($content) Creates a L object that will instantiate to the raw TikZ mod code C<$content>. @@ -314,14 +358,18 @@ Creates a L object that will instantiate to the raw TikZ =head2 Helpers -=head3 C<< Tikz->formatter(%args) >> +=head3 C + + Tikz->formatter(%args) Creates a L object that can render a L tree. my $tikz = Tikz->formatter; my ($header, $declarations, $seq1_body, $seq2_body) = $tikz->render($set1, $set2); -=head3 C<< Tikz->functor(@rules) >> +=head3 C + + Tikz->functor(@rules) Creates a L anonymous subroutine that can be called against L trees to clone them according to the given rules. C<@rules> should be a list of array references whose first element is the class/role to match against and the second the handler to execute. diff --git a/lib/LaTeX/TikZ/Formatter.pm b/lib/LaTeX/TikZ/Formatter.pm index 58c2985..e06676a 100644 --- a/lib/LaTeX/TikZ/Formatter.pm +++ b/lib/LaTeX/TikZ/Formatter.pm @@ -142,7 +142,9 @@ sub id { } map($tikz->$_, qw), $origin; } -=head2 C +=head2 C + + my ($header_lines, $mod_lines, $content_lines) = $formatter->render(@sets); Processes all the L objects given in C<@sets> to produce the actual TikZ code to insert in the LaTeX file. First, all the mods applied to the sets and their subsets are collected, and a declaration is emitted if needed for each of them by calling L. @@ -296,7 +298,9 @@ sub render { return \@header, \@decls, @bodies; } -=head2 C +=head2 C + + my $physical_len = $formatter->len($logical_len); Format the given length according to the formatter options. @@ -310,7 +314,9 @@ sub len { sprintf $tikz->format . $tikz->unit, $len * $tikz->scale; } -=head2 C +=head2 C + + my $physical_angle = $formatter->angle($logical_angle); Format the given angle (in radians) according to the formatter options. @@ -326,7 +332,9 @@ sub angle { sprintf $tikz->format, POSIX::ceil($a); } -=head2 C