NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <vector>
#include <map>
#include <fstream>
#include "documentation.hpp"
#include "../../kernel.hpp"
#include "../datamanagement/database.hpp"
#include "../ui/error.hpp"
#include "../utils/tools.hpp"
#include "../../syntax.hpp"
Go to the source code of this file.
Macros | |
#define | FILE_CODEBLOCK_START "<div class=\"sites-codeblock sites-codesnippet-block\"><CODE><span style=\"color:#00008B;\">\n" |
#define | FILE_CODEBLOCK_END "</span></CODE></div>\n" |
#define | VIEWER_CODEBLOCK_START "<center><table border=\"0\" cellspacing=\"0\" bgcolor=\"#F2F2F2\" width=\"94%\">\n<tbody><tr><td>\n<CODE><span style=\"color:#00008B;\">\n" |
#define | VIEWER_CODEBLOCK_END "\n</span></CODE></td></tr></tbody></table></center>\n" |
Functions | |
static bool | isValue (const std::string &sExpr, size_t nPos, size_t nLength) |
Static helper function for doc_ReplaceExprContentForHTML to determine literal values in expressions. More... | |
static bool | isOperator (const std::string &sExpr, size_t nPos, size_t nLength) |
Static helper function for doc_ReplaceExprContentForHTML to determine operators in expressions. More... | |
static bool | isFunction (const std::string &sExpr, size_t nPos, size_t nLength) |
Static helper function for doc_ReplaceExprContentForHTML to determine functions in expressions. More... | |
static void | doc_ReplaceExprContentForHTML (std::string &sExpr, Settings &_option) |
This function replaces tokens in <expr>-tags to improve the readability of mathematical code. More... | |
static void | doc_ReplaceTokensForHTML (std::string &sDocParagraph, bool generateFile, Settings &_option) |
Searches for defined XML tokens in the passed string and replaces them with the plain HTML counterpart. More... | |
void | doc_Help (const std::string &__sTopic, Settings &_option) |
This function shows the content of a documentation article based upon the passed topic. The content is displayed in terminal or in an external window (depending on the settings) or directly written to an HTML file (depending on an additional parameter). More... | |
static std::string | createCssString (int style, const Settings &_option) |
This static function creates the CSS string for the span element containing the lexed symbol. The passed style is mapped to the settings, so that the syntax colours are somewhat similar to the ones selected by the user. More... | |
static std::string | applySyntaxHighlighting (const std::string &sCodeString, const Settings &_option) |
This static function lexes the passed code string usign a static instance of the NumeReSyntax class. More... | |
static std::string | getHighlightedCode (std::string sCode, bool verbatim, Settings &_option) |
Returns the final HTML string containing the already lexed and highlighted code. More... | |
static std::string | formatCodeBlock (std::string sCode, bool generateFile, bool verbatim, Settings &_option) |
Returns the final HTML string containing the lexed and highlighted code and embeds that into the code block environment. More... | |
std::string | doc_HelpAsHTML (const std::string &__sTopic, bool generateFile, Settings &_option) |
This function returns the documentation article for the selected topic as an HTML std::string. This std::string either may be used to create a corresponding file or it may be displayed in the documentation viewer. More... | |
void | doc_SearchFct (const std::string &sToLookFor, Settings &_option) |
This function provides the logic for searching for entries in the keywords database. More... | |
#define FILE_CODEBLOCK_END "</span></CODE></div>\n" |
Definition at line 889 of file documentation.cpp.
#define FILE_CODEBLOCK_START "<div class=\"sites-codeblock sites-codesnippet-block\"><CODE><span style=\"color:#00008B;\">\n" |
Definition at line 888 of file documentation.cpp.
#define VIEWER_CODEBLOCK_END "\n</span></CODE></td></tr></tbody></table></center>\n" |
Definition at line 892 of file documentation.cpp.
#define VIEWER_CODEBLOCK_START "<center><table border=\"0\" cellspacing=\"0\" bgcolor=\"#F2F2F2\" width=\"94%\">\n<tbody><tr><td>\n<CODE><span style=\"color:#00008B;\">\n" |
Definition at line 891 of file documentation.cpp.
|
static |
This static function lexes the passed code string usign a static instance of the NumeReSyntax class.
sCodeString | const std::string& |
_option | const Settings& |
Definition at line 797 of file documentation.cpp.
References createCssString(), Settings::getExePath(), NumeReKernel::getInstance(), NumeReKernel::getPluginCommands(), NumeReSyntax::highlightLine(), replaceAll(), and NumeReSyntax::SYNTAX_OPERATOR.
Referenced by getHighlightedCode().
|
static |
This static function creates the CSS string for the span element containing the lexed symbol. The passed style is mapped to the settings, so that the syntax colours are somewhat similar to the ones selected by the user.
style | int |
_option | const Settings& |
Definition at line 718 of file documentation.cpp.
References Settings::getSetting(), replaceAll(), SETTING_S_ST_COMMAND, SETTING_S_ST_COMMENT, SETTING_S_ST_CONSTANT, SETTING_S_ST_FUNCTION, SETTING_S_ST_METHODS, SETTING_S_ST_NUMBER, SETTING_S_ST_OPERATOR, SETTING_S_ST_OPTION, SETTING_S_ST_PROCEDURE, SETTING_S_ST_SPECIALVAL, SETTING_S_ST_STRING, SettingsValue::stringval(), NumeReSyntax::SYNTAX_COMMAND, NumeReSyntax::SYNTAX_COMMENT, NumeReSyntax::SYNTAX_CONSTANT, NumeReSyntax::SYNTAX_FUNCTION, NumeReSyntax::SYNTAX_METHODS, NumeReSyntax::SYNTAX_NUMBER, NumeReSyntax::SYNTAX_OPERATOR, NumeReSyntax::SYNTAX_OPTION, NumeReSyntax::SYNTAX_PROCEDURE, NumeReSyntax::SYNTAX_SPECIALVAL, and NumeReSyntax::SYNTAX_STRING.
Referenced by applySyntaxHighlighting().
void doc_Help | ( | const std::string & | __sTopic, |
Settings & | _option | ||
) |
This function shows the content of a documentation article based upon the passed topic. The content is displayed in terminal or in an external window (depending on the settings) or directly written to an HTML file (depending on an additional parameter).
__sTopic | const std::string& |
_option | Settings& |
Definition at line 302 of file documentation.cpp.
References _lang, SyntaxError::CANNOT_GENERATE_FILE, FileSystem::declareFileType(), doc_HelpAsHTML(), eraseToken(), findParameter(), Language::get(), Documentation::getHelpArticle(), Documentation::getHelpArticleID(), Documentation::getHelpArticleTitle(), Documentation::getHelpIdxKey(), SyntaxError::invalid_position, LineBreak(), make_hline(), NumeReKernel::print(), NumeReKernel::setDocumentation(), StripSpaces(), toLowerCase(), and FileSystem::ValidizeAndPrepareName().
Referenced by cmd_datagrid(), cmd_define(), cmd_diff(), cmd_edit(), cmd_eval(), cmd_extrema(), cmd_find(), cmd_fit(), cmd_get(), cmd_help(), cmd_ifndefined(), cmd_load(), cmd_new(), cmd_odesolve(), cmd_plotting(), cmd_pulse(), cmd_read(), cmd_redefine(), cmd_set(), cmd_spline(), cmd_stfa(), cmd_taylor(), cmd_undefine(), cmd_warn(), cmd_window(), cmd_write(), and cmd_zeroes().
std::string doc_HelpAsHTML | ( | const std::string & | __sTopic, |
bool | generateFile, | ||
Settings & | _option | ||
) |
This function returns the documentation article for the selected topic as an HTML std::string. This std::string either may be used to create a corresponding file or it may be displayed in the documentation viewer.
__sTopic | const std::string& |
generateFile | bool |
_option | Settings& |
Definition at line 932 of file documentation.cpp.
References _lang, doc_ReplaceExprContentForHTML(), doc_ReplaceTokensForHTML(), FILE_CODEBLOCK_END, FILE_CODEBLOCK_START, formatCodeBlock(), Language::get(), Documentation::getArgAtPos(), Documentation::getHelpArticle(), getHighlightedCode(), StripSpaces(), toUpperCase(), VIEWER_CODEBLOCK_END, and VIEWER_CODEBLOCK_START.
Referenced by doc_Help(), and NumeReKernel::getDocumentation().
|
static |
This function replaces tokens in <expr>-tags to improve the readability of mathematical code.
sExpr | std::string& |
_option | Settings& |
Definition at line 92 of file documentation.cpp.
References getMatchingParenthesis(), isFunction(), isOperator(), isValue(), and NumeRe::DataBase::size().
Referenced by doc_HelpAsHTML(), and doc_ReplaceTokensForHTML().
|
static |
Searches for defined XML tokens in the passed string and replaces them with the plain HTML counterpart.
sDocParagraph | std::string& |
generateFile | bool |
_option | Settings& |
Definition at line 201 of file documentation.cpp.
References doc_ReplaceExprContentForHTML(), Documentation::getArgAtPos(), Settings::getExePath(), NumeReKernel::getFileSystem(), NumeReKernel::getInstance(), Settings::getLoadPath(), Settings::getPlotPath(), Settings::getProcPath(), Settings::getSavePath(), Settings::getScriptPath(), replacePathSeparator(), and FileSystem::ValidFileName().
Referenced by doc_HelpAsHTML(), and formatCodeBlock().
void doc_SearchFct | ( | const std::string & | sToLookFor, |
Settings & | _option | ||
) |
This function provides the logic for searching for entries in the keywords database.
sToLookFor | const std::string& |
_option | Settings& |
Definition at line 1352 of file documentation.cpp.
References _lang, NumeRe::DataBase::addData(), fileExists(), NumeRe::DataBase::findRecordsUsingRelevance(), Language::get(), NumeRe::DataBase::getElement(), Settings::getExePath(), intCast(), make_hline(), NumeReKernel::print(), NumeReKernel::printPreFmt(), replacePathSeparator(), NumeRe::DataBase::size(), sVersion, NumeReKernel::toggleTableStatus(), toString(), toSystemCodePage(), toUpperCase(), Settings::useCustomLangFiles(), and FileSystem::ValidFileName().
Referenced by cmd_find().
|
static |
Returns the final HTML string containing the lexed and highlighted code and embeds that into the code block environment.
sCode | std::string |
generateFile | bool |
verbatim | bool |
_option | Settings& |
Definition at line 907 of file documentation.cpp.
References doc_ReplaceTokensForHTML(), FILE_CODEBLOCK_END, FILE_CODEBLOCK_START, getHighlightedCode(), VIEWER_CODEBLOCK_END, and VIEWER_CODEBLOCK_START.
Referenced by doc_HelpAsHTML().
|
static |
Returns the final HTML string containing the already lexed and highlighted code.
sCode | std::string |
verbatim | bool |
_option | Settings& |
Definition at line 863 of file documentation.cpp.
References applySyntaxHighlighting(), and replaceAll().
Referenced by doc_HelpAsHTML(), and formatCodeBlock().
|
static |
Static helper function for doc_ReplaceExprContentForHTML to determine functions in expressions.
sExpr | const std::string& |
nPos | size_t |
nLength | size_t |
Definition at line 76 of file documentation.cpp.
Referenced by doc_ReplaceExprContentForHTML().
|
static |
Static helper function for doc_ReplaceExprContentForHTML to determine operators in expressions.
sExpr | const std::string& |
nPos | size_t |
nLength | size_t |
Definition at line 59 of file documentation.cpp.
Referenced by doc_ReplaceExprContentForHTML().
|
static |
Static helper function for doc_ReplaceExprContentForHTML to determine literal values in expressions.
sExpr | const std::string& |
nPos | size_t |
nLength | size_t |
Definition at line 42 of file documentation.cpp.
Referenced by doc_ReplaceExprContentForHTML().