PerlPoint-Converters

 view release on metacpan or  search on metacpan

pp2latex  view on Meta::CPAN

      push_page $page_ref, "\\label{$index_anchor}";

      push_page $page_ref, "\\index{$idx}";

      if ( defined $_[3]->{'mode'} and $_[3]->{'mode'} eq "index_only"){
        @BUFFER = ();
      }
    } else {
      flush;
    }
    return;
  }

  if ($_[2] eq "TABLE") {                                       # TABLE
    flush;
    if ($_[1]==DIRECTIVE_START) {
      my $cols = "|c|c|c|c|";
      if ( defined $_[3]->{'columns'}) {
         $cols = $_[3]->{'columns'};
      }
      push_page $page_ref, "\n\n\\vspace{1ex}\n\\begin{tabular}{$cols}\n";
      push_page $page_ref, "\\hline\n" unless $OPT{double_lines};
    } else {
      push_page $page_ref, "\n\n\\end{tabular}\n\n";
    }
    return;
  }

  if ($_[2] eq "TABLE_HL") {                                       # TABLE
    flush;
    if ($_[1]==DIRECTIVE_START) {
      push_page $page_ref, "\\bf ";
    } else {
      push_page $page_ref, " & "; # &
    }
    return;
  }

  if ($_[2] eq "TABLE_ROW") {                                       # TABLE
    flush;
    if ($_[1]==DIRECTIVE_START) {
      push_page $page_ref, "\\hline\n" if $OPT{double_lines};
    } else {
      pop (@$page_ref); # to remove extra '&'
      push_page $page_ref, "\\\\\\hline\n";
    }
    return;
  }

  if ($_[2] eq "TABLE_COL") {                                       # TABLE
    flush;
    if ($_[1]==DIRECTIVE_START) {
      push_page $page_ref, "";
    } else {
      push_page $page_ref, " & "; # &
    }
    return;
  }


  if ($_[2] eq "EMBED") {                                       # embeded LaTeX
    flush;
    if ($_[1]==DIRECTIVE_START) {
      if ( !defined $_[3]->{'lang'}) {
        pp_warn "ERROR: EMBED without 'lang' parameter\n";
      }
      elsif ($_[3]->{'lang'} =~ /latex/i){
        $embedded_latex = 1;
      }
    } else {
      $embedded_latex = 0;
    }
    @BUFFER=();
    return;
  }

  if ($_[2] eq 'LOCALTOC') { # ste, ldo
     # act mode dependend - we only need to handle this once, there is no tag body
     if ($_[1]==DIRECTIVE_START)
       {
        # get local toc
        my $toc=$backend->toc(
                              $backend->currentChapterNr,
                              exists $_[3]->{depth} ? $_[3]->{depth} : 0,
                             );

        # anything found?
        if (@$toc)
          {
           # make it into a list
           push_page $page_ref,  "\n\n\\begin{itemize}\n";
           push_page $page_ref,  '  \\item ', ' ', $_->[1], "\n" for @$toc;
           push_page $page_ref,  "\n\\end{itemize}\n\n";
          }
       }

     # ok, well done
     return;
  }

  warn "**** $me: unkown or not yet implemented tag: $_[2]\n";
} # handleTag }}}1

sub handleDocument { #{{{1---------------------------------------
  if ($_[1]==DIRECTIVE_START) {
    warn "\n[Info] Document start ($_[2]).\n" if $verbose;

  }
  else {

    warn "\n[Info] Document end ($_[2]).\n" if $verbose;
  }
} # handleDocument }}}1

sub flush { #{{{1------------------------------------------------
  push_page $page_ref, @BUFFER;
  push @ERRBUFFER, @BUFFER;
  @BUFFER = ();
  # trim ERRBUFFER:
  @ERRBUFFER = grep (!/^\s*$/ ,@ERRBUFFER);
  for (my $k=1;$k<scalar(@ERRBUFFER)-6;$k++){
    shift @ERRBUFFER;
  }
} # flush }}}1

pp2latex  view on Meta::CPAN

__END__


# POD SECTION {{{1=============================================

=head1 NAME

B<pp2latex> - PerlPoint to LaTeX converter

=head1 VERSION

This man page describes $Revision: 1.14 $
from PerlPoint::Converters Package 1.0205


=head1 SYNOPSIS

  pp2latex --help
  pp2latex [@options_file] [options] slide_text 

=head1 DESCRIPTION

C<pp2latex> creates a LaTeX file from a PerlPoint input file.


=head1 SYNTAX of PerlPoint Files

For a detailed description of the PerlPoint language please refer to the
excellent POD documentation of the B<PerlPoint::Parser> Module by Jochen Stenzel.
There you will find everything you ever wanted to know about PerlPoint ;-)


=head1 OPTIONS

=over 4


=item --section-sequence=chapter

This option may (and should) be specified more than once. For each level of headline a
corresponding LaTeX section can be specified: The following sequence of options yields
the assignment shown below:

 --section-sequence=section
 --section-sequence=subsection
 --section-sequence=subsubsection
 --section-sequence=paragraph
 --section-sequence=bftext

 =Healine Level 0             --->  \section{Headline Level 0}
 ==Healine Level 1            --->  \subsection{Headline Level 1}
 ===Healine Level 2           --->  \subsubsection{Headline Level 2}
 ====Healine Level 3          --->  \paragraph{Headline Level 3}
 =====Healine Level 4, 5, ... --->  \textbf{Headline Level 4, 5, ...}

B<Note:> --section-sequence=chapter can only be use if the document class is report or book.

=item --filter=regexp

This specifies a regular expression C<regexp> which should match
all allowed languages for EMBEDed code. The expression is evaluated
caseinsensitively.

Example: --filter="perl|latex"

=item --prolog=filename

Specifies a file which must contain the LaTeX Declarations for the document.
C<\documentclass> and C<\begin{document}> must be defined there.

=item --activeContents

PerlPoint sources can embed Perl code which is evaluated while the source is parsed. For
reasons of security this feature is deactivated by default. Set this option to active
it. You can use I<--safeOpcode> to fine tune which operations shall be permitted.

=item --double_lines

This option has the effect that all horizontal Lines in Tables are
doubled.

=item --cache

parsing of one and the same document several times can be accelerated by activating the
PerlPoint parser cache by this option. The performance boost depends on your document
structure.

Cache files are written besides the source and named ".<source file>.ppcache".

It can be useful to (temporarily) deactivate the cache to get correct line numbers in
parser error messages (currently numbers cannot always reported correctly with activated
cache because of a special perl behaviour).

=item --cacheCleanup

PerlPoint parser cache files grow (with every modified version of a source parsed)
because they store expressions for every parsed variant of a paragraph. This is usually
uncritical but you may wish to clean up the cache occasionally. Use this option to
perform the task (or remove the cache file manually).


=item -nocopyright

suppresses the copyright message;

=item -noinfo

supresses runtime informations;

=item --nowarn

supresses warnings;

=item --quiet

a shortcut for "--nocopyright --noinfo --nowarn": all non critical runtime messages are suppressed;

=item --safeOpcode <opcode>

If active contents is enabled (I<--activeContents>), Perl code embedded into the translated PerlPoint sources will be
evaluated. To keep security this is done via an object of class B<Safe> which restricts code



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