Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Beautify code in UT
Message
De
19/10/2014 14:54:32
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
19/10/2014 14:43:02
Information générale
Forum:
Level Extreme
Catégorie:
Autre
Divers
Thread ID:
01609628
Message ID:
01609640
Vues:
38
>>>>>Hay Michel,
>>>>>
>>>>>How do you beautify the FoxPro code in the message body here on the UT?
>>>>>
>>>>>I have a new section on my web site that would be better if I could color code the examples.
>>>>
>>>>do you mean <pre> tags?
>>>
>>>Well, in a way. But just placing the code in a PRE block does not beautify the code with colors.
>>>
>>>My web page is reading the PRG file from the disk, and displaying it in a PRE block on the page as is.
>>>Therefore, currently no formatting is occurring.
>>
>>
>>so you will not use that within UT but on your website.
>>
>>That needs more work
>>
>>You need tho parse out the prg and put anything with colors. Common is to wrap it stuff in <span> tags with classes and CSS it.
>>
>>But you need to parse.
>>
>>A possible start is to look at Martinas Jindrovas PDM project. It parses out VFP code. see http://gorila.netlab.cz/pdm.html
>>
>>Possibly you might run your code against PDM and manipulate the result (or just cut the important parts out of the result) and include all the stuff to your WEB project. It's not to tricky
>
>Thanks for the suggestions. I will look into the PDM solution. If GoDaddy (hosts my site) will let me, I possibly could use it to convert the PRG code to a HTML format on the fly.

Thats a way. but would require active code on the server.

PDM runs a Fox app, that parses your files and create an HTML documentation. If you pick out the right parts and past them into your page, you are done.

I do not know what Michel is doing for parsing, but a server side idea would be (with tools available on the server, no fox involved)

CSS and regexp

#1 create a css with the colors for the items below
#2 parse the vfp intput via some regexp that wrap the codewords into <span> tags with classes that are controled by your css
#3 do the same with literals (strings, numbers,datetime, curency e.t.c.)
#4 same to comments. one can do this in a way the stuff above is ignored inside a comment (css inhert)
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform