BenBE's humble thoughts Thoughts the world doesn't need yet …

10.09.2009

Templating in 1000 Lines of Code

Filed under: Software — Schlagwörter: , , , , , , — BenBE @ 18:11:04

Ich weiß, es gibt bereits viele Templater, aber die meisten scheitern entweder an einfachsten Aufgaben, oder sind zu überdimensioniert oder anderweitig zu Speziell für bestimmte Anforderungen. Daher mein Einwurf für die Diskussion um einen Templater: das Projekt 1kLOC Templater ist ein Versuch, einen flexiblen, performanten, aber gleichzeitig kleinen Templater zu schreiben. (more…)

Flattr this!

09.07.2009

Der evil-Modifier

Filed under: Server — Schlagwörter: , , , , — BenBE @ 21:11:46

Eine der bemerkenswerten Bibliotheken, die PHP zur Nutzung anbietet – sofern sie mal nicht wie so oft überfordert ist – ist die PCRE-Bibliothek (Perl Compatible Regular Expressions), mit der sich auf einfache Weise (naja, wenn man die Syntax einmal verstanden hat) umfangreichste Dinge vollführen lassen. Eine häufige Anwendung, die man hierbei regelmäßig als Betrachter fremder Bibliotheken zu Gesicht bekommt, ist hierbei Quelltext, der elegant Parsing von Eingabedaten vornimmt, Sicherheitsprüfungen ausführt oder auf andere Art einen Eingabestring verarbeitet. Mit ein wenig Magic drumherum lässt sich so ein ziemlich schneller Syntax-Highlighter schreiben, der mit einem Schlag ganze Gruppen von Schlüsselworten highlighted und dabei abhängig von den gefundenen Schlüsselworten z.B. Links auf deren Dokumentation fertigt.

Doch wie so häufig bei PHP gibt es eine Reihe von Fallstricken. Einer dieser liegt bei eben dieser genannten Bibliothek. Diese bietet für umfangreiche, nicht statisch ausführbare Ersetzungen mit preg_replace einen speziellen Modus: Den /e-Modifier, der auf Grund seiner Arbeitsweise auch gern Evil-Modifier genannt werden darf. Aber dazu sollten wir erst einmal klären, was diese Funktion tut. (more…)

Flattr this!

15.06.2009

GeSHi and non-latin charsets

Filed under: GeSHi — Schlagwörter: , , , — BenBE @ 22:34:14

I recently got some people asking me on how to work with GeSHi if using non-latin charsets like cp1251 or CJK encodings. GeSHi 1.0.X itself doesn’t care much about charsets and thus there’s no beautiful way to work with them. But limited support for UTF-8 is built-in and thus can be used. (more…)

Flattr this!

23.05.2009

GeSHi 1.1.X on ANSI terminals

Filed under: GeSHi — Schlagwörter: , , , , — BenBE @ 14:34:03

Quite unexpectedly a hint to continue work on GeSHi 1.1.X arrived a few days ago when Christian Weiske came into #GeSHi on Freenode. After a short introduction he posted a screenshot of Source output using a new renderer class he wrote for highlighting source in man pages. His renderer uses a lot of PEAR functionality to do the color coding, but integrates nicely with the current developement branch anyways.

Given this new developement I won’t stall developement neither and fulfill my promise to put some work into this too. Issues that need urgent attension in the developement branch are the context handling, styling and style information handling – which will be goals for the next two dev releases. To get the spare time to do this the next stable release of the 1.0.X series will probably a bit later, independend of the 2 months release cycle I usually try to achieve.

Flattr this!

03.05.2009

Language files without PHP knowledge

Filed under: GeSHi — Schlagwörter: , , , — BenBE @ 13:21:35

There have been repeatedly about if it was possible to create a kinda like language file editor for GeSHi language files and given there are quite some requests – and a bunch of users without the basic PHP knowledge I decided on giving it a try. (more…)

Flattr this!

Again some parser tweaking

Filed under: GeSHi — Schlagwörter: , , , , , , — BenBE @ 13:03:02

After 1.0.8.4rc1 contained a somehow major update on the parser (I reordered the processing of keywords, numbers and regexps) the next Release Candidate (1.0.8.4rc2) will contain yet another minor reordering as I noticed a small problem with Delphi. As always I’m hereby asking you to test this new release candidate once it is out and report any issues you find to me. If you don’t want to wait that long, you can always have a look at the trunk where these changes already have been applied. (more…)

Flattr this!

11.04.2009

GeSHi now without language file warnings

Filed under: GeSHi — Schlagwörter: , , — BenBE @ 13:30:14

It has been a lot of work and due to limited delight in code monkey work the final work had been delayed for several months; but now it finally has been completed: The language file validation script doesn’t show any warnings when validating the language file directory! (more…)

Flattr this!

26.03.2009

Roadmap for GeSHi 1.0.8.4

Filed under: GeSHi — Schlagwörter: , , , — BenBE @ 23:44:34

This March has been a busy month and I nearly missed to celebrate one year of working on GeSHi as head of developement. It has been an awesome time, although a bit complicated sometimes, hasty in other moments, but overall it was a pleasure to work on such a great project while learning many new things. (more…)

Flattr this!

09.01.2009

Highlighting Perl in all its oddity

Filed under: GeSHi — Schlagwörter: , — BenBE @ 00:02:34

Following up on a discussion on the GeSHi-devel mailing list I got some interesting testcases for testing Perl in all its oddity.

So lets get things startet: Open up the testcase, and see: The CSS is not fully precise on some stuff (some classes in GeSHi can be used for different things like .co5 for perl is used for predefined variables). So I did a quick editing of the CSS stylesheet with the Web Developer Toolbar to mark everything that was of specific classes (as expected) in a different color than white to see if it actually is highlighted (which most stuff was).

Adding the missing stuff into the language file I got an updated version for Perl that can be found as revision 1975 in the GeSHi SVN repository for testing. Things I didn’t include there are file descriptors as they should already be highlighted (even if <> and <test> are marked as different things.

But in one thing the testcase wasn’t right: Heredocs As well as Regular expressions are supported by GeSHi, see:

$test = <<HEREIAM;
Some text to show this is a heredoc part
HEREIAM;
$match =~ /te[sx]t/g;
$replace =~ s/x/s/i;

Just to be complete on this. Oh, and the

< <

bug is a problem with my WordPress. The demo page does the Heredoc correctly, for those that don’t believe me 😉

Now I’m only lacking this little testcase as a file for inclusion into the Code Repository of GeSHi and I can declare this „done“ …

Update: Revision 1977 contains some important updates on the rev1975\r1974 version of this file: I missed some things due to some issue I had with encoding $ inside of regexps (I missed the escapes PHP needed inside the string). I also added the few remaining cases that the previous version didn’t yet.

What will not be highlighted correctly are bacreferences to numbers (and I thought C was odd …) and nested Heredocs (i.e. Heredocs with two or more starters on one line).

But given the current state this should somewhat resemble most of what even most insane Perl programmers need when puking their code …

Flattr this!

24.12.2008

No Winners in the GCC

Filed under: GeSHi — Schlagwörter: , , — BenBE @ 17:28:42

A few months ago I announced the GeSHi Contributions Contest where I asked everyone to send in their contributions for other little, useful scripts that everybody could use and that utilize GeSHi in some innovative way.

Thereafter was little to nothing in response even though Milian and me, as well as some others, advertised this contest with our limited resources and time as well as we could. In particular I heard about one case where some professor considered this contest could be nice, but didn’t enter because of lack of time (the timeline was to short for his students).

Therefore I’d be grateful to get some response to this contest and things that could be done better, more and so one.

I’m really looking forward to your feedback.

BenBE.

Flattr this!

« Newer Posts

Powered by WordPress