groff
[Top][All Lists]
Advanced

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

Re: [groff] A poor mans Excel


From: John Gardner
Subject: Re: [groff] A poor mans Excel
Date: Thu, 10 Oct 2019 23:00:32 +1100

That reminds me of an idea for a preprocessor I had called xtbl, which
could convert between common plain-text table formats... tbl(1), TSV, rST /
Markdown, and HTML.

> Code size: 130 lines of perl

Show us the code and I'll see how far I can golf it down for you. :D


On Thu, 10 Oct 2019 at 22:21, Ulrich Lauther <address@hidden>
wrote:

> Hi all,
>
> I have written a small perlscript, that preprocesses tables
> and allows to
>
>         - add the values in selected collums
>         - to replace a table entry by the result of an expression
>
> Lines between
> .(
> and
> .)
> are processed.
>
> The ".(" line may contain the numbers of collums in which addition
> is requested, e.g.:
> .( add 2 5 7
> or just
> .( 2 5 7
>
> ".(" ".)" blocks my be nested; sums calculated at a lower level are
> propagated up.
>
>
> Table entries of the form E.<n> <expression> are repaced by the result
> of the expression rounded to n digits after the decimal point.
> "expression" is any valid perl expression.
> Variables used in the expression are
>         - any valid perl variable (starting with "$")
>         - $<n>, the value in column n in the current line
>         - $S, sum of values in the column (where $S is placed) seen so far
> If $S or E.<n> is precedet by an "!", addition is suppressed for this
> table entry.
>
> As all tables of a document are processed by one perl-instance and perl
> variables can be created on the fly, values can be tranported from one
> table line to a later one or even to another table.
>
> Code size: 130 lines of perl
>
> Limitations: Multiline table enties are not supported.
>
> If there is interest, I'll post the script and an example.
>
> Kind regards,
>
>      ulrich lauther
>
>


reply via email to

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