nyctergatis.com

Contact

Projects
Sysquake Remote Live
NME
PDF
Hike
Sudoku
GifBuilder
jpeglib for Palm OS
MySQL Client
Cross-GCC for Mac OS

NMEMain.c File Reference


Detailed Description

Test program for Nyctergatis Markup Engine.

Author:
Yves Piguet. Copyright 2007-2008, Yves Piguet.

Usage

This program filters standard input and writes the result to sandard output. It can be called as follows to convert file readme.nme to HTML file readme.html:
    ./nme <readme.nme >readme.html
Here is the list of options it supports:
  • --1eol single eol as paragraph breaks
  • --2eol double eol as paragraph breaks (default)
  • --autocclink automatic conversion of camelCase words to links
  • --autourl automatic conversion of URLs to links
  • --body naked body without header and footer
  • --checkhooks check hooks
  • --easylink format links are converted as follows: letters, digits, hyphens, commas, dots, apostrophes, parentheses, colons and underscores are preserved, spaces are converted to underscores, non-ascii characters are URL-encoded, other characters are ignored, and the output link is obtained by replacing the dollar character in format with the processed link (e.g. format could be '/wiki/$.html'). URL are used verbatim.
  • --editfrag index length beg end edit a fragment of the source code; in output, replace what corresponds to input fragment starting at index of length length with this unmodified input fragment surrounded by beg and end
  • --headernum1 numbering of level-1 headers
  • --headernum2 numbering of level-2 headers
  • --fontsize s font size (0=default)
  • --help this help message
  • --html HTML output (default)
  • --jspwiki JSPWiki output
  • --latex LaTeX output
  • --man man page output
  • --mediawiki Mediawiki output
  • --nme NME output
  • --null no output (still process input)
  • --strictcreole dble tt, u, sub/sup, DL, ind par and esc and eble tt nowiki

--structdiv display division structure

  • --structpar display paragraph structure
    • --rtf RTF output
    • --text plain text output
    • --textc compact plain text output
    • --xref headings have hyperlink target labels

Definition in file NMEMain.c.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "NME.h"
#include "NMEAutolink.h"
#include "NMEPluginRot13.h"
#include "NMEPluginReverse.h"
#include "NMEPluginUppercase.h"
#include "NMEPluginCalendar.h"
#include "NMEPluginRaw.h"
#include "NMEPluginTOC.h"

Go to the source code of this file.


Defines

#define SIZE   (128 * 1024)
 Fixed size allocated for source :-(.
#define kHookCheckMaxDepth   256
 Maximum depth of nested constructs in HookCheckData.
#define isAlphaNum(c)
#define toHexa(d)   ((d) >= 10 ? (d) + ('a' - 10) : (d) + '0')

Functions

static NMEErr hookDump (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEContext *context, void *data)
 Hook for dumping information about input.
static NMEErr hookEdit (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEContext *context, void *data)
 Hook for editing a fragment of input source.
static NMEErr hookCheck (NMEChar hook, NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, HookCheckData *hookCheckData)
 Hook for checking hooks.
static NMEErr divHookCheck (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEContext *context, void *data)
 Hook for checking div hook.
static NMEErr parHookCheck (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEContext *context, void *data)
 Hook for checking par hook.
static NMEErr spanHookCheck (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEContext *context, void *data)
 Hook for checking span hook.
NMEErr encodeURLEasylink (NMEConstText link, NMEInt linkLen, NMEContext *context, void *data)
 Easylink callback (replace dollar in string pointed by data with link, where letters, digits, hyphens, commas, dots, apostrophes, parentheses, colons and underscores are preserved, spaces are converted to underscores, non-ascii characters are URL-encoded, and other characters are ignored;.
int main (int argc, char **argv)
 Application entry point.

Variables

static NMEEncodeCharDict const xmlCharDict []
 Table of character substitutions for HTML or XML.
static NMEOutputFormat const NMEOutputFormatSlidesHTML
 Format strings for slides in HTML.
static NMEOutputFormat const NMEOutputFormatMediawiki
 Format strings for Mediawiki output (NOT FINISHED!).
static NMEEncodeCharDict const jspwikiCharDict []
 Table of character substitutions for JSPWiki.
static NMEOutputFormat const NMEOutputFormatJSPWiki
 Format strings for JSPWiki output.
static NMEPluginTocData tocData
 User data of NMEPluginTOCEntry.
static NMEPlugin const pluginsHTML []
 Table of plugins for conversion to HTML.
static NMEPlugin const plugins []
 Table of plugins for conversion to all formats but HTML/XML.
static NMEAutoconvert autoconverts [16]
 Table of autoconvert functions.
static NMEInterwiki const interwikis []
 Table of interwiki definitions.

Define Documentation

#define isAlphaNum (  ) 

Value:

((c) >= 'a' && (c) <= 'z' || (c) >= 'A' && (c) <= 'Z' \
            || (c) >= '0' && (c) <= '9')


Variable Documentation

NMEInterwiki const interwikis[] [static]

Initial value:

{
    {"Dictionary:",
        "http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query="},
    {"Foldoc:", "http://www.foldoc.org/foldoc/foldoc.cgi?"},
    {"Google:", "http://www.google.com/search?q="},
    {"WhoIs:", "http://www.whois.sc/"},
    {"WikiPedia:", "http://en.wikipedia.org/wiki/"},
    {NULL, NULL}
}
Table of interwiki definitions.

Definition at line 307 of file NMEMain.c.

Initial value:

{
    {'*', "~*"},
    {'#', "~#"},
    {'\\', "~\\"},
    {'_', "~_"},
    {'!', "~!"},
    {'{', "~{"},
    {'}', "~}"},
    {'~', "~~"},
    {0, NULL}
}
Table of character substitutions for JSPWiki.

Definition at line 213 of file NMEMain.c.

NMEPlugin const plugins[] [static]

Initial value:

Table of plugins for conversion to all formats but HTML/XML.

Definition at line 293 of file NMEMain.c.

NMEPlugin const pluginsHTML[] [static]

Initial value:

Table of plugins for conversion to HTML.

Definition at line 279 of file NMEMain.c.

NMEEncodeCharDict const xmlCharDict[] [static]

Initial value:

{
    {'<', "&lt;"},
    {'&', "&amp;"},
    {0, NULL}
}
Table of character substitutions for HTML or XML.

Definition at line 76 of file NMEMain.c.

Generated by Doxygen.
Copyright 2007-2008, Yves Piguet.
All rights reserved.