Recent Changes - Search:

Home Pages Pidgin   Azarennya (S|N) Mac Textanium Reference ToDo Food Local Edit

Local: Hide

Language: Hide

Fantasy: Hide

SciFi: Hide

Film: Hide

Music: Hide

REALbasic: Hide

ResourcesGarageUniversityWebRingForums:REALElfDataPlugins and Code:BKeeneyDeclareSubEinhugurJoeRestrepoTempelmannZAZ

Coding: Hide

Forums:PowWebPHPWebmasterCodingWalkersPerlIntroMonksPHPJavaScriptToolboxUnobtrusiveJavaScriptJavaScriptCompressorRegularExpressions (test)JSLintSQLCocoaCocoaBuilderCocoaDevCocoaLabAppleScriptBBSUserlandFaqintoshFileMakerFileMakerTipsFileMakerWorldFileMakerPlugins

Science: Hide

History: Hide

1421

News/Politics: Hide

Cults/Crime: Hide

ClambakeInfidels

Miscellaneous: Hide

NoteSolution

As of April 2008, I am back to trying my hand at writing a markup-to-HTML converter -- minimalist like Markdown but with a different syntax.

! Heading
This is the first paragraph.
This continues the first paragraph.

This is the second paragraph
because it follows a blank line.

Heading, level 2
================

> This is a blockquote
but this terminates the blockquote
because it is not indented.

> This is another blockquote
    and this continues the blockquote.

    - This is a list item inside the blockquote.

- This is a list item FOLLOWING the blockquote.
    | This is a cell in a table within the list item.
    | This is another cell, in the same row.
    || This is another cell, but on a new row.
+ This is a numbered list item.
    > This is a blockquote inside the list item.
    This is a paragraph inside the list item.
    As you can see, indentation is very important.

@ ___CODE_SECTION___
This is a code section. Indentation is preserved as is here,
because you cannot nest ANYTHING inside a code section.

You begin a code section with an at-sign followed by any
arbitrary text on the same line. This is the "code caption."

The code caption on a line by itself ends the code section:
___CODE_SECTION___

This is a paragraph following the code section.

OK, so what does the code need to do with each line?

  • Lines belonging to a "paragraph" need to be gathered before being output. Character formatting is resolved for each whole "paragraph."
  • Whenever a container mark is found, the container type needs to be put onto a stack, and a flag firstParaDone set to FALSE. You do the first paragraph and set it aside. If the following line does not close the new container, output the first paragraph enclosed in <p> tags; otherwise output the first paragraph without the <p> tags.
Edit - History - Print - Recent Changes - Search
Page last modified on April 04, 2008, at 09:08 PM