|
Nyctergatis Markup Engine (simple text markup formatting based on Creole)
More...
Go to the source code of this file.
Defines |
#define | kMaxNesting 8 |
| maximum nesting of lists
|
#define | isBlank(c) ((c) == ' ' || (c) == '\t') |
| Test if a character is a space or a tab.
|
#define | isEol(c) ((c) == '\r' || (c) == '\n') |
| Test if a character is an eol.
|
#define | isDigit(c) ((c) >= '0' && (c) <= '9') |
| Test if a character is a digit.
|
#define | isAlphaNum(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || isDigit(c)) |
| Test if a character is alphabetic (ASCII) or numeric.
|
#define | isFirstUTF8Byte(c) (((c) & 0x80) == 0 || ((c) & 0xe0) == 0xc0 || ((c) & 0xf0) == 0xe0) |
| Test if a byte is the first byte of a UTF-8 character.
|
#define | kMaxNumberedHeadingLevels 2 |
| Maximum number of numbered heading levels.
|
#define | kMaxSectionLevels 4 |
| Maximum number of heading-separated section levels.
|
#define | kTabWidth 4 |
| Tabulator width.
|
#define | CheckError(c) do { err = (c); if (err != kNMEErrOk) return err; } while (0) |
| Assign return value to err and return it unless kNMEErrOk.
|
#define | setContext(c, l, i) do { (c).level = l; (c).item = (i) < 0 ? 0 : (i); } while (0) |
| Set the context level and item number.
|
#define | kExprStackSize 16 |
#define | kExprErrorValue 1 |
#define | SIZE "%{2*s}" |
#define | SIZEH "%{l=1?3*s:l=2?5*s/2:l=3?2*s:3*s/2}" |
#define | HOOK(e, st) |
#define | HOOK(cb, l, it, e, m) |
#define | HOOK(cb, l, it, e, m) |
Typedefs |
typedef enum NMEState | NMEState |
| Parser states (the whole state includes the current nested lists with item numbers for ordered lists, the stack of styles in the current paragraph and the URL location in the source code while decoding the link text)
|
typedef enum NMEToken | NMEToken |
| Parsed token.
|
typedef enum NMEStyle | NMEStyle |
| Text style.
|
Enumerations |
enum | {
kNMEListNumUL = -100,
kNMEListNumDT,
kNMEListNumDD,
kNMEListIndented,
kNMEListNumTableCell,
kNMEListNumTableHCell
} |
| Special codes for list items (positive values are item numbers for OL) More...
|
enum | NMEState {
kNMEStatePar,
kNMEStatePre,
kNMEStateHeading,
kNMEStateParAfterEol,
kNMEStatePreAfterEol,
kNMEStateBetweenPar
} |
| Parser states (the whole state includes the current nested lists with item numbers for ordered lists, the stack of styles in the current paragraph and the URL location in the source code while decoding the link text)
|
enum | NMEToken {
kNMETokenChar,
kNMETokenSpace,
kNMETokenTab,
kNMETokenEOL,
kNMETokenHeading,
kNMETokenLineBreak,
kNMETokenLI,
kNMETokenDD,
kNMETokenTableCell,
kNMETokenTableHCell,
kNMETokenHR,
kNMETokenPre,
kNMETokenStyle,
kNMETokenLinkBegin,
kNMETokenLinkEnd,
kNMETokenImageBegin,
kNMETokenImageEnd,
kNMETokenPlugin,
kNMETokenPluginBlock,
kNMETokenPlaceholder,
kNMETokenPlaceholderBlock
} |
| Parsed token. More...
|
enum | NMEStyle {
kNMEStyleBold = 0,
kNMEStyleItalic,
kNMEStyleUnderline,
kNMEStyleSuperscript,
kNMEStyleSubscript,
kNMEStyleMonospace,
kNMEStyleVerbatim,
kNMEStyleLink,
kNMEStyleImage,
kNMEStylesCount
} |
| Text style. More...
|
Functions |
static void | skipBlanks (NMEConstText src, NMEInt srcLen, NMEInt *i) |
| Skip spaces and tabs.
|
static void | execOperator (NMEInt stack[], NMEInt *stackDepth, NMEChar op) |
| Execute operator.
|
static void | updateLineNum (NMEContext *context) |
| Update srcLineNum and srcIndexForLineNum so that srcIndexForLineNum = srcIndex.
|
static NMEInt | evalExpression (NMEConstText src, NMEInt srcLen, NMEContext *context) |
| Evaluate expression (are supported: + - * / = !(ne) > < & | ? :, parenthesis, integers, l=level, i=item, s=size, o=src offset, L=line num, p=dest offset, x=xref).
|
NMEBoolean | NMEAddString (NMEConstText str, NMEInt strLen, NMEChar ctrlChar, NMEContext *context) |
| Add a string to output, converting eol and embedded expressions.
|
NMEErr | NMEAddRawString (NMEConstText str, NMEInt strLen, NMEContext *context) |
| Copy a raw string to output, without any conversion.
|
NMEErr | NMECopySource (NMEInt length, NMEBoolean copy, NMEBoolean encodeChar, NMEContext *context) |
| Copy or skip source to output.
|
void | NMEResetOutput (NMEContext *context) |
| Reset output (can be used in a hook).
|
static NMEErr | checkWordwrap (NMEContext *context, NMEOutputFormat const *outputFormat) |
| Check wordwrap, inserting an end-of-line and spaces for indenting if required.
|
NMEErr | NMEEncodeCharFunDict (NMEConstText src, NMEInt srcLen, NMEInt *srcIx, NMEContext *context, void *data) |
| NMEEncodeCharFun function which replaces characters listed in a table with strings.
|
static NMEErr | encodeCharFunNME (NMEConstText src, NMEInt srcLen, NMEInt *srcIx, NMEContext *context, void *data) |
| encodeCharFunNME function for NME output; characters are left unescaped when possible.
|
static NMEErr | encodeURLFunNull (NMEConstText link, NMEInt linkLen, NMEContext *context, void *data) |
| NMEEncodeURLFun function which encodes link to a URL for null output, producing no output.
|
static NMEErr | encodeCharFunNull (NMEConstText src, NMEInt srcLen, NMEInt *srcIx, NMEContext *context, void *data) |
| NMEEncodeCharFun function which encodes characters for null output, producing no output; the encodeCharData field is ignored (can be set to NULL).
|
static NMEWordwrapPermission | wordwrapCheckNMEFun (NMEConstText txt, NMEInt len, NMEInt i, NMEContext *context, void *data) |
| NMEWordwrapCheckFun function to check valid wordwrap point for NME (don't break line before stars, sharps, eq, pipes, or in a table)
|
static NMEErr | encodeCharRTFFun (NMEConstText src, NMEInt srcLen, NMEInt *srcIx, NMEContext *context, void *data) |
| NMEEncodeCharFun function which encodes characters for RTF.
|
static NMEErr | encodeURLFunRTF (NMEConstText link, NMEInt linkLen, NMEContext *context, void *data) |
| NMEEncodeURLFun function which encodes link to a URL for RTF output.
|
static NMEWordwrapPermission | wordwrapCheckRTFFun (NMEConstText txt, NMEInt len, NMEInt i, NMEContext *context, void *data) |
| NMEWordwrapCheckFun function to check valid wordwrap point for RTF (keep space)
|
static NMEErr | addLink (NMEContext *context, NMEOutputFormat const *outputFormat) |
| Add link to dest, substituting interwiki if necessary.
|
static NMEBoolean | findStyleInStyleStack (NMEStyle const styleStack[], NMEInt styleNesting, NMEStyle style, NMEInt *i) |
| Find style in stack of styles.
|
static NMEConstText | styleMarkerFromStyleID (NMEStyle style) |
| Get style marker string associated to a style constant.
|
static NMEErr | processStyleTag (NMEStyle styleStack[], NMEInt *styleNesting, NMEStyle style, NMEInt i0, NMEOutputFormat const *outputFormat, NMEContext *context) |
| Process style tag.
|
static NMEErr | flushStyleTags (NMEStyle styleStack[kNMEStylesCount], NMEInt *styleNesting, NMEInt i0, NMEOutputFormat const *outputFormat, NMEContext *context) |
| Flush waiting style tags.
|
static NMEErr | addEndPar (NMEBoolean forceEndOfList, NMEOutputFormat const *outputFormat, NMEContext *context, NMEInt srcIndexEndPar) |
| Add an endPar, endIndented, endULItem, endOLItem, endDT, endDD, or endTableRow.
|
static NMEErr | addLinkBegin (NMEBoolean isImage, NMEStyle styleStack[kNMEStylesCount], NMEInt *styleNesting, NMEInt i0, NMEOutputFormat const *outputFormat, NMEContext *context) |
| Parse the beginning of a link and leave the parsing point at the beginning of the link text.
|
static NMEInt | findPlugin (NMEConstText src, NMEInt srcLen, NMEInt i, NMEBoolean isPlaceholder, NMEOutputFormat const *outputFormat) |
| Find plugin.
|
static NMEErr | addPlugin (NMEBoolean isBlock, NMEBoolean isPlaceholder, NMEInt options, NMEOutputFormat const *outputFormat, NMEContext *context, NMEBoolean *reparseOutput) |
| Parse and process a plugin tag.
|
static void | nextHeading (NMEInt *headingFlags, NMEInt headingNum[], NMEInt headingLevel) |
| Update heading index and Increment heading number at the specified level, resetting higher levels.
|
static NMEBoolean | parseNextToken (NMEConstText src, NMEInt srcLen, NMEInt *i, NMEState state, NMEBoolean verbatim, NMEInt nesting, NMEInt const listNum[], NMEStyle const styleStack[], NMEInt styleNesting, NMEOutputFormat const *outputFormat, NMEToken *token, NMEInt *headingLevel, NMEInt *itemNesting, NMEStyle *style, NMEInt options) |
| Parse next token, skipping it in the source code.
|
static NMEErr | swapBuffers (NMEText *src, NMEInt *srcLen, NMEContext *context, NMEInt *commonLen, NMEInt destLen0) |
| Swap source and destination buffers after some plugin or autoconvert output must be reparsed.
|
NMEErr | NMEProcess (NMEConstText nmeText, NMEInt nmeTextLen, NMEText buf, NMEInt bufSize, NMEInt options, NMEConstText eol, NMEOutputFormat const *outputFormat, NMEInt fontSize, NMEText *output, NMEInt *outputLen, NMEInt *outputUCS16Len) |
| Transform text by interpreting markup.
|
void | NMEGetTempMemory (NMEContext const *context, NMEText *addr, NMEInt *len) |
| Get temporary memory which can be used in plugin, autolink and hook functions.
|
void | NMEGetFormat (NMEContext const *context, NMEOutputFormat const **outputFormat, NMEInt *options, NMEInt *fontSize) |
| Get current output format and options.
|
NMEInt | NMECurrentInputIndex (NMEContext const *context) |
| Accessor for input index.
|
NMEInt | NMECurrentOutputIndex (NMEContext const *context) |
| Accessor for output index.
|
NMEInt | NMECurrentOutputIndexUCS16 (NMEContext const *context) |
| Accessor for output index in unicode characters, assuming UTF-8 input.
|
void | NMECurrentLink (NMEContext const *context, NMEInt *linkOffset, NMEInt *linkLength) |
| Accessor for current link or image (can be called from hook "[[" or "{{"), before any processing by NMEEncodeURLFun.
|
void | NMECurrentOutput (NMEContext const *context, NMEConstText *output, NMEInt *outputLength) |
| Accessor for output produced until now (provides context which can be used to decide if a character should be escaped).
|
NMEConstText | NMECurrentListNesting (NMEContext const *context) |
| Accessor for current list nesting as a string of NME markup characters.
|
Variables |
NMEEncodeCharDict const | NMEXMLCharDict [] |
| Table of character substitutions for HTML or XML.
|
static NMEEncodeCharDict const | latexCharDict [] |
| Table of character substitutions for LaTeX.
|
NMEOutputFormat const | NMEOutputFormatText |
| Format strings for plain text output.
|
NMEOutputFormat const | NMEOutputFormatTextCompact |
| Format strings for plain text output with fewer blank lines.
|
NMEOutputFormat const | NMEOutputFormatDebug |
| Format strings for debug output (valid XML)
|
NMEOutputFormat const | NMEOutputFormatNull |
| Format strings for no output.
|
NMEOutputFormat const | NMEOutputFormatNME |
| Format strings for NME text output.
|
NMEOutputFormat const | NMEOutputFormatHTML |
| Format strings for HTML output.
|
NMEOutputFormat const | NMEOutputFormatRTF |
| Format strings for RTF output.
|
NMEOutputFormat const | NMEOutputFormatLaTeX |
| Format strings for LaTeX output.
|
NMEOutputFormat const | NMEOutputFormatMan |
| Format strings for man page output.
|
Detailed Description
Nyctergatis Markup Engine (simple text markup formatting based on Creole)
- Author:
- Yves Piguet.
- Copyright:
- 2007-2013, Yves Piguet.
Definition in file NME.c.
Define Documentation
Value:do { \
if (outputFormat->spanHookFun) \
{ \
NMEConstText styleStr = styleMarkerFromStyleID(st); \
if (styleStr) \
{ \
updateLineNum(context); \
CheckError(outputFormat->spanHookFun(kNMEHookLevelSpan, 0, e, styleStr, \
i0 + context->srcIndexOffset, \
context->srcLineNum, \
context, \
outputFormat->hookData)); \
} \
} \
} while (0)
#define HOOK |
( |
|
cb, |
|
|
|
l, |
|
|
|
it, |
|
|
|
e, |
|
|
|
m |
|
) |
| |
Value:do { \
if (outputFormat->cb) \
{ \
updateLineNum(context); \
CheckError(outputFormat->cb(l, it, e, m, \
context->srcIndexOffset + srcIndexEndPar, \
context->srcLineNum, \
context, \
outputFormat->hookData)); \
} \
} while (0)
#define HOOK |
( |
|
cb, |
|
|
|
l, |
|
|
|
it, |
|
|
|
e, |
|
|
|
m |
|
) |
| |
Value:do { \
if (outputFormat->cb) \
{ \
updateLineNum(&context); \
err = outputFormat->cb(l, it, e, m, \
i0 + context.srcIndexOffset, \
context.srcLineNum, \
&context, \
outputFormat->hookData); \
if (err != kNMEErrOk) \
return err; \
} \
} while (0)
Enumeration Type Documentation
Special codes for list items (positive values are item numbers for OL)
- Enumerator:
kNMEListNumUL |
unnumbered list item
|
kNMEListNumDT |
title in definition list
|
kNMEListNumDD |
definition in definition list
|
kNMEListIndented |
indented paragraph
|
kNMEListNumTableCell |
table cell
|
kNMEListNumTableHCell |
table heading cell
|
Definition at line 17 of file NME.c.
Text style.
- Enumerator:
kNMEStyleBold |
bold
|
kNMEStyleItalic |
italic
|
kNMEStyleUnderline |
underline
|
kNMEStyleSuperscript |
superscript
|
kNMEStyleSubscript |
subscript
|
kNMEStyleMonospace |
monospace (code)
|
kNMEStyleVerbatim |
verbatim
|
kNMEStyleLink |
link text
|
kNMEStyleImage |
image alt text
|
kNMEStylesCount |
number of different styles (max. nesting)
|
Definition at line 97 of file NME.c.
Parsed token.
- Enumerator:
kNMETokenChar |
any other character
|
kNMETokenSpace |
space
|
kNMETokenTab |
tab
|
kNMETokenEOL |
CR or LF or CRLF.
|
kNMETokenHeading |
one or more '='
|
kNMETokenLineBreak |
double backslash
|
kNMETokenLI |
*, #, ;, or : (indenting) at beginning of line (not ** without space)
|
kNMETokenDD |
: after a space in the context of kNMEListNumDT
|
kNMETokenTableCell |
single pipe
|
kNMETokenTableHCell |
double pipe
|
kNMETokenHR |
at least 4 hyphens at beginning of line
|
kNMETokenPre |
{{{ or }}} alone in a line
|
kNMETokenStyle |
any style (including verbatim) but link
|
kNMETokenLinkBegin |
[[
|
kNMETokenLinkEnd |
]]
|
kNMETokenImageBegin |
{{
|
kNMETokenImageEnd |
}}
|
kNMETokenPlugin |
<< with other data on the same line
|
kNMETokenPluginBlock |
<< alone on a line (end tag must also be alone)
|
kNMETokenPlaceholder |
<<< with other data on the same line
|
kNMETokenPlaceholderBlock |
<<< alone on a line (end tag must also be alone)
|
Definition at line 71 of file NME.c.
Function Documentation
Add an endPar, endIndented, endULItem, endOLItem, endDT, endDD, or endTableRow.
- Parameters:
-
[in] | forceEndOfList | if TRUE, all current lists or table are ended |
[in] | outputFormat | format strings |
[in,out] | context | current context |
[in] | srcIndexEndPar | value of srcIndex at end par |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 1825 of file NME.c.
Add link to dest, substituting interwiki if necessary.
- Parameters:
-
[in,out] | context | current context where link position and source is stored |
[in] | outputFormat | format strings, or NULL for default |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 1474 of file NME.c.
Parse the beginning of a link and leave the parsing point at the beginning of the link text.
- Parameters:
-
[in] | isImage | TRUE for image, FALSE for link |
[in,out] | styleStack | stack of styles |
[in,out] | styleNesting | number of styles in stack |
[in] | i0 | index in src of beginning of tag |
[in] | outputFormat | format strings, or NULL for default |
[in,out] | context | current context (where link position is stored) |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 1997 of file NME.c.
Parse and process a plugin tag.
- Parameters:
-
[in] | isBlock | if TRUE, end tag must be alone in a line |
[in] | isPlaceholder | if TRUE, end tag must be triple right angle brackets |
[in] | options | kNMEProcessOptDefault or sum of options |
[in] | outputFormat | format strings, or NULL for default |
[in,out] | context | current context |
[out] | reparseOutput | TRUE if plugin's output is NME which should be parsed again |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 2179 of file NME.c.
Check wordwrap, inserting an end-of-line and spaces for indenting if required.
- Parameters:
-
[in,out] | context | current context |
[in] | outputFormat | format strings (can be NULL) |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 593 of file NME.c.
encodeCharFunNME function for NME output; characters are left unescaped when possible.
- Parameters:
-
[in] | src | input characters |
[in] | srcLen | size of src in bytes |
[in,out] | srcIx | index in src (updated by one character) |
[in,out] | context | context used to deciding whether to escape |
[in,out] | data | not used (NULL) |
- Returns:
- error code (kNMEErrOk for success)
- See also:
- NMEOutputFormat
< character which must be escaped
< previous character, or '
' for line beginning (w/ leading spaces), or 0 for any
Definition at line 720 of file NME.c.
NMEEncodeCharFun function which encodes characters for null output, producing no output; the encodeCharData field is ignored (can be set to NULL).
- Parameters:
-
[in] | src | input characters |
[in] | srcLen | size of src in bytes |
[in,out] | srcIx | index in src (should be updated by one character) |
[in,out] | context | current context |
[in,out] | data | ignored |
- Returns:
- error code (kNMEErrOk for success)
- See also:
- NMEOutputFormat
Definition at line 955 of file NME.c.
NMEEncodeCharFun function which encodes characters for RTF.
Special RTF characters (backslash and braces) are escaped and multibyte characters are written in hexadecimal. Its address should be stored in the encodeCharFun field of NMEOutputFormat; the encodeCharData field is ignored (can be set to NULL).
- Parameters:
-
[in] | src | input characters |
[in] | srcLen | size of src in bytes |
[in,out] | srcIx | index in src (should be updated by one character) |
[in,out] | context | current context |
[in,out] | data | ignored |
- Returns:
- error code (kNMEErrOk for success)
- See also:
- NMEOutputFormat
Definition at line 1169 of file NME.c.
NMEEncodeURLFun function which encodes link to a URL for null output, producing no output.
- Parameters:
-
[in] | link | input characters (ignored) |
[in] | linkLen | length of link (ignored) |
[in,out] | context | current context (ignored) |
[in,out] | data | value specific to the callback (ignored) |
- Returns:
- error code (always kNMEErrOk)
Definition at line 939 of file NME.c.
NMEEncodeURLFun function which encodes link to a URL for RTF output.
- Parameters:
-
[in] | link | input characters |
[in] | linkLen | length of link |
[in,out] | context | current context |
[in,out] | data | value specific to the callback (ignored) |
- Returns:
- error code
Definition at line 1242 of file NME.c.
Evaluate expression (are supported: + - * / = !(ne) > < & | ? :, parenthesis, integers, l=level, i=item, s=size, o=src offset, L=line num, p=dest offset, x=xref).
- Parameters:
-
[in] | src | source code |
[in] | srcLen | length of source code |
[in,out] | context | context for variables |
- Returns:
- result, or 1 if error
< operator character (nul for end of list)
< operator priority
Definition at line 234 of file NME.c.
Execute operator.
- Parameters:
-
[in,out] | stack | operand stack |
[in,out] | stackDepth | operand stack depth |
[in] | op | operator |
Definition at line 169 of file NME.c.
Find plugin.
- Parameters:
-
[in] | src | source text with markup |
[in] | srcLen | source text length |
[in] | i | parsing point |
[in] | isPlaceholder | if TRUE, end tag must be triple right angle brackets |
[in] | outputFormat | format strings, or NULL for default |
- Returns:
- index of plugin in outputFormat->plugins, or -1 if not found
Definition at line 2128 of file NME.c.
Find style in stack of styles.
- Parameters:
-
[in] | styleStack | stack of styles |
[in] | styleNesting | number of styles in stack |
[in] | style | style to find |
[out] | i | set to index of index matching style if found and i not NULL |
- Returns:
- TRUE if found, FALSE if not found
Definition at line 1535 of file NME.c.
Flush waiting style tags.
- Parameters:
-
[in,out] | styleStack | stack of styles |
[in,out] | styleNesting | number of styles in stack |
[in] | i0 | index in src of beginning of tag |
[in] | outputFormat | format strings |
[in,out] | context | current context |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 1743 of file NME.c.
static void nextHeading |
( |
NMEInt * |
headingFlags, |
|
|
NMEInt |
headingNum[], |
|
|
NMEInt |
headingLevel |
|
) |
| [static] |
Update heading index and Increment heading number at the specified level, resetting higher levels.
- Parameters:
-
[in,out] | headingFlags | bit field with 1 if inside a section at that level ([0]=level 1) |
[in,out] | headingNum | array of heading numbers ([0]=level 1) |
[in] | headingLevel | heading level to increment (1=level 1) |
Definition at line 2287 of file NME.c.
Copy a raw string to output, without any conversion.
- Parameters:
-
[in] | str | string to append |
[in] | strLen | length of str in bytes, or -1 for null-terminated string |
[in,out] | context | current context |
- Returns:
- kNMEErrOk for success, else error code
Definition at line 509 of file NME.c.
Add a string to output, converting eol and embedded expressions.
- Parameters:
-
[in] | str | string to append |
[in] | strLen | length of str in bytes, or -1 for null-terminated string |
[in] | ctrlChar | control character for embedded expressions |
[in,out] | context | current context |
- Returns:
- TRUE for success, FALSE for failure (not enough space)
Definition at line 373 of file NME.c.
Copy or skip source to output.
- Parameters:
-
[in] | length | number of bytes of source to consume |
[in] | copy | TRUE to copy source, FALSE to skip |
[in] | encodeChar | TRUE to use encodeCharFun, FALSE for plain copy |
[in,out] | context | current context |
- Returns:
- kNMEErrOk for success, else error code
Definition at line 538 of file NME.c.
Accessor for input index.
- Parameters:
-
[in] | context | current context |
- Returns:
- current input index
Definition at line 4212 of file NME.c.
Accessor for current link or image (can be called from hook "[[" or "{{"), before any processing by NMEEncodeURLFun.
- Parameters:
-
[in] | context | current context |
[out] | linkOffset | offset of link in NME source text |
[out] | linkLength | length of link |
Definition at line 4227 of file NME.c.
Accessor for current list nesting as a string of NME markup characters.
- Parameters:
-
[in] | context | current context |
- Returns:
- string (constant, valid until next call)
Definition at line 4243 of file NME.c.
Accessor for output produced until now (provides context which can be used to decide if a character should be escaped).
- Parameters:
-
[in] | context | current context |
[out] | output | address of output (not provided if NULL) |
[out] | outputLength | current length of output in bytes (not provided if NULL) |
Definition at line 4234 of file NME.c.
Accessor for output index.
- Parameters:
-
[in] | context | current context |
- Returns:
- current output index
Definition at line 4217 of file NME.c.
Accessor for output index in unicode characters, assuming UTF-8 input.
- Parameters:
-
[in] | context | current context |
- Returns:
- current output index
Definition at line 4222 of file NME.c.
NMEEncodeCharFun function which replaces characters listed in a table with strings.
Characters not in the table are copied unmodified. Its address should be stored in the encodeCharFun field of NMEOutputFormat, while the adresse of a table of type NMEEncodeCharDict[] ending with {0,NULL} should be stored in the encodeCharData field.
- Parameters:
-
[in] | src | input characters |
[in] | srcLen | size of src in bytes |
[in,out] | srcIx | index in src (updated by one character) |
[in,out] | context | context for embedded expressions |
[in,out] | data | address of substitution table, of type NMEEncodeCharDict[] |
- Returns:
- error code (kNMEErrOk for success)
- See also:
- NMEOutputFormat
Definition at line 690 of file NME.c.
Get current output format and options.
- Parameters:
-
[in] | context | current context |
[out] | outputFormat | output format (not set if pointer is null) |
[out] | options | kNMEProcessOptDefault or sum of options |
[out] | fontSize | font size (not set if pointer is null) |
Definition at line 4199 of file NME.c.
Get temporary memory which can be used in plugin, autolink and hook functions.
- Parameters:
-
[in] | context | current context |
[out] | addr | memory address |
[out] | len | number of bytes |
Definition at line 4191 of file NME.c.
NMEErr NMEProcess |
( |
NMEConstText |
nmeText, |
|
|
NMEInt |
nmeTextLen, |
|
|
NMEText |
buf, |
|
|
NMEInt |
bufSize, |
|
|
NMEInt |
options, |
|
|
NMEConstText |
eol, |
|
|
NMEOutputFormat const * |
outputFormat, |
|
|
NMEInt |
fontSize, |
|
|
NMEText * |
output, |
|
|
NMEInt * |
outputLen, |
|
|
NMEInt * |
outputUCS16Len |
|
) |
| |
Transform text by interpreting markup.
This is the main and only required extern function of the parser.
- Parameters:
-
[in] | nmeText | source text with markup |
[in] | nmeTextLen | source text length |
[out] | buf | buffer used during conversion |
[in] | bufSize | size of buf |
[in] | options | kNMEProcessOptDefault or sum of options |
[in] | eol | null-terminated string used for end-of-line |
[in] | outputFormat | format strings, or NULL for default (NMEOutputFormatText) |
[in] | fontSize | font size of plain text in points (nonpositive -> default) |
[out] | output | formatted text (in buf), followed by null byte |
[out] | outputLen | formatted text length, excluding final null byte |
[out] | outputUCS16Len | formatted text length in 16-bit unicode characters assuming input is in UTF-8, excluding final null byte (may be NULL) |
- Returns:
- error code (kNMEErrOk for success)
- Bug:
- Links are copied verbatim, without processing the escape character (this means that pipes and double-closing-brackets cannot be included in a link).
Definition at line 2845 of file NME.c.
Reset output (can be used in a hook).
- Parameters:
-
[in,out] | context | current context |
Definition at line 582 of file NME.c.
static NMEBoolean parseNextToken |
( |
NMEConstText |
src, |
|
|
NMEInt |
srcLen, |
|
|
NMEInt * |
i, |
|
|
NMEState |
state, |
|
|
NMEBoolean |
verbatim, |
|
|
NMEInt |
nesting, |
|
|
NMEInt const |
listNum[], |
|
|
NMEStyle const |
styleStack[], |
|
|
NMEInt |
styleNesting, |
|
|
NMEOutputFormat const * |
outputFormat, |
|
|
NMEToken * |
token, |
|
|
NMEInt * |
headingLevel, |
|
|
NMEInt * |
itemNesting, |
|
|
NMEStyle * |
style, |
|
|
NMEInt |
options |
|
) |
| [static] |
Parse next token, skipping it in the source code.
- Parameters:
-
[in] | src | source text with markup |
[in] | srcLen | source text length |
[in,out] | i | index in src (token to parse on input, next token on output) |
[in] | state | current state of the parser |
[in] | verbatim | TRUE if in inline verbatim mode |
[in] | nesting | current list nesting |
[in] | listNum | array of current list item numbers or kNMEListNumUL/DT/DD/Indented |
[in] | styleStack | stack of styles |
[in] | styleNesting | number of styles in stack |
[in] | outputFormat | format strings (can be NULL) |
[out] | token | kind of parsed token (details are in src[*i-1], *headingLevel, itemNesting, *style) |
[out] | headingLevel | if token is a starting kNMETokenHeading, set to its level |
[out] | itemNesting | if token is kNMETokenLI, set to its nesting level |
[out] | style | if token is kNMETokenStyle, set to its style |
[in] | options | passed to NMEProcess |
- Returns:
- TRUE to continue, FALSE if end of source has been reached
Definition at line 2328 of file NME.c.
Process style tag.
- Parameters:
-
[in,out] | styleStack | stack of styles |
[in,out] | styleNesting | number of styles in stack |
[in] | style | new style (not kNMEStyleLink or kNMEStyleImage) |
[in] | i0 | index in src of beginning of tag |
[in] | outputFormat | format strings |
[in,out] | context | current context |
- Returns:
- error code (kNMEErrOk for success)
Definition at line 1591 of file NME.c.
Skip spaces and tabs.
- Parameters:
-
[in] | src | source text with markup |
[in] | srcLen | source text length |
[in,out] | i | index in src |
Definition at line 158 of file NME.c.
Get style marker string associated to a style constant.
- Parameters:
-
- Returns:
- style marker string, or NULL for nonbasic style
Definition at line 1557 of file NME.c.
Swap source and destination buffers after some plugin or autoconvert output must be reparsed.
- Parameters:
-
[in,out] | src | input characters |
[in,out] | srcLen | length of src in bytes |
[in,out] | context | current context |
[in,out] | commonLen | number of bytes at beginning of dest already copied in src |
[in] | destLen0 | value of destLen before plugin or autoconvert call |
- Returns:
- error code (kNMEErrOk for success)
- See also:
- NMEProcess
Definition at line 2815 of file NME.c.
static void updateLineNum |
( |
NMEContext * |
context | ) |
[static] |
Update srcLineNum and srcIndexForLineNum so that srcIndexForLineNum = srcIndex.
- Parameters:
-
[in] | src | source code |
[in,out] | context | context |
Definition at line 215 of file NME.c.
NMEWordwrapCheckFun function to check valid wordwrap point for NME (don't break line before stars, sharps, eq, pipes, or in a table)
- Parameters:
-
[in] | txt | output text |
[in] | len | length of output text in bytes |
[in] | i | line break to check (space to be removed or before char to push to next line) |
[in,out] | data | value specific to the callback |
- Returns:
- wordwrap kind (kNMEWordwrapNo if not permitted here)
Definition at line 1021 of file NME.c.
NMEWordwrapCheckFun function to check valid wordwrap point for RTF (keep space)
- Parameters:
-
[in] | txt | output text |
[in] | len | length of output text in bytes |
[in] | i | line break to check (space to be removed or before char to push to next line) |
[in,out] | context | current context |
[in,out] | data | value specific to the callback |
- Returns:
- wordwrap kind (kNMEWordwrapNo if not permitted here)
Definition at line 1264 of file NME.c.
Variable Documentation
Initial value:
{
{'#', "\\#"},
{'^', "$\\,\\hat{}\\,$"},
{'~', "$\\,\\tilde{}\\,$"},
{'\\', "$\\backslash$"},
{'|', "$|$"},
{'\'', "\'{}"},
{'`', "`{}"},
{'<', "$<$"},
{'>', "$>$"},
{'{', "\\{"},
{'}', "\\}"},
{0, NULL}
}
Table of character substitutions for LaTeX.
Definition at line 674 of file NME.c.
Format strings for man page output.
- Bug:
- NMEOutputFormatMan needs more work or it will be discarded from the main code
Definition at line 1420 of file NME.c.
Initial value:
{
{'<', "<"},
{'>', ">"},
{'"', """},
{'&', "&"},
{0, NULL}
}
Table of character substitutions for HTML or XML.
Definition at line 664 of file NME.c.
|
Generated by Doxygen.
Copyright 2007-2013, Yves Piguet.
All rights reserved.
|
|