table of contents for lua50, final

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

table of contents for lua50, final

Joe Myers-4
Hello List,

I missed a table of contents for the new (nice!) lua50 final distro, so I
wrote a perlscript to create one (appended below). So I'm sending this on
in case anyone else would find it useful.

Simply run this in the same directory as manual.html, it will create
files manual2.html and manual2-toc.html (table of contents).

If you've trouble running it (like, if you don't have perl installed), let
me know, I can either put this on the wiki / my website / or email you the
resulting files (too large to send on a list).

Joe

//////////////////// cut here ////////////////////

#!/usr/bin/env perl
# lua50toc.pl -- Joe Myers, [hidden email]  04/15/03

# hunts for header strings of form
#     n1.n2.n3 - xxxx
# for example:
#    <h1>1 - Introduction</h1>
#    <h2>2.1 - Lexical Conventions</h2>
#    <h3>2.2.1 - Coercion</h3>
# in the stock manual.html file, adding new anchor 'ref:---' before each
# in the revised manual ($Outfi = manual2.html)
# and building the table of contents ($Tocfi = index.html) at the
# same time.

# globals
$Infi = "manual.html";       # input file
$Outfi = "manual2.html";     # revised manual w/ 'ref:---' tags
$Tocfi = "manual2-toc.html"; # new table of contents

sub process {
    my($wholematch, $mrk, $tag) = @_;
    my $name = "ref:$tag";
    print TOCFI qq(<a href="$Outfi#$name">$mrk</a><br>\n);
    return qq(<a name="$name">$wholematch);
}

open(OUTFI, ">$Outfi");
open(TOCFI, ">$Tocfi");
print TOCFI <<START;
<html>
<head>
<title>lua50 contents (04/2003)</title>
</head>
<body>
<H1><center>lua50 contents (04/2003)</center></H1>
START

undef $/; # slurp!
open(IN, $Infi);
$_ = <IN>;
close(IN);

s#( <(h[1-3])> ((\d+(?:\.\d+)*) \s-\s .+?) </\2> )#
        process($1,$3,$4) #isxge;
print OUTFI $_;
close(OUTFI);
print TOCFI "</body></html>\n";
close(TOCFI);
system("wc -l $Tocfi $Outfi");

Reply | Threaded
Open this post in threaded view
|

Re: table of contents for lua50, final

Gordon A. Acocella
No problem if you don't have perl (I couldn't resist):

#!/usr/bin/env lua

-- lua50doc.lua, directly translated from:
-- lua50toc.pl -- Joe Myers, [hidden email]  04/15/03

-- globals
Infi = 'manual.html'		-- input file
Outfi = 'manual2.html'		-- revised manual w/ 'ref:---' tags
Tocfi = 'manual2-toc.html'	-- new table of contents

-- Second arg is unused (gsub passes all captures).
function process(wholematch, _, mrk, tag)
    local name = 'ref:' .. tag
    TOCFI:write('<a href="', Outfi, '#', name, '">', mrk, '</a><br>\n')
    return '<a name="' .. name .. '">' .. wholematch
end

OUTFI = io.open(Outfi, 'w')
TOCFI = io.open(Tocfi, 'w')
TOCFI:write[[
<html>
<head>
<title>lua50 contents (04/2003)</title>
</head>
<body>
<H1><center>lua50 contents (04/2003)</center></H1>
]]

IN = io.open(Infi, 'r')
_ = IN:read('*a')	-- slurp!
IN:close()

-- Perl's regular expressions are more powerful than lua's.
-- I had to simplify this a little (it's not exactly the same):
_ = string.gsub(_, '(<([hH][1-3])>((%d[%d%.]*)%s-%s.-)</%2>)', process)
OUTFI:write(_)
OUTFI:close()
TOCFI:write('</body></html>\n')
TOCFI:close()

-- This could be skipped for systems without wc.
os.execute('wc -l ' .. Tocfi .. ' ' .. Outfi)


Joe Myers wrote:
> 
> Hello List,
> 
> I missed a table of contents for the new (nice!) lua50 final distro, so I
> wrote a perlscript to create one (appended below). So I'm sending this on
> in case anyone else would find it useful.
> 
> Simply run this in the same directory as manual.html, it will create
> files manual2.html and manual2-toc.html (table of contents).
> 
> If you've trouble running it (like, if you don't have perl installed), let
> me know, I can either put this on the wiki / my website / or email you the
> resulting files (too large to send on a list).
> 
> Joe

Reply | Threaded
Open this post in threaded view
|

Re: table of contents for lua50, final

Luiz Henrique de Figueiredo
In reply to this post by Joe Myers-4
Thanks to Joe Myers and Gordon Acocella, there's now a table of contents
for the 5.0 manual. Enjoy.

There's still no word index, in case you have some free time on your hands...
--lhf

Reply | Threaded
Open this post in threaded view
|

Another small and embedable language : Io

Vincent Penne
This language (from the FAQ) was partially inspired by lua but seems however fundamentaly different. (Io is indeed a moon of Jupiter :) )

Another interesting aspect is that they implemented an *incremental* garbage collector.

I didn't test it, but will probably soon try it. In particular, I wonder how it compares to lua in term of speed ...

URL :
http://www.iolanguage.com/

Vincent Penne



Reply | Threaded
Open this post in threaded view
|

Re: Another small and embedable language : Io

Luiz Henrique de Figueiredo
>Another interesting aspect is that they implemented an *incremental* 
>garbage collector.

This is the top item for Lua 5.1.
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: Another small and embedable language : Io

Steve Dekorte-4
In reply to this post by Vincent Penne

On Wednesday, April 16, 2003, at 05:53 AM, Vincent Penne wrote:
This language (from the FAQ) was partially inspired by lua but seems however fundamentaly different. (Io is indeed a moon of Jupiter :) )

Hi Vincent,

I'm the author of Io and yes, I'm a Lua fan. :-) Io's orientation towards being small, embeddable and multi-state was heavily influenced by Lua. The major difference is that Io is a pure OO language.

... I wonder how it compares to lua in term of speed ...

Here's some tests from a while ago:
http://www.iolanguage.com/comparisons/performance.html

Looks like Lua has the speed edge, but Io is competitive. Both appear to compare pretty well to Python, Perl and Ruby.

Cheers,
Steve
Io, a small language: http://www.iolanguage.com/


Reply | Threaded
Open this post in threaded view
|

Re: Another small and embedable language : Io

Vincent Penne
Thank you for the informations Steve, and congratulation for this great work :)

Steve Dekorte wrote:


On Wednesday, April 16, 2003, at 05:53 AM, Vincent Penne wrote:

This language (from the FAQ) was partially inspired by lua but seems however fundamentaly different. (Io is indeed a moon of Jupiter :) )


Hi Vincent,

I'm the author of Io and yes, I'm a Lua fan. :-) Io's orientation towards being small, embeddable and multi-state was heavily influenced by Lua. The major difference is that Io is a pure OO language.

... I wonder how it compares to lua in term of speed ...


Here's some tests from a while ago:
http://www.iolanguage.com/comparisons/performance.html

Looks like Lua has the speed edge, but Io is competitive. Both appear to compare pretty well to Python, Perl and Ruby.

Cheers,
Steve
Io, a small language: http://www.iolanguage.com/






Reply | Threaded
Open this post in threaded view
|

Re: Another small and embedable language : Io

Gustavo Niemeyer
In reply to this post by Steve Dekorte-4
Hello Steve!

> Looks like Lua has the speed edge, but Io is competitive. Both appear 
> to compare pretty well to Python, Perl and Ruby.

As a Python *and* Lua developer/fan, I wouldn't compare these languages
in the competitive sense. Python, Perl and Ruby are indeed competing
languages, but Lua has a different market share. I hope Lua never
become a "general purpose" language, like the others, or it'd most
probably lose the current market share. Notice that I'm not against
people developing extensions for the language to improve usefulness in
different markets, but I defintely wouldn't like to see Lua carrying a
big standard library, or a complex core with bells and whistles, for
example.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]