~nme/nme/1.1

« back to all changes in this revision

Viewing changes to Src/NMEPluginTOC.h

  • Committer: michael.owens at linterra
  • Date: 2008-11-19 17:49:21 UTC
  • Revision ID: michael.owens@linterra.org-20081119174921-5rh22x5qdh6ltf4o
Initial submission.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *      @file NMEPluginTOC.h
 
3
 *      @brief NME optional plugin for table of contents in HTML.
 
4
 *      @author Yves Piguet. Copyright 2007-2008, Yves Piguet.
 
5
 */
 
6
 
 
7
/* License: new BSD license (see NME.h) */
 
8
 
 
9
#ifndef __NMEPluginTOC__
 
10
#define __NMEPluginTOC__
 
11
 
 
12
#ifdef __cplusplus
 
13
extern "C" {
 
14
#endif
 
15
 
 
16
#include "NME.h"
 
17
 
 
18
/** User data for hook (opaque, typically allocated as an automatic (local)
 
19
        variable and passed by address to NMESetTOCOutputFormat)
 
20
*/
 
21
typedef struct
 
22
{
 
23
        NMEOutputFormat *outputFormat;  ///< private
 
24
        NMEInt level1;  ///< private
 
25
        NMEInt level2;  ///< private
 
26
        NMEBoolean links;       ///< private
 
27
} HookTOCData;
 
28
 
 
29
/** Set output format structure for TOC generation
 
30
        @param[in] f address of output format structure, whose contents are filled
 
31
        @param[out] d paragraph hook user data
 
32
*/
 
33
void NMESetTOCOutputFormat(NMEOutputFormat *f, HookTOCData *d);
 
34
 
 
35
/** User data of NMEPluginTOCEntry
 
36
*/
 
37
typedef struct
 
38
{
 
39
        NMEConstText src;       ///< original NME source code
 
40
        NMEInt srcLen;  ///< length of src
 
41
} NMEPluginTocData;
 
42
 
 
43
/** Plugin implementation for calendar using table markup (plugin's data:
 
44
        year month)
 
45
        @param[in] name plugin name, such as "calendar"
 
46
        @param[in] nameLen length of name
 
47
        @param[in] data data text
 
48
        @param[in] dataLen length of data
 
49
        @param[in,out] context current context
 
50
        @param[in] userData pointer passed from the parser, as specified in NMEPlugin
 
51
        @return error code (kNMEErrOk for success)
 
52
        @test @code
 
53
        << toc level
 
54
        >>
 
55
        @endcode
 
56
        or @code
 
57
        << toc level1 level2
 
58
        >>
 
59
        @endcode
 
60
        or @code
 
61
        << toc level1 level2 title
 
62
        >>
 
63
        @endcode
 
64
*/
 
65
NMEErr NMEPluginTOC(NMEConstText name, NMEInt nameLen,
 
66
                NMEConstText data, NMEInt dataLen,
 
67
                NMEContext *context,
 
68
                void *userData);
 
69
 
 
70
/// NMEPlugin entry for table of plugins
 
71
#define NMEPluginTOCEntry(data) \
 
72
        {"toc", kNMEPluginOptBetweenPar, NMEPluginTOC, (void *)data}
 
73
 
 
74
#ifdef __cplusplus
 
75
}
 
76
#endif
 
77
 
 
78
#endif