PerlPoint-Package

 view release on metacpan or  search on metacpan

demo/pp2sdf  view on Meta::CPAN


  \L{url=link}<Look there!> becomes "{{CMD[jump=q(link)]Look there!}}".

Using C<q()> avoids sdf trouble caused by quotes in the link.

=item PAGEREF

The section title provided by the C<name> option is treated as the text to be displayed.
This text is made a hyperlink to the referenced chapter.

 Example:

  \PAGEREF{name=chapter} becomes "{{CMD[jump=q(#chapter)]chapter".

B<pp2sdf> currently does not replace the title by chapter numbers as usually intended
by a page reference. This might be improved by later versions.

Using C<q()> avoids sdf trouble caused by quotes in the link.


=item SECTIONREF

The section title provided by the C<name> option is treated as the text to be displayed.
This text is made a hyperlink to the referenced chapter.

 Example:

  \SECTIONREF{name=chapter} becomes "{{CMD[jump=q(#chapter)]chapter".

Using C<q()> avoids sdf trouble caused by quotes in the link.


=item XREF

The tag body is made a hyperlink to an internal target, usually declared by an \A tag or
(implicitly) by a headline.

 Example:

  Do not miss \XREF{name=chapter}<this>

is translated into

 "Do not miss {{CMD[jump=q(#chapter)]this".

Using C<q()> avoids sdf trouble caused by quotes in the link.


=item U

Marks the body to be underlined

 Example:

  \U<text> becomes "{{U:text}}".


=back


=head1 EMBEDDING TARGET CODE

There may be things you want to see in the target document but find no way to express
them in PerlPoint. Well, PerlPoint lets you embed target code very easily directly into
the PerlPoint script. Nevertheless, it is recommended to use native PerlPoint wherever
possible ;-).

Please note that embedded target code intended for certain translators like B<pp2sdf>
may be B<I<ignored>> if the PerlPoint document is processed by I<other> translators.
pp2html, for example, accepts embedded HTML but ignores embedded SDF.

=head2 Embedding SDF

Just use the B<\EMBED> and B<\END_EMBED> tags to place native SDF if really
necessary:

  This is \I<PerlPoint> with embedded
  \EMBED{lang=sdf}{{B:SDF}}\END_EMBED.

  \EMBED{lang=sdf}

  H2: An SDF chapter

  Note: An SDF note.

  \END_EMBED

You may as well I<include> complete SDF files by B<\INCLUDE>.

  \INLUDE{type=sdf file="snippet.sdf"}


=head2 Embedding HTML

is as easy as embedding SDF directly. It is, of course, only useful if you plan
to transform your presentation to an HTML page via SDF. You can embed complete
HTML sections:

  \EMBED{lang=html}

  <h1>An HTML chapter</h1>

  <p>
  This was written in <i>HTML</i>.

  \END_EMBED

This way B<pp2sdf> will produce SDF inline blocks like this:

  !block inline

  <h1>An HTML chapter</h1>

  <p>
  This was written in <i>HTML</i>.

  !endblock

Further proceeding is up to sdf, so please refer to the SDF manuals for details.

Alternatively, you may choose to embed HTML directly into a PerlPoint paragraph:

  This is \I<PerlPoint> with embedded
  \EMBED{lang=html}<b>HTML</b>\END_EMBED.

This will be translated into an SDF inline I<phrase>:

  This is {{I:PerlPoint}} with embedded {{INLINE:<b>HTML</b>}}.

Please note that for unknown reasons SDF processes POD tags in inlined I<phrases> (even
if it was not intended to use POD). In the example above, this causes a wrong result
because an C<L> tag is assumed. This is currently a feature of sdf, not pp2sdf.

HTML code can be embedded by complete I<files> as well, of course:

  \INLUDE{type=html file="snippet.html"}


=head2 Embedding other languages

B<pp2sdf> will ignore any other embedded or included target language than SDF and HTML.


=head1 HYPERLINKS

Each headline is implicitly made an anchor named like the headline itself. For example,

 =Headline level 1

is converted into

 H1[id=q(Headline level 1)]Headline level 1

, making it easy to set links to certain headlines which is usually done by using the
C<PAGEREF>, C<SECTIONREF> and C<XREF> tags.

Anchors can be set explicitly as well. Please have a look at the description of the \A tag.


=head1 PREDECLARED VARIABLES

B<pp2sdf> predeclares several variables which can be used like any user defined PerlPoint
variable.

=over 4

=item CONVERTER_NAME

The name of the converter currently processing the document ("pp2sdf").

=item CONVERTER_VERSION

The version of the running converter.

=back


=head1 FILES

=head1 ENVIRONMENT

=over 4

=item SCRIPTDEBUG

demo/pp2sdf  view on Meta::CPAN

       }
     else
       {
        # clean up global table buffer, use a local copy for completion
        my $tableBuffer=$table;
	$table={};

        # open table
        present("\n\n!block table; noheadings\n");
        present(join(';', map {"c$_";} (1..$settings->{__maxColumns__})), "\n");

        foreach my $row (@{$tableBuffer->{rows}})
          {
           present(join(';', map {
                                  # remove laeding and trailing whitespaces
                                  s/^\s+//;
                                  s/\s+$//;
                                  s/^(\{\{\w:)\s+/$1/;
                                  s/\s+(\}\})$/$1/;
                                  s/\}{3}$/\} \}\}/;

                                  # supply cell contents
                                  $_;
                                 } @$row
                       ), "\n"
                  );
          }

        # close table
        present("\n!endblock\n\n");
       }

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'TABLE_ROW')
    {
     # act mode dependend
     push(@{$table->{rows}}, []) if $mode==DIRECTIVE_START;

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'TABLE_COL')
    {
     # act mode dependend
     push(@{$table->{rows}[-1]}, '') if $mode==DIRECTIVE_START;

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'TABLE_HL')
    {
     # act mode dependend
     push(@{$table->{rows}[-1]}, '{{B:') if $mode==DIRECTIVE_START;
     $table->{rows}[-1][-1].='}}'        if $mode==DIRECTIVE_COMPLETE;

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'EMBED' and $settings->{lang}=~/^sdf$/i)
    {
     # act mode dependend
     if ($mode==DIRECTIVE_START)
       {
        # flag that we are within embedded SDF
        $flags{sdf}=1;
       }
     else
       {
        # flag that embedded SDF is completed
        $flags{sdf}=0;
       }

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'EMBED' and $settings->{lang}=~/^html$/i)
    {
     # act mode dependend
     if ($mode==DIRECTIVE_START)
       {
        # flag that we are within embedded HTML
        $flags{html}=1;

        # reset text start flag (otherwise, the inlined HTML would be prefixed
        # by a backslash if placed at the beginning of a paragraph)
        $flags{textstart}=0;
       }
     else
       {
        # flag that embedded HTML is now buffered completely
        $flags{html}++;

        # complete SDF inlining
        present(
                $htmlBuffer=~/\n/ ? "\n!block inline\n" : "{{INLINE:",
                $htmlBuffer,
                $htmlBuffer=~/\n/ ? "\n!endblock\n"     : "}}",
               );

        # flag that embedded HTML is completed
        $flags{html}=0;

        # clean up HTML buffer
        $htmlBuffer='';
       }

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'SECTIONREF' or $tag eq 'PAGEREF')
    {
     # These tags do not have a body, so we can ignore the closing directive.
     # The displayed text is the *final* part of the anchor name (which can be hierarchical).
     if ($mode==DIRECTIVE_START)
       {
	my $target=$settings->{name};
	$target=~s/\s*\|\s*/\|/g;
	present("{{CMD[jump=q(#$target)]", (reverse split(/\|/, $target))[0], "}}");
       }

     # ok, well done
     return(1);
    }
  elsif ($tag eq 'XREF')
    {
     # act mode dependend
     if ($mode==DIRECTIVE_START)
       {
	my $target=$settings->{name};
	$target=~s/\s*\|\s*/\|/g;
	present("{{CMD[jump=q(#$target)]");
       }
     else
       {present("}}");}

     # ok, well done



( run in 0.974 second using v1.01-cache-2.11-cpan-71847e10f99 )