A New Approach 
My interest in KnitML has come and gone over the years. (Has it really been years? Yikes!) Usually I give some attention to the project a couple times a year. This time was sparked by a talk I recently attended about Groovy's support for domain-specific languages (DSLs). It got me thinking about the appropriateness of Groovy as a platform for the Knitting Expression Language.

Most DSLs written to be understood by a computer don't exist before they're implemented for the computer; they usually evolve organically as the language's requirements are iterated over. I've known for awhile that knitting patterns are perhaps a somewhat unusual case for DSLs because the language already exists and is reasonably standard. Most pattern designers, for instance, can write:

Row 1: k to end

and almost every English-speaking knitter who reads patterns will know exactly what to do. So subjecting an existing DSL to a general programming language which has an entirely different set of syntactic conventions was, in retrospect, not a great idea. Just to get that row syntax I mentioned above to work in Groovy, I had to do back flips both within the language and as a pre-processing step. Plus I essentially lost the ability to implement editor help when I did that.

XText, however, is a far more flexible platform for creating new DSLs... because it was written solely for that purpose. I had looked into XText a couple of years back, but the project was in its infancy and I found it hard to wrap my head around. A couple of years really can give a guy some perspective, so I took another look, played around with it a bit, and now I'm convinced it's the way to go. Not only will you get a knitting language that looks much, much more like a real pattern, but you will also get direct help from the editor as you type and suggestions for completion.

I'll keep the Groovy-based DSL around for awhile, but I'm not going to enhance it further.

Interestingly, the knitting engine, validator, and pattern renderer don't need to change at all to support this new DSL. That's because I completely decoupled the DSL from the domain model used by those components. That's the architect in me coming out, I suppose. It really paid off, because my focus is going to be a lot less on the specification itself and a lot more on getting the editor to be usable and nice.

So stayed tuned! There are big changes afoot!

[ 1 comment ] ( 25 views )   |  [ 0 trackbacks ]   |  permalink
KnitML Editor 0.2.1 released 
Changes include supporting the latest development builds of KnitML Core Tools 0.6.0 and some upgrades to third-party libraries.

You can find the files for your platform here at SourceForge.

[ add comment ] ( 13 views )   |  [ 0 trackbacks ]   |  permalink
Hey! What's news? 
I haven't posted since April, so you may be wondering what happened to me (and consequently the project). Well, after the last release, I decided to take a much-needed break and wait for some new people to take interest. That came in the form of i0lanthe last month.

I know that there are a lot of people out there that want to help out but don't really know how to get started. Well, the Ravelry KnitML Forum has been abuzz in recent weeks, and the first-cut of a first draft of a KEL tutorial has emerged. I believe that this tutorial is a sorely needed stepping stone to boost involvement of the knitting community. Try it out and give us your feedback.

In other news, now that both project source code repositories are being hosted at Google Code, I may try to move the bug tracker over there. It also appears that there is a Mylyn Connector for it (which, if it works, is the only thing that would be stopping me from migrating from Bugzilla.) I'll let you know.

[ add comment ] ( 32 views )   |  [ 0 trackbacks ]   |  permalink
Using KnitML, Part Two: Customizing the Result 
Previously in this series, I showed you how I converted Jenna Wilson's Banff sweater to a KnitML pattern. In this post, I'm going to show you how you can customize the pattern to your preferences.

For those of you reading this post who are not involved with the KnitML Project, I'm asking that you keep an open mind and not judge or dismiss this software based on its current limitations. Please remember that this is beta software, supported and nurtured by the knitting community. Your suggestions for improvement are most welcome (and, in fact, sought after). The software needs to be made better, and only you can make this possible. You can leave a comment on the blog, you can contact me privately (by clicking on the Contact Me link on the sidebar). or you can post a thread on the Ravelry KnitML group. Thanks!

When I open up the KEL editor, notice that there are three different views of the KnitML pattern: Code, XML, and Pattern.

The Code View is where I get to work with and edit the pattern. The XML view shows the pattern in true KnitML format, derived directly from the Code View. If I were to publish this KnitML pattern online, this is the file I would share. The Pattern View shows how the pattern looks using my personal preferences.

The pattern editor ships with a set of sensible defaults for the pattern view. Here is what Banff looks like out-of-the-box:

While this is certainly fine, it's not entirely to my liking. I can open up the Preferences page and make a few changes.

I'm not a huge fan of Arial. Garamond would look much nicer.

To get the pattern to re-render, I must navigate away from the Pattern View (either to the Code or XML View) and then back to the Pattern View. (There will be an easier way to do this in a future release.)

Notice the gauge is expressed as a 4-inch swatch in stockinette stitch.

You may recall that I expressed the gauge like this:
Gauge 'stockinette' {
StitchGauge: 3.5 stitchesPerInch
RowGauge: 5.25 rowsPerInch
The Pattern View does the conversion to a square for me. If you don't care for gauges written this way, you can uncheck the "Describe gauge as a square" option in the Preferences page.

We intend to support non-stockinette-based gauges in the future.

If you are familiar with the original pattern from Knitty, you probably know that it did not come with charts. You also may remember that I did not type in anything that looked like a chart when I created the pattern in the Code View.

I can tell the renderer to construct charts from the KnitML pattern. To do this, go to the Preferences page, expand the Rendering option on the left, click on Charts and then check the box labelled "Enable chart creation for instructions." The renderer will make a chart whenever it can.

Here is a part of the pattern that shows charts well:

(The legend has some cleanup work slated for the next release.)

By default, the renderer uses simple text art for its symbols (based on the Unicode character set). Since I have the Aire River Knitting Font installed on my machine, I could use those symbols instead.

If I wanted to manipulate the chart further, I could copy and paste it directly into a spreadsheet.

Note that if you don't use Windows and Excel, it may take a little more work to get it into this form. While the copy/paste with Firefox and OpenOffice does work, the font settings are not preserved. In order to get the Aire River font to look correct, you would have to re-apply that font to the cells of the chart.

Notice that the charts are all right justified with respect to their "no stitch" elements. In a future release, the renderer will be able to infer whether to center, left, or right justify depending on conditions. This will help keep the chart looking more like the finished object. For more complex charts, however, auto-justification may not always be possible. A designer may choose to specify the placement of every "no stitch" element themselves to guarantee their own chart layout.

So how do you write patterns in KnitML which were originally designed as a chart? Right now, the process to convert a chart to KnitML is manual (by writing out the appropriate KEL syntax). This is undeniably awkward. In the future, existing software (such as but not limited to Knit Visualizer) could make this a whole lot easier by creating the KnitML chart instead of you having to do it.

I can also customize the instructions themselves. Here are the defaults for several common decreases:

Suppose I knit in combined style (or left-handed) and prefer all decreases to indicate their lean. I can edit my preferences to display RLD or LLD (right-leaning decrease, left-leaning decrease):

That will end up looking like this:

Suppose French is my native language. I can have the pattern rendered in French using international units:

It will render all of the non-custom instructions in French automatically.

A pattern designer can provide translation files for their customized sections. The Nutkin2 sample demonstrates how to fully internationalize a pattern. Future releases may be able to provide an "auto translate" feature if no translation is found for the given language.

I've touched on the major points of the Pattern Editor. If you have any questions, ideas, or thoughts, please feel free to comment here on the blog, contact me privately, or ask a question on the KnitML Ravelry group or the public Answers forum.

[ add comment ] ( 14 views )   |  [ 0 trackbacks ]   |  permalink  |  related link
Pattern Editor 0.2.0 and Core Tools 0.5.0 released 
I am very pleased to announce the arrival of both the KnitML Pattern Editor 0.2.0 and KnitML Core Tools 0.5.0. This is the first truly usable version of the Pattern Editor.

Features of this release include:
  • A great new look (thanks, Susan!)
  • A great new name (thanks, Ravelry!)
  • A new sample: the Banff sweater (thanks, Jenna!)
  • A new help system
  • Customizable rendering preferences
  • Charting support
  • Stitch holder support
  • Knitting Expression Language improvements
  • French rendering (thanks, Kajin!)
Get yourself a copy here, and feel free to bring any of the samples into the editor to try out the tool.

Thanks to everyone who made contributions!

[ 2 comments ] ( 33 views )   |  [ 0 trackbacks ]   |  permalink

<<First <Back | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Next> Last>>