|
|||||||||||||||||||||||||||
Kim Schulz wrote:
> <para TRANS><application TRANS>Desk Guide Applet</application> helps you
> navigate all of the virtual desktops available on your system. The
> <application TRANS>X Window</application> system, working in
> hand with a piece of software called a "window manager", allows
> you to create more than one virtual desktop to organize your
> work, with different applications running on each
> desktop. Each desktop can then also be subdivided by the window
> manager into rows and columns of working space, called
> "desk areas".<application TRANS>Desk
> Guide Applet</application> is a navigational tool to get around
> the various desktops and desk areas, providing a miniature road
> map in the GNOME panel showing all your virtual desktops (also
> known as workspaces) and desk areas, and allowing you to switch
> easily between them.</para>
> Kan dette gøres ?
Først ville jeg:
$/=undef;
indlæse hele filen i $content variablen
Jeg ville så starte med at spise para'er:
while ( $content =~ /<para\s([^>]*)>(.*?)</para>/gcis)
{
handlePara($1,$2)
}
For hver <para ..>..</para> kaldes nu en funktion handlePara
første argument vil i eksemplet være "TRANS" og det andet argument
alt alt mellem paratags. HandlePara kan så tage sig af alle de
tags der findes inde i en para blok.
Regex udtrykket vil så søge alle para tags igennem og parse den
en for en (gc). gøre dette på en case insensitiv måde (i) og
acceptere linieskft som en . karakter.
på http://www.fys.risoe.dk/public/zqex/html2smgl.html
Kan du finde et perl program jeg har lavet der er en primitiv fortolker
af html kode og oversætter det til sgml kode ved at bruge
substitutioner.
Måske kan du finde lidt inspiration til regex'er og fortolkning i koden.
--
No matter how fast light travels it finds *
the darkness has always got there first, * Carsten Svaneborg
and is waiting for it. * zqex at risoe.dk
-- (Terry Pratchett, Reaper Man) *
|
||||||||||||||
|
||||||||||||||