Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

brentdax (2147)

brentdax
  (email not shown publicly)
http://www.brentdax.com/
AOL IM: Brent Dax (Add Buddy, Send Message)

Just another Perl bigot...

Journal of brentdax (2147)

Wednesday August 31, 2005
10:54 AM

Kontent Day -2: Documenting

I've pretty much finished with coding and code documentation, and am now working on user documentation. The user system is complete, and Magic is complete enough to run Fidelius. I won't take much time, but I'll just mention that I expect to release tomorrow.

My plans after tomorrow are simple: I'm going to work on some lower-level libraries (like a library to assist with adding tracing and debugging code), and then continue to expand Kontent. There's still a great deal to be done, and I see great promise in what I have so far.

Monday August 22, 2005
04:20 PM

Kontent update on the road

I'm now in Rome. Work at Oxford (where I spent the first week of my trip, while taking a summer school) was unfortunately very slow, but I've finished the User page class, written the Session and Pool classes, and am almost finished integrating the concept of the current user into the Request class. This is all in the SVN repository, which came back up a few days ago (naturally, the server crashed almost the moment I left for the airport).

An interesting thing happened while I was working on this: SHA-1 was cracked. Okay, so that description is a tad extreme, but a group of Chinese researchers did bring it into the realm of theoretical feasibility, with an attack in 2**63 time. The thing that made this interesting was that I had just finished writing password-hashing code with SHA-1. I quickly re-engineered things to abstract the exact algorithm being used; each hash now includes a string specifying the algorithm used, and the functions gen_hash and cmp_hash in WWW::Kontent::Hash can be used to gracefully handle hashes.

Once this is done, I just have to write Magic and Fidelis, and then the system will basically be complete.

Thursday August 11, 2005
05:44 AM

Kontent Days 38-39: Preparation

I'm taking a trip to Europe with my family, and won't be back until about five days before my SoC project is due.

I won't be slacking off, though. I'm taking my laptop with me, and I'll be working every night, hopefully productively. Besides documentationand there's plenty to documentI have only the user system (which is going to boil down to a field in WWW::Kontent::Request, a login page, and a User page class), the Magic hook system, the Fidelis access-control system on top of Magic, and a couple minor classes left.

I spent yesterday writing code to resolve links. In Kontent, relative paths have more complex resolution rules than the Unix-ish "current directory" concept; this is mainly because Kontent tries to minimize how large a link must be. The basic algorithm is this:

  • Treat the link as a fragment of a path.
           
    • Try to see if that fragment can be completely resolved below the current page. (i.e. if the user requested /foo/bar which has a link to /baz/quux, see if there's a page called /foo/bar/baz/quux.) If so, this is the page.
    •                

    • If not, try the page's parent, recursively.
    •        

  •        

  • If the path-based resolution failed, treat the last part of the link as a page title, applying the same sort of recursion but looking up the last part by title instead of name.

This means that links to [[/code_catacombs/crosslink]], [[code_catacombs/crosslink]], [[/code_catacombs/Crosslink]], and [[code_catacombs/Crosslink]] would work, although the second and forth forms might mess up if a page called code_catacombs with a child named 'crosslink' or titled 'Crosslink' exists somewhere between the children of the current page and the root node.

Anyway, today was spent getting SVK set up, packing, and vaguely wondering why Perl 6 regexes weren't working in Pugs. Fortunately, putter figured it out pretty quickly once he learned there was a problem. (Fortunately, I was too busy to lose more than a few minutes.)

Though I'll try to keep this journal up to date, I don't really know what my connectivity will be like, and I'll need to focus on programming when I get the time; hence, it might not be updated as often as usual. Sorry about that...

Monday August 08, 2005
03:17 PM

Kontent Days 36-37: Settings

So, the settings system is in. That means a lot of Cool Things are now possible which previously weren't. Three screenshots:

First, the Kategory page containing all the settings. You can create a new setting by clicking the "Create" button up top. (And yes, I changed the template somewhat.)

Second, the site_name setting, which defines the text at the top of the page. Note that each setting includes a bit of documentation.

Third, the html_template setting, which contains the code used by the HTML renderer. A tricky little bit of code:

    my $template=WWW::Kontent::setting("html_template");
 
    #This treats $template as a double-quoted string with nulls as delimiters.
    return eval "qq\0$template\0";

Allows html_template to be treated exactly like a Perl 6 qq string.

Of course, it's also a nice big security hole, which means I can't release again until I have a user system to authenticate admins and an access control system to keep non-admins out. And the access control system requires that I write Magic, the hook system...

Saturday August 06, 2005
03:02 PM

Kontent Days 33-35: Parser

The last few days have been devoted to writing the parser for Kolophon, Kontent's native markup language. This was quite a challenge, as Pugs's regex support is both spotty and buggy; I ended up with two hundred lines of given/when-driven code. But it works, parsing out all features, although it doesn't implement one particularly nasty one. (It also expects renderers to do a few things they don't do yet, but that's neither here nor there...)

Oh yeah, screenshots: Editing the code and viewing the result.

Kolophon is a simple markup language influenced mainly by Kwid and MediaWiki markup. Every syntactic construct involves at least two characters (or a character and a beginning-of-line assertion), and escaping is achieved by breaking up a sequence with a null sequence, \\. (For example, **insert text here** is the code for bold; if you want two asterisks right next to each other to appear in the document, you just put a pair of backslashes between them, like *\\*.)

Kolophon supports bold (**), italic (//), title/citation (__), strikethrough (==), superscript (^^), and subscript (,,) text formatting styles. It also supports a special code style (``) and an unformatted style (""). It supports a large range of character entities for various hard-to-type punctuation marks and symbols, as well as backslash and explicit spacing and newline. It supports a range of paragraph styles, including bulleted, numbered and definition lists; tables; blocks of code or quotations; four heading levels; and plain paragraphs.

Finally, it supports three kinds of linking: hyperlink ([[]]), transclusion (direct inclusion of another page's content; {{}}), and relation (a two-way relationship, for categories, alternate languages, and plain old "see also" sections). Of the three, only hyperlinks are supported by the HTML renderer, although transclusion won't be difficult, as I already support the concept of a subrequest.

So, next up is Class::Setting, WWW::Kontent::setting(), and other such nonsense...

Thursday August 04, 2005
02:01 AM

Kontent Day 30-32: Release

I did indeed get page creation working. That meant, after a couple days devoted to release engineering, I could send this:

I am happy to announce the release of WWW::Kontent 0.01:
 
    File: $CPAN/authors/id/B/BR/BRENTDAX/WWW-Kontent-0.01.tar.gz
    Size: 27402 bytes
    MD5 : 1295736bac6b0ef3339998ea47b9ad61
 
    <http://search.cpan.org/~brentdax/WWW-Kontent-0.01/>
 
Please note that it may take some time for the distribution to reach
your local CPAN mirror.
 
Kontent is a flexible web content management system written in Perl 6
and executable with Pugs.  I am writing it with the help of The Perl
Foundation and Google's Summer of Code program.  This release is an
incomplete preview, demonstrating my progress and giving a hint of
what's to come.  It is not feature-complete, and what's written isn't
yet suitable for use in production, but it's certainly good enough to
download, untar and play with on localhost.
 
In its initial configuration, Kontent looks quite similar to a wiki,
with the ability to create and edit pages through a web interface and
view a revision history.  Examination of the code, however, will
reveal a fairly sophisticated architecture capable of giving each page
unique behavior and rendering the same content in multiple formats.  A
command-line tool is provided which can manipulate pages at a low
enough level to change a page's class.
 
Although the distribution is on the CPAN, it cannot be automatically
installed by CPAN.pm or CPANPLUS, largely because I haven't decided
what should be installed where.  I recommend you simply download the
tarball and extract it in your home directory.  The INSTALL file
included in the distribution will explain how to get it running.  Note
that you will need both a copy of Pugs (the just-released 6.2.9 will
do nicely) configured with Perl 5 interop, and a copy of Parrot to
execute Perl 6 regular expressions.  You will also need a SQL database
engine and the Perl 5 DBI drivers to access it.
 
I am rather excited about this project, and I hope you will be too.
 
Share and enjoy,
--
Brent 'Dax' Royal-Gordon <brent@brentdax.com>
Perl and Parrot hacker

Now that the release is out of the way, I'm starting in on the Kolophon markup language's parser. Until Perl 6 grammars are available, I'm probably going to follow the great tradition of web apps everywhere, and hack together a parser with regular expressions, loops, chewing gum and twine. (I started to type use perl5:Parse::RecDescent when I went "wait a minute, all my actions will have to be in Perl 5...and the interface of WWW::Kontent::Skeleton depends on Perl 6 calling semantics...Mommy!!!!)

Thus far, it's been fairly easy. On the other hand, thus far I've only written the easy part...

Monday August 01, 2005
03:33 AM

Kontent Day 29: Refactoring

r17 | brent | 2005-08-01 01:22:00 -0700 (Mon, 01 Aug 2005) | 11 lines
 
Two large refactorings:
  * Extracted path-handling code from Request into separate Path/Component objects.
   Paths can now be used to resolve pages without allocating a renderer and so on.
  * Changed Page, Revision, and Draft into:
                Page                    Revision
                /  \                      /  \
        SavedPage  DraftPage  SavedRevision  DraftRevision
  * DraftRevisions now have classes.
 
This is all preperatory to page creation code.

I also wrote a preliminary version of make_root, which is used to create the tables and initial data structures in a Kontent store.

In other news, I've heard on #perl6 that a new Pugs release will land in about 34 hours. I think I'll release Kontent 0.01 (the alpha preview) not long after, and recommend that people use that release of Pugs; that way I won't have to say "run svn co and hope you get a good version". That gives me a day to get page creation running. Should be doable

Saturday July 30, 2005
04:58 PM

Kontent Days 26-28: Polish

I've been polishing the editing interface. New screenshot:

Fast but finicky or slower but more reliable

Of course, this is only for the Kiki page class. Other page classes will need to specify their own interfaces (using a combination of 'textfield', 'boolfield', 'metafield', and 'choicefield' skeleton nodes), but the only other page class I have right now (Kategory) doesn't have much useful to edit.

Still working...

Thursday July 28, 2005
02:54 AM

Days 23-24: Editing

Editing now works. I also wrote an INSTALL file.

Now all that's left is page creation and writing the make_root function mentioned in INSTALL.

Rough few days, for reasons unrelated to this project. Gonna crash now.

Monday July 25, 2005
02:54 AM

Kontent Day 22: Preparation

I spent most of today documenting, but also got in a big refactoring and redesign in the wee hours of the morning. Basically, Kontent now has a YAML configuration file listing modules and store parameters.

Where's the rest of the configuration? Some day, it'll be in the store itselfthere's already a parent page in my local Kontent store, /kontent/settings, for them. For now I'm just hard-coding things, but I suspect stuff like url_prefix, html_stylesheet, and even html_template will eventually all be under this page.