phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/doc/vfs/inline2lyx.pl, 1.3


From: nomail
Subject: [Phpgroupware-cvs] phpgwapi/doc/vfs/inline2lyx.pl, 1.3
Date: Thu, 30 Dec 2004 07:47:30 +0100

Update of /phpgwapi/doc/vfs
Added Files:
        Branch: 
          inline2lyx.pl

date: 2004/12/30 06:47:30;  author: skwashd;  state: Exp;  lines: +0 -0

Log Message:
new HEAD
=====================================================================
#!/usr/bin/perl
#Created by Jason Wies (Zone, address@hidden)
#Copyright 2001 Jason Wies
#Released under GNU Public License

#Converts HeaderDoc style inline comments to LyX style LaTeX
#Usage: ./inline2lyx.pl file Title Author Date Abstract

if (address@hidden)
{
        print "Usage: ./inline2lyx.pl file Title Author Date Abstract\n";
        exit;
}

$output .= '\lyxformat 2.16
\textclass linuxdoc
\language default
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\paperorientation portrait
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Title
\added_space_top vfill \added_space_bottom vfill
' . @ARGV[1] . '
\layout Author

' . @ARGV[2] . '

\layout Date

' . @ARGV[3] . '

\layout Abstract

' . @ARGV[4] . '

\layout Section

' . @ARGV[1];

$file = `cat @ARGV[0]`;

@lines = split ('\n', $file);

foreach $line (@lines)
{
        undef $start;
        undef $class;
        undef $function;
        undef $abstract;
        undef $param;
        undef $result;
        undef $discussion;
        undef $end;
        undef $layout;

        if ($line =~ /\/\*\!/)
        {
                $in = 1;
                $start = 1;
        }

        if ($looking && $line =~ /function/)
        {
                $layout = "verbatim";
                undef $looking;
        }
        elsif (!$in)
        {
                goto next;
        }

        if ($line =~ /\@(class)/)
        {
                $layout = "subsection";
                $name = $1;
                $class = 1;
        }
        if ($line =~ /\@(function)/)
        {
                $layout = "subsection";
                $name = $1;
                $function = 1;
        }
        if ($line =~ /\@(abstract)/)
        {
                $layout = "standard";
                $name = $1;
                $abstract = 1;
        }
        if ($line =~ /\@(description)/)
        {
                $layout = "standard";
                $name = $1;
                $description = 1;
        }
        if ($line =~ /\@(param)/)
        {
                $layout = "standard";
                $name = $1;
                $param = 1;
        }
        if ($line =~ /\@(result)/)
        {
                $layout = "standard";
                $name = $1;
                $result = 1;
        }
        if ($line =~ /\@(discussion)/)
        {
                $layout = "standard";
                $name = $1;
                $discussion = 1;
        }
        if ($line =~ /\*\// && $in)
        {
                undef $in;
                $looking = 1;
                $end = 1;
        }

        if ($layout)
        {
                $output .= "\n\n" . '\layout ' . ucfirst ($layout);
                $line =~ s/address@hidden//;
                $line =~ s/\@//;
                $data = ucfirst ($line);
                if (!$function && !$class)
                {
                        $data =~ s/$name/$name:/;
                }
                $output .= "\n$data";
                if ($function || $class)
                {
                        $output .= "\n" . '\begin_inset LatexCommand 
\label{sec:' . "$data" . '}' . "\n\n" . '\end_inset';
                }
        }
        elsif ($in && !$start)
        {
                $output .= '\layout Standard' . "\n$line";
        }

        next:
}

$output .= "\n" . '\the_end';

print $output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]