micmath/micmath.github.com — pull request #8 by matthewkastor (2012-10-15 01:19:29+00:00)
Title: My power was out all day...

The many html files are a result of changing the examples template. It
now puts the code in a single pre element instead of nesting an inline
code element inside the pre. I was having issues where all the line
breaks were being ignored because of the code tag.

I modified the Jake file, documenting several functions I've put in to
make processing everything much better. The automatic tag dictionary
function has a decent explanation of what it's doing. I modified the
formatExample function to make it more robust. It now normalizes all end
of line marks before the example is processed, it normalizes white space
at the beginnings of every line - converting tabs to spaces, it shifts
the entire code block to the left based on how much white space is
present to the left of the first line of code. This makes it so our
article files can be readable and we don't have to screw around trying
to format the example so it doesn't get mangled (or set 3 screens to the
right) on the way out.

getOffset is used to get the distance between the page margin and the
first non whitespace character.

offsetWhiteSpace is used to strip excess white space from the beginning
of code lines, but leave some behind. Think (shift+tab on a block of
code).

normalizeWhiteSpacePrefix converts all tabs to four spaces but, it only
does so on the white space preceeding any non white space character. A
line may contain a tab in the actual code that we wouldn't want to
convert.

convertEOL is used to normalize line endings. It will detect the three
common EOL ,arkers and convert it into whatever you want. We could use
this to inject break tags if we wanted to. I'm using it to ensure that
all line endings are of the \n form before examples are processed. We
should use this on any input to the markdown plugin, unless the code has
been updated so it doesn't choke on "unexpected" EOL markers.

I modified the CSS file in head.mustache because the examples were
extremely hard to read. Changing the font size with my browser would
make the plain text enormous. I changed the font size to 1em on both the
body and the code. I added a light gray background-color to all code to
make it stand out a bit. I made headings 1-6 all the same color (the
original color of h1). I added indenting to the headings to make it
conceptually sensible. I added text indenting to paragraphs so the first
line would be indented like they taught me to do in school and, it's way
pretty and stuff. I added indenting to sorted and unsorted lists because
the table of contents that some pages needed looked like garbage and,
because lists in some of the descriptions were sitting so far to the
left that it broke the flow of the document... err, I made it more
conceptually sensible and junk.

There are probably some things I mangled in the articles. I was using
html tidy and a pocket full of regexii to try cleaning things up. As I
come across mangled bits I'll fix them. My focus at the moment was in
getting the automated bits to be more automated and less mangly. I
really think I'll add some automation to the list of "getting started"
articles so we don't have to manage copy pasting links into it. That
will probably be tomorrow or the day after. :D