Class WikiDocument

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class WikiDocument

Summary
Public Methods
WikiDocument(filename)
inline void clear()
inline WikiDocument& setWikiPath(path)
inline WikiDocument& setLinkExtension(fileExtension)
inline WikiDocument& allowLinks(allow)
inline WikiDocument& setDefaultParagraphStyle(paragraphStyle)
inline string getDefaultParagraphStyle() const
bool isHeader(line_no) const
int getHeaderDepth(line_no) const
int setHeaderDepth(depth, line_no)
string getHeaderTitle(line_no) const
bool isBullet(line_no) const
int getBulletDepth(line_no) const
bool isNumberedItem(line_no) const
int getNumberedDepth(line_no) const
bool isIndented(line_no) const
int getIndentDepth(line_no) const
bool isCodeLine(line_no) const
bool isTableStart(line_no) const
bool isTableCaption(line_no) const
bool isTableNewRow(line_no) const
bool isTableData(line_no) const
bool isTableEnd(line_no) const
inline bool isTablePart(line_no) const
bool isHorizontalLine(line_no) const
inline bool insertHeader(title, depth, line_no)
inline bool insertBullet(text, line_no, depth)
inline bool insertNumberedItem(text, line_no, depth)
inline bool insertCodeLine(text, line_no)
bool insertTable(rows, columns, line_no, headings)
inline bool insertHorizontalLine(line_no)
static inline string italic(text)
static inline string bold(text)
inline int findNextHeader(line_no) const
int findNextHeader(title, line_no) const
vector getTitles(depth, line_no) const
vector getSubTitles(parentTitle, depth, line_no) const
vector getAllTitles() const
HashArray getTitleLines(depth, line_no) const
HashArray getSubTitleLines(parentTitle, depth, line_no) const
HashArray getAllTitleLines() const
HashArray getTitleDepth(depth, line_no) const
HashArray getSubTitleDepth(parentTitle, depth, line_no) const
HashArray getAllTitleDepth() const
inline int findTitle(title, depth, line_no) const
int findSubTitle(parentTitle, parentDepth, title, depth, line_no) const
int getStartOfBlockLine(line_no) const
int getEndOfBlockLine(line_no, includeSubBlocks) const
int getBlockSize(line_no, includeSubBlocks) const
int getBlockSize(title, depth, line_no, includeSubBlocks) const
int getBlockSize(parentTitle, depth, title, line_no, includeSubBlocks) const
bool titleExists(title, depth, line_no) const
bool subTitleExists(parentTitle, depth, title, line_no) const
bool contentExists(title, depth, line_no) const
bool contentExists(parentTitle, depth, title, line_no) const
string getTextBlock(line_no, includeSubBlocks, includeTitle, shiftHeadersLeft) const
string getTextBlock(title, depth, line_no, includeSubBlocks, includeTitle, shiftHeadersLeft) const
string getTextBlock(parentTitle, depth, title, line_no, includeSubBlocks, includeTitle, shiftHeadersLeft) const
int replaceTextBlock(text, line_no, includeSubBlocks, shiftHeadersRight)
int replaceTextBlock(text, title, depth, line_no, includeSubBlocks, shiftHeadersRight)
int replaceTextBlock(text, parentTitle, depth, title, line_no, includeSubBlocks, shiftHeadersRight)
bool removeTextBlock(line_no, includeSubBlocks, includeTitle)
bool removeTextBlock(title, depth, line_no, includeSubBlocks, includeTitle)
bool removeTextBlock(parentTitle, depth, title, line_no, includeSubBlocks, includeTitle)
int insertTextBlock(newTitle, depth, text, line_no, shiftHeadersRight)
int insertTextBlockAfter(peerTitle, depth, newTitle, text, line_no, shiftHeadersRight)
int insertTextBlockBefore(peerTitle, depth, newTitle, text, line_no, shiftHeadersRight)
int appendTextSubBlock(parentTitle, depth, newTitle, text, line_no, shiftHeadersRight)
inline int findNextTable(line_no, insideSameBlock) const
int findNextTable(title, line_no, insideSameBlock) const
vector getTables(depth, line_no) const
vector getSubTables(parentTitle, depth, line_no) const
vector getAllTables() const
HashArray getTableLines(depth, line_no) const
HashArray getSubTableLines(parentTitle, depth, line_no) const
HashArray getAllTableLines() const
inline int findTable(title, depth, line_no) const
int findSubTable(parentTitle, parentDepth, title, depth, line_no) const
int getEndOfTableLine(line_no) const
int getTableSize(line_no) const
bool tableExists(title, depth, line_no) const
bool tableExists(parentTitle, depth, title, line_no) const
WikiDocTable getTable(line_no) const
WikiDocTable getTable(title, depth, line_no) const
WikiDocTable getTable(parentTitle, depth, title, line_no) const
int replaceTable(table, line_no)
int replaceTable(table, title, depth, line_no)
int replaceTable(table, parentTitle, depth, title, line_no)
bool removeTable(line_no)
bool removeTable(title, depth, line_no)
bool removeTable(parentTitle, depth, title, line_no)
int insertTable(newTitle, depth, table, line_no)
int insertTableAfter(peerTitle, depth, newTitle, table, line_no)
int insertTableBefore(peerTitle, depth, newTitle, table, line_no)
int appendTable(parentTitle, depth, newTitle, table, line_no)
WikiDocument& shiftHeaders(amount, start_line_no, end_line_no)
inline WikiDocument& promoteHeaders(start_line_no, end_line_no)
inline WikiDocument& demoteHeaders(start_line_no, end_line_no)
static HashArray getIndexRefAssists(text, chardepth, allowedNonAlphanum)
static int convertIndexRefAssists(text, showtext, refs, indexName, chardepth, allowedNonAlphanum, createElementType)
static HashArray getMentions(text, mentionXref, chardepth, allowedNonAlphanum)
static HashArray getDanglingMentions(text, mentionXref, chardepth, allowedNonAlphanum)
inline HashArray getMentions(mentionXref, chardepth, allowedNonAlphanum) const
inline HashArray getDanglingMentions(mentionXref, chardepth, allowedNonAlphanum) const
static int convertMentions(text, mentionXref, chardepth, allowedNonAlphanum)
inline int convertMentions(mentionXref, chardepth, allowedNonAlphanum)
static string titleToLinkName(title)
static bool wikiPageExists(title)
WikiDocumentCB* setMetaCommandCB(cbfn, cbdata)
inline string getText() const
inline void setText(text)
Document& toDocument(doc, line)
Document& toDocument(doc)
Document toDocument()
inline string toHTML(fulldoc)
inline const StringSet& getReferencedExternalExistingPages() const
inline const StringSet& getReferencedExternalNonExistingPages() const
static int countCharRepeats(text)
Private Properties
Private Methods
void checkIfPageExists(title)
int splitLine(ppart, pos0, pretext, text, posttext, style, link, metacommand, anchor)
void extractStyle(ppart, startText, stopText, style)
void extractBookmarks(ppart, startText, stopText)
void extractLinks(ppart, startText, stopText, externalRef)
void processMetacommands(ppart, startText, stopText)
void addFormattedLine(doc, line)
int countTableColumns(line_no) const
void startBlock(doc, line)
static long findNextIndexRefAssist(text, pos, chardepth, allowedNonAlphanum, assistText)

#include <WikiDocument.h >

Super class: TextFile

Summary

Manage a wiki document as a whole files.

There are methods to add wiki content, but in particular there are methods to manage blocks of wiki content by section/subsection.

Public Methods

WikiDocument(filename)

const string& filename

filename to load

Default value: ""


Construct a WikiDocument.  Optoinally load file from filename provided

inline void clear()

Reset the WikiDocument back to an empty document

inline WikiDocument& setWikiPath(path)

const string& path


Configuration control

inline WikiDocument& setLinkExtension(fileExtension)

const string& fileExtension


default .html

bool allow

Default value: true


inline WikiDocument& setDefaultParagraphStyle(paragraphStyle)

const string& paragraphStyle


inline string getDefaultParagraphStyle() const

bool isHeader(line_no) const

int line_no

Default value: 0


formatting testing

int getHeaderDepth(line_no) const

int line_no

Default value: 0


int setHeaderDepth(depth, line_no)

int depth

int line_no

Default value: 0


string getHeaderTitle(line_no) const

int line_no

Default value: 0


bool isBullet(line_no) const

int line_no

Default value: 0


int getBulletDepth(line_no) const

int line_no

Default value: 0


bool isNumberedItem(line_no) const

int line_no

Default value: 0


int getNumberedDepth(line_no) const

int line_no


bool isIndented(line_no) const

int line_no


int getIndentDepth(line_no) const

int line_no


bool isCodeLine(line_no) const

int line_no

Default value: 0


bool isTableStart(line_no) const

int line_no

Default value: 0


bool isTableCaption(line_no) const

int line_no

Default value: 0


bool isTableNewRow(line_no) const

int line_no

Default value: 0


bool isTableData(line_no) const

int line_no

Default value: 0


bool isTableEnd(line_no) const

int line_no

Default value: 0


inline bool isTablePart(line_no) const

int line_no


bool isHorizontalLine(line_no) const

int line_no

Default value: 0


inline bool insertHeader(title, depth, line_no)

const string& title

int depth

int line_no

Default value: 0


inserting/creating formatted lines

inline bool insertBullet(text, line_no, depth)

const string& text

int line_no

Default value: 0

int depth

Default value: 1


inline bool insertNumberedItem(text, line_no, depth)

const string& text

int line_no

Default value: 0

int depth

Default value: 1


inline bool insertCodeLine(text, line_no)

const string& text

int line_no

Default value: 0


bool insertTable(rows, columns, line_no, headings)

int rows

int columns

int line_no

Default value: 0

const StringSet& headings

Default value: StringSet("")


inline bool insertHorizontalLine(line_no)

int line_no

Default value: 0


static inline string italic(text)

const string& text


static inline string bold(text)

const string& text


inline int findNextHeader(line_no) const

int line_no

Default value: 0


document block navigation

int findNextHeader(title, line_no) const

const string& title

int line_no

Default value: 0


vector <string > getTitles(depth, line_no) const

int depth

Default value: 1

int line_no

Default value: 1


vector <string > getSubTitles(parentTitle, depth, line_no) const

const string& parentTitle

int depth

Default value: 1

int line_no

Default value: 1


vector <string > getAllTitles() const

HashArray getTitleLines(depth, line_no) const

int depth

Default value: 1

int line_no

Default value: 1


key=line# value=title

HashArray getSubTitleLines(parentTitle, depth, line_no) const

const string& parentTitle

int depth

Default value: 1

int line_no

Default value: 1


key=line# value=title

HashArray getAllTitleLines() const

key=line# value=title

HashArray getTitleDepth(depth, line_no) const

int depth

Default value: 1

int line_no

Default value: 1


key=title value=depth

HashArray getSubTitleDepth(parentTitle, depth, line_no) const

const string& parentTitle

int depth

Default value: 1

int line_no

Default value: 1


key=title value=depth

HashArray getAllTitleDepth() const

key=title value=depth

inline int findTitle(title, depth, line_no) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1


int findSubTitle(parentTitle, parentDepth, title, depth, line_no) const

const string& parentTitle

int parentDepth

const string& title

int depth

Default value: 0

int line_no

Default value: 1


int getStartOfBlockLine(line_no) const

int line_no


int getEndOfBlockLine(line_no, includeSubBlocks) const

int line_no

Default value: 1

bool includeSubBlocks

Default value: true


int getBlockSize(line_no, includeSubBlocks) const

int line_no

Default value: 1

bool includeSubBlocks

Default value: true


includes start line

int getBlockSize(title, depth, line_no, includeSubBlocks) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1

bool includeSubBlocks

Default value: true


includes start line

int getBlockSize(parentTitle, depth, title, line_no, includeSubBlocks) const

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1

bool includeSubBlocks

Default value: true


includes start line

bool titleExists(title, depth, line_no) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1


bool subTitleExists(parentTitle, depth, title, line_no) const

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1


bool contentExists(title, depth, line_no) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1


bool contentExists(parentTitle, depth, title, line_no) const

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1


string getTextBlock(line_no, includeSubBlocks, includeTitle, shiftHeadersLeft) const

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool includeTitle

Default value: false

bool shiftHeadersLeft

Default value: true


text blocks

string getTextBlock(title, depth, line_no, includeSubBlocks, includeTitle, shiftHeadersLeft) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool includeTitle

Default value: false

bool shiftHeadersLeft

Default value: true


string getTextBlock(parentTitle, depth, title, line_no, includeSubBlocks, includeTitle, shiftHeadersLeft) const

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool includeTitle

Default value: false

bool shiftHeadersLeft

Default value: true


int replaceTextBlock(text, line_no, includeSubBlocks, shiftHeadersRight)

const string& text

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool shiftHeadersRight

Default value: true


int replaceTextBlock(text, title, depth, line_no, includeSubBlocks, shiftHeadersRight)

const string& text

const string& title

int depth

Default value: 0

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool shiftHeadersRight

Default value: true


int replaceTextBlock(text, parentTitle, depth, title, line_no, includeSubBlocks, shiftHeadersRight)

const string& text

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool shiftHeadersRight

Default value: true


bool removeTextBlock(line_no, includeSubBlocks, includeTitle)

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool includeTitle

Default value: false


bool removeTextBlock(title, depth, line_no, includeSubBlocks, includeTitle)

const string& title

int depth

Default value: 0

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool includeTitle

Default value: false


bool removeTextBlock(parentTitle, depth, title, line_no, includeSubBlocks, includeTitle)

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1

bool includeSubBlocks

Default value: true

bool includeTitle

Default value: false


int insertTextBlock(newTitle, depth, text, line_no, shiftHeadersRight)

const string& newTitle

int depth

const string& text

Default value: ""

int line_no

Default value: 1

bool shiftHeadersRight

Default value: true


int insertTextBlockAfter(peerTitle, depth, newTitle, text, line_no, shiftHeadersRight)

const string& peerTitle

int depth

const string& newTitle

const string& text

Default value: ""

int line_no

Default value: 1

bool shiftHeadersRight

Default value: true


int insertTextBlockBefore(peerTitle, depth, newTitle, text, line_no, shiftHeadersRight)

const string& peerTitle

int depth

const string& newTitle

const string& text

Default value: ""

int line_no

Default value: 1

bool shiftHeadersRight

Default value: true


int appendTextSubBlock(parentTitle, depth, newTitle, text, line_no, shiftHeadersRight)

const string& parentTitle

int depth

const string& newTitle

const string& text

Default value: ""

int line_no

Default value: 1

bool shiftHeadersRight

Default value: true


inline int findNextTable(line_no, insideSameBlock) const

int line_no

Default value: 0

bool insideSameBlock

Default value: false


document table navigation

int findNextTable(title, line_no, insideSameBlock) const

const string& title

int line_no

Default value: 0

bool insideSameBlock

Default value: false


vector <string > getTables(depth, line_no) const

int depth

Default value: 1

int line_no

Default value: 1


vector <string > getSubTables(parentTitle, depth, line_no) const

const string& parentTitle

int depth

Default value: 1

int line_no

Default value: 1


vector <string > getAllTables() const

HashArray getTableLines(depth, line_no) const

int depth

Default value: 1

int line_no

Default value: 1


key=line# value=title

HashArray getSubTableLines(parentTitle, depth, line_no) const

const string& parentTitle

int depth

Default value: 1

int line_no

Default value: 1


key=line# value=title

HashArray getAllTableLines() const

key=line# value=title

inline int findTable(title, depth, line_no) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1


int findSubTable(parentTitle, parentDepth, title, depth, line_no) const

const string& parentTitle

int parentDepth

const string& title

int depth

Default value: 0

int line_no

Default value: 1


int getEndOfTableLine(line_no) const

int line_no

Default value: 1


int getTableSize(line_no) const

int line_no

Default value: 1


includes table start line

bool tableExists(title, depth, line_no) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1


bool tableExists(parentTitle, depth, title, line_no) const

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1


WikiDocTable getTable(line_no) const

int line_no

Default value: 1


table blocks

WikiDocTable getTable(title, depth, line_no) const

const string& title

int depth

Default value: 0

int line_no

Default value: 1


WikiDocTable getTable(parentTitle, depth, title, line_no) const

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1


int replaceTable(table, line_no)

const WikiDocTable& table

int line_no

Default value: 1


int replaceTable(table, title, depth, line_no)

const WikiDocTable& table

const string& title

int depth

Default value: 0

int line_no

Default value: 1


int replaceTable(table, parentTitle, depth, title, line_no)

const WikiDocTable& table

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1


bool removeTable(line_no)

int line_no

Default value: 1


bool removeTable(title, depth, line_no)

const string& title

int depth

Default value: 0

int line_no

Default value: 1


bool removeTable(parentTitle, depth, title, line_no)

const string& parentTitle

int depth

const string& title

int line_no

Default value: 1


int insertTable(newTitle, depth, table, line_no)

const string& newTitle

int depth

const WikiDocTable& table

int line_no

Default value: 1


int insertTableAfter(peerTitle, depth, newTitle, table, line_no)

const string& peerTitle

int depth

const string& newTitle

const WikiDocTable& table

int line_no

Default value: 1


int insertTableBefore(peerTitle, depth, newTitle, table, line_no)

const string& peerTitle

int depth

const string& newTitle

const WikiDocTable& table

int line_no

Default value: 1


int appendTable(parentTitle, depth, newTitle, table, line_no)

const string& parentTitle

int depth

const string& newTitle

const WikiDocTable& table

int line_no

Default value: 1


WikiDocument& shiftHeaders(amount, start_line_no, end_line_no)

int amount

int start_line_no

Default value: 0

int end_line_no

Default value: 0


inline WikiDocument& promoteHeaders(start_line_no, end_line_no)

int start_line_no

Default value: 0

int end_line_no

Default value: 0


inline WikiDocument& demoteHeaders(start_line_no, end_line_no)

int start_line_no

Default value: 0

int end_line_no

Default value: 0


static HashArray getIndexRefAssists(text, chardepth, allowedNonAlphanum)

const string& text

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


Check for index-assist references, e.g. @Ancenon or @"Ancenon"

static int convertIndexRefAssists(text, showtext, refs, indexName, chardepth, allowedNonAlphanum, createElementType)

string& text

const HashArray& showtext

const HashArray& refs

const HashArray& indexName

Default value: HashArray("")

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".-"

const string& createElementType

Default value: "link"


Convert index-assist refrences to wiki-formatted references, e.g. @Ancenon - > Ancenon

static HashArray getMentions(text, mentionXref, chardepth, allowedNonAlphanum)

const string& text

const HashArray& mentionXref

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


Determine which mentions are in the text

static HashArray getDanglingMentions(text, mentionXref, chardepth, allowedNonAlphanum)

const string& text

const HashArray& mentionXref

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


inline HashArray getMentions(mentionXref, chardepth, allowedNonAlphanum) const

const HashArray& mentionXref

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


inline HashArray getDanglingMentions(mentionXref, chardepth, allowedNonAlphanum) const

const HashArray& mentionXref

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


static int convertMentions(text, mentionXref, chardepth, allowedNonAlphanum)

string& text

const HashArray& mentionXref

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


(Alters document) Convert @mentions to link

inline int convertMentions(mentionXref, chardepth, allowedNonAlphanum)

const HashArray& mentionXref

int chardepth

Default value: 30

const string& allowedNonAlphanum

Default value: ".- '"


static string titleToLinkName(title)

string title


Convert a wiki page title to a link or filename

static bool wikiPageExists(title)

string title


check if a page by this title exists

WikiDocumentCB* setMetaCommandCB(cbfn, cbdata)

WikiDocumentCB* cbfn

void* cbdata


inline string getText() const

Handle the full text

inline void setText(text)

const string& text


Document& toDocument(doc, line)

Document& doc

const string& line


Create a Document from the wiki content

Document& toDocument(doc)

Document& doc


Document toDocument()

inline string toHTML(fulldoc)

bool fulldoc

Default value: true


inline const StringSet& getReferencedExternalExistingPages() const

Call toDocument first

inline const StringSet& getReferencedExternalNonExistingPages() const

static int countCharRepeats(text)

const string& text


misc utilities

Private Properties

string defaultParagraphStyle

StringSet refPages

referenced and exists

StringSet undefPages

referenced and exists

undefPages; undefPages

referenced and does not exit

static WikiDocumentCB* metacbfn

callback for metacommand processing

static void* metacbdata

callbad data for metacommand processing

static string wikipath

default: /usr/mae/html/doc

static string linkExtension

default: .html

static bool allowWikiLinks

default: true


Private Methods

void checkIfPageExists(title)

string title


Methods used by toDocument()

int splitLine(ppart, pos0, pretext, text, posttext, style, link, metacommand, anchor)

vector <ParagraphPart >& ppart

int pos0

const string& pretext

const string& text

const string& posttext

const string& style

const string& link

Default value: ""

const string& metacommand

Default value: ""

const string& anchor

Default value: ""


void extractStyle(ppart, startText, stopText, style)

vector <ParagraphPart >& ppart

const string& startText

const string& stopText

const string& style


void extractBookmarks(ppart, startText, stopText)

vector <ParagraphPart >& ppart

const string& startText

const string& stopText


vector <ParagraphPart >& ppart

const string& startText

const string& stopText

bool externalRef


void processMetacommands(ppart, startText, stopText)

vector <ParagraphPart >& ppart

const string& startText

const string& stopText


void addFormattedLine(doc, line)

Document& doc

string& line


int countTableColumns(line_no) const

int line_no

Default value: 0


void startBlock(doc, line)

Document& doc

string& line


static long findNextIndexRefAssist(text, pos, chardepth, allowedNonAlphanum, assistText)

const string& text

long pos

int chardepth

const string& allowedNonAlphanum

string& assistText