23#include "../../kernel.hpp"
24#include "../datamanagement/database.hpp"
25#include "../ui/error.hpp"
26#include "../utils/tools.hpp"
27#include "../../syntax.hpp"
42static bool isValue(
const std::string& sExpr,
size_t nPos,
size_t nLength)
44 return (!nPos || !isalpha(sExpr[nPos-1])) && (nPos+nLength == sExpr.length() || !isalpha(sExpr[nPos+nLength]));
59static bool isOperator(
const std::string& sExpr,
size_t nPos,
size_t nLength)
76static bool isFunction(
const std::string& sExpr,
size_t nPos,
size_t nLength)
78 return (!nPos || !isalpha(sExpr[nPos-1])) && sExpr[nPos+nLength] ==
'(';
99 if (sExpr.find(
"<exprblock>") != std::string::npos)
100 nPos = sExpr.find(
"<exprblock>")+11;
104 for (
size_t i = nPos; i < sExpr.length(); i++)
109 if (sExpr.substr(i, 12) ==
"</exprblock>")
111 if (sExpr.find(
"<exprblock>", i+12) != std::string::npos)
113 i = sExpr.find(
"<exprblock>", i+12) + 10;
121 for (
size_t n = 0; n < HTMLEntitiesDB.
size(); n++)
123 if (sExpr.substr(i, HTMLEntitiesDB[n][0].length()) == HTMLEntitiesDB[n][0]
124 && ((HTMLEntitiesDB[n][2] ==
"OP" &&
isOperator(sExpr, i, HTMLEntitiesDB[n][0].length()))
125 || (HTMLEntitiesDB[n][2] ==
"VAL" &&
isValue(sExpr, i, HTMLEntitiesDB[n][0].length()))
126 || (HTMLEntitiesDB[n][2] ==
"FCT" &&
isFunction(sExpr, i, HTMLEntitiesDB[n][0].length())))
129 sExpr.replace(i, HTMLEntitiesDB[n][0].length(), HTMLEntitiesDB[n][1]);
130 i += HTMLEntitiesDB[n][1].length()-1;
137 if (sExpr[i+1] ==
'(')
140 sExpr.replace(i, 2,
"<sup>");
144 sExpr.insert(i+2,
"</sup>");
145 sExpr.replace(i, 1,
"<sup>");
155 if (sExpr[i+1] ==
'(')
158 sExpr.replace(i, 2,
"<sub>");
162 sExpr.insert(i+2,
"</sub>");
163 sExpr.replace(i, 1,
"<sub>");
171 if (sExpr[i] ==
',' && sExpr[i+1] !=
' ')
172 sExpr.insert(i+1, 1,
' ');
176 if (i < sExpr.length()-1 && isdigit(sExpr[i+1]) && isalpha(sExpr[i]))
178 if (i < sExpr.length()-2)
179 sExpr.insert(i+2,
"</sub>");
181 sExpr.append(
"</sub>");
183 sExpr.insert(i+1,
"<sub>");
203 for (
unsigned int k = 0; k < sDocParagraph.length(); k++)
205 if (sDocParagraph.substr(k,2) ==
"\\$")
206 sDocParagraph.erase(k,1);
208 if (sDocParagraph.substr(k,3) ==
"\\\\n")
209 sDocParagraph.erase(k,1);
211 if (sDocParagraph.substr(k,2) ==
" ")
212 sDocParagraph.replace(k,1,
" ");
214 if (sDocParagraph.substr(k,4) ==
"<em>" && sDocParagraph.find(
"</em>", k+4) != std::string::npos)
216 sDocParagraph.insert(k+4,
"<strong>");
217 sDocParagraph.insert(sDocParagraph.find(
"</em>", k+12),
"</strong>");
220 if (sDocParagraph.substr(k,3) ==
"<h>" && sDocParagraph.find(
"</h>", k+3) != std::string::npos)
222 sDocParagraph.replace(k, 3,
"<h4>");
223 sDocParagraph.replace(sDocParagraph.find(
"</h>",k+4), 4,
"</h4>");
226 if (sDocParagraph.substr(k,6) ==
"<expr>" && sDocParagraph.find(
"</expr>", k+6) != std::string::npos)
228 std::string sExpr = sDocParagraph.substr(k+6, sDocParagraph.find(
"</expr>", k+6)-k-6);
230 sDocParagraph.replace(k,
231 sDocParagraph.find(
"</expr>",k+6)+7-k,
232 "<span style=\"font-style:italic; font-family: palatino linotype; font-weight: bold;\">"+sExpr+
"</span>");
235 if (sDocParagraph.substr(k,6) ==
"<code>" && sDocParagraph.find(
"</code>", k+6) != std::string::npos)
237 sDocParagraph.insert(k+6,
"<span style=\"color:#00008B;background-color:#F2F2F2;\">");
238 sDocParagraph.insert(sDocParagraph.find(
"</code>", k+6),
"</span>");
239 std::string sCode = sDocParagraph.substr(k+6, sDocParagraph.find(
"</code>", k+6)-k-6);
241 for (
unsigned int i = 0; i < sCode.length(); i++)
243 if (sCode.substr(i,2) ==
"\\n")
244 sCode.replace(i,2,
"<br>");
250 if (sDocParagraph.substr(k,5) ==
"<img " && sDocParagraph.find(
"/>", k+5) != std::string::npos)
252 std::string sImg = sDocParagraph.substr(k, sDocParagraph.find(
"/>", k+5)+2-k);
254 if (sImg.find(
"src") != std::string::npos)
258 sImg =
"<img src=\"" + sImgSrc +
"\" />";
259 sImg =
"<div align=\"center\">" + sImg +
"</div>";
264 sDocParagraph.replace(k, sDocParagraph.find(
"/>", k+5)+2-k, sImg);
268 if (sDocParagraph.substr(k, 10) ==
"&PLOTPATH&")
271 if (sDocParagraph.substr(k, 10) ==
"&LOADPATH&")
274 if (sDocParagraph.substr(k, 10) ==
"&SAVEPATH&")
277 if (sDocParagraph.substr(k, 10) ==
"&PROCPATH&")
280 if (sDocParagraph.substr(k, 12) ==
"&SCRIPTPATH&")
283 if (sDocParagraph.substr(k, 9) ==
"&EXEPATH&")
312 if (!sTopic.length())
315 if (sTopic.front() ==
'-')
320 std::vector<std::string> vDocArticle = _option.
getHelpArticle(sTopic);
322 if (vDocArticle[0] ==
"NO_ENTRY_FOUND")
331 std::string sHTML =
doc_HelpAsHTML(sTopic, generateFile, _option);
338 fHTML.open(sFilename);
720 std::string sSettingsString;
765 std::string sCssString =
"color: rgb(" + sSettingsString.substr(0, sSettingsString.find(
'-')) +
");";
766 std::string sBackgroundColor = sSettingsString.substr(sSettingsString.find(
'-')+1,
767 sSettingsString.rfind(
'-')-sSettingsString.find(
'-')-1);
769 sSettingsString.erase(0, sSettingsString.rfind(
'-')+1);
771 if (sSettingsString[0] ==
'1')
772 sCssString +=
" font-weight: bold;";
774 if (sSettingsString[1] ==
'1')
775 sCssString +=
" font-style: italic;";
777 if (sSettingsString[2] ==
'1')
778 sCssString +=
" text-decoration: underline;";
780 if (sSettingsString[3] ==
'0')
781 sCssString +=
" background-color: rgb(" + sBackgroundColor +
");";
800 std::string sStyleBytes;
801 std::string sStyledString;
803 if (sCodeString.front() !=
'|')
804 sStyleBytes = _syntax.
highlightLine(
"|<- " + sCodeString +
" ").substr(4);
808 size_t nLastPos = sStyleBytes.length();
809 size_t nLastStatePosition = 0;
811 for (
size_t i = 0; i < nLastPos; i++)
813 if (sStyleBytes[i] != sStyleBytes[nLastStatePosition] || i+1 == nLastPos)
815 int style = sStyleBytes[nLastStatePosition] -
'0';
816 std::string textRange;
819 textRange = sCodeString.substr(nLastStatePosition, i+1-nLastStatePosition);
821 textRange = sCodeString.substr(nLastStatePosition, i-nLastStatePosition);
823 if (textRange.find_first_not_of(
" \r\t\n") == std::string::npos)
825 sStyledString += textRange;
826 nLastStatePosition = i;
838 if (sCssString.length())
839 sStyledString +=
"<span style=\"" + sCssString +
"\">" + textRange +
"</span>";
841 sStyledString += textRange;
843 nLastStatePosition = i;
848 return sStyledString;
872 replaceAll(sCode,
"\\t ",
" ");
874 if (sCode.substr(0, 4) ==
"|<- ")
875 sCode.replace(1, 1,
"<");
877 if (sCode.substr(0, 4) ==
"|-> ")
878 sCode.replace(2, 1,
">");
881 replaceAll(sCode,
"\\t",
" ");
888#define FILE_CODEBLOCK_START "<div class=\"sites-codeblock sites-codesnippet-block\"><CODE><span style=\"color:#00008B;\">\n"
889#define FILE_CODEBLOCK_END "</span></CODE></div>\n"
891#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"
892#define VIEWER_CODEBLOCK_END "\n</span></CODE></td></tr></tbody></table></center>\n"
934 std::string sTopic = __sTopic;
938 std::vector<std::string> vDocArticle = _option.
getHelpArticle(sTopic);
940 if (vDocArticle[0] ==
"NO_ENTRY_FOUND")
943 bool isIndex = (vDocArticle[0] ==
"Index");
947 sHTML =
"<!DOCTYPE html>\n<html>\n<head>\n";
952 for (
unsigned int i = 0; i < vDocArticle.size(); i++)
965 +
"<!-- START COPYING HERE -->\n";
966 sHTML +=
"<h4>" +
_lang.
get(
"DOC_HELP_DESC_HEADLINE") +
"</h4>\n";
971 sHTML +=
"<title>" + vDocArticle[i] +
"</title>\n</head>\n\n<body>\n<h2>"+vDocArticle[i]+
"</h2>\n";
980 if (vDocArticle[i].find(
"<example ") != std::string::npos)
982 sHTML +=
"<h4>"+
_lang.
get(
"DOC_HELP_EXAMPLE_HEADLINE") +
"</h4>\n";
984 bool bCodeBlock =
false;
990 if (vDocArticle[i].find(
"type=") &&
Documentation::getArgAtPos(vDocArticle[i], vDocArticle[i].find(
"type=")+5) ==
"codeblock")
1001 sHTML +=
"<p>" + sDescription +
"</p>\n";
1003 sHTML +=
"<p>" + sDescription +
"</p>\n";
1005 if (bCodeBlock || bPlain)
1007 std::string sCodeContent;
1009 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1011 if (vDocArticle[j].find(
"</example>") != std::string::npos)
1014 sHTML +=
formatCodeBlock(sCodeContent.substr(0, sCodeContent.length()-2), generateFile, bPlain, _option) +
"\n";
1018 sCodeContent += vDocArticle[j] +
"\\n";
1023 std::string sExample;
1025 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1027 if (vDocArticle[j].find(
"</example>") != std::string::npos)
1040 if (vDocArticle[j] ==
"[...]")
1042 sExample +=
"[...]<br>\n";
1048 if (((i+1) % 2 && j % 2) || (!((i+1) % 2) && !(j % 2)))
1049 sExample +=
"|<- " +
getHighlightedCode(vDocArticle[j],
false, _option) +
"<br>\n";
1052 sExample +=
"|-> " + vDocArticle[j] +
"<br>\n";
1054 if (vDocArticle[j+1].find(
"</example>") == std::string::npos)
1055 sExample +=
"|<br>\n";
1064 else if (vDocArticle[i].find(
"<exprblock>") != std::string::npos)
1066 if (vDocArticle[i].find(
"</exprblock>", vDocArticle[i].find(
"<exprblock>")) != std::string::npos)
1071 while (vDocArticle[i].find(
"</exprblock>", vDocArticle[i].find(
"<exprblock>")) != std::string::npos)
1073 std::string sExprBlock = vDocArticle[i].substr(vDocArticle[i].find(
"<exprblock>")+11, vDocArticle[i].find(
"</exprblock>")-vDocArticle[i].find(
"<exprblock>")-11);
1075 for (
unsigned int k = 0; k < sExprBlock.length(); k++)
1077 if (sExprBlock.substr(k,2) ==
"\\n")
1078 sExprBlock.replace(k,2,
"<br>");
1080 if (sExprBlock.substr(k,2) ==
"\\t")
1081 sExprBlock.replace(k,2,
" ");
1085 vDocArticle[i].replace(vDocArticle[i].find(
"<exprblock>"), vDocArticle[i].find(
"</exprblock>")+12-vDocArticle[i].find(
"<exprblock>"),
"</p><div style=\"font-style: italic;margin-left: 40px\">" + sExprBlock +
"</div><p>");
1087 vDocArticle[i].replace(vDocArticle[i].find(
"<exprblock>"), vDocArticle[i].find(
"</exprblock>")+12-vDocArticle[i].find(
"<exprblock>"),
"</p><blockquote><span style=\"font-style: italic; font-family: palatino linotype; font-size: 12pt; font-weight: bold;\">" + sExprBlock +
"</span></blockquote><p>");
1090 sHTML +=
"<p>" + (vDocArticle[i]) +
"</p>\n";
1094 if (vDocArticle[i] !=
"<exprblock>")
1095 sHTML +=
"<p>" + (vDocArticle[i].substr(0, vDocArticle[i].find(
"<exprblock>"))) +
"</p>\n";
1098 sHTML +=
"<div style=\"font-style: italic;margin-left: 40px\">\n";
1100 sHTML +=
"<blockquote><span style=\"font-style: italic; font-family: palatino linotype; font-size: 12pt; font-weight: bold;\">\n";
1102 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1104 if (vDocArticle[j].find(
"</exprblock>") != std::string::npos)
1109 sHTML +=
"</div>\n";
1112 sHTML.erase(sHTML.length()-5);
1113 sHTML +=
"\n</span></blockquote>\n";
1122 while (vDocArticle[j].find(
"\\t") != std::string::npos)
1123 vDocArticle[j].replace(vDocArticle[j].find(
"\\t"), 2,
" ");
1125 sHTML += (vDocArticle[j]) +
"<br>\n";
1129 else if (vDocArticle[i].find(
"<codeblock>") != std::string::npos)
1131 if (vDocArticle[i].find(
"</codeblock>", vDocArticle[i].find(
"<codeblock>")) != std::string::npos)
1133 while (vDocArticle[i].find(
"</codeblock>", vDocArticle[i].find(
"<codeblock>")) != std::string::npos)
1135 std::string sExprBlock = vDocArticle[i].substr(vDocArticle[i].find(
"<codeblock>")+11,
1136 vDocArticle[i].find(
"</codeblock>")-vDocArticle[i].find(
"<codeblock>")-11);
1138 vDocArticle[i].replace(vDocArticle[i].find(
"<codeblock>"),
1139 vDocArticle[i].find(
"</codeblock>")+12-vDocArticle[i].find(
"<codeblock>"),
1140 "</p>" +
formatCodeBlock(sExprBlock, generateFile,
false, _option) +
"<p>");
1144 sHTML +=
"<p>" + (vDocArticle[i]) +
"</p>\n";
1148 if (vDocArticle[i] !=
"<codeblock>")
1149 sHTML +=
"<p>" + (vDocArticle[i].substr(0, vDocArticle[i].find(
"<codeblock>"))) +
"</p>\n";
1151 std::string sCodeContent;
1153 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1155 if (vDocArticle[j].find(
"</codeblock>") != std::string::npos)
1158 sHTML +=
formatCodeBlock(sCodeContent.substr(0, sCodeContent.length()-2), generateFile,
false, _option) +
"\n";
1162 sCodeContent += vDocArticle[j] +
"\\n";
1166 else if (vDocArticle[i].find(
"<verbatim>") != std::string::npos)
1168 if (vDocArticle[i].find(
"</verbatim>", vDocArticle[i].find(
"<verbatim>")) != std::string::npos)
1170 while (vDocArticle[i].find(
"</verbatim>", vDocArticle[i].find(
"<verbatim>")) != std::string::npos)
1172 std::string sExprBlock = vDocArticle[i].substr(vDocArticle[i].find(
"<verbatim>")+10,
1173 vDocArticle[i].find(
"</verbatim>")-vDocArticle[i].find(
"<verbatim>")-10);
1175 vDocArticle[i].replace(vDocArticle[i].find(
"<verbatim>"),
1176 vDocArticle[i].find(
"</verbatim>")+11-vDocArticle[i].find(
"<verbatim>"),
1177 "</p>" +
formatCodeBlock(sExprBlock, generateFile,
true, _option) +
"<p>");
1181 sHTML +=
"<p>" + (vDocArticle[i]) +
"</p>\n";
1185 if (vDocArticle[i] !=
"<verbatim>")
1186 sHTML +=
"<p>" + (vDocArticle[i].substr(0, vDocArticle[i].find(
"<verbatim>"))) +
"</p>\n";
1188 std::string sCodeContent;
1190 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1192 if (vDocArticle[j].find(
"</verbatim>") != std::string::npos)
1195 sHTML +=
formatCodeBlock(sCodeContent.substr(0, sCodeContent.length()-2), generateFile,
true, _option) +
"\n";
1199 sCodeContent += vDocArticle[j] +
"\\n";
1203 else if (vDocArticle[i].find(
"<syntax>") != std::string::npos)
1205 if (vDocArticle[i].find(
"</syntax>", vDocArticle[i].find(
"<syntax>")) != std::string::npos)
1207 while (vDocArticle[i].find(
"</syntax>", vDocArticle[i].find(
"<syntax>")) != std::string::npos)
1209 std::string sExprBlock = vDocArticle[i].substr(vDocArticle[i].find(
"<syntax>")+8,
1210 vDocArticle[i].find(
"</syntax>")-vDocArticle[i].find(
"<syntax>")-8);
1212 vDocArticle[i].replace(vDocArticle[i].find(
"<syntax>"),
1213 vDocArticle[i].find(
"</syntax>")+9-vDocArticle[i].find(
"<syntax>"),
1214 "</p><h4>Syntax</h4>" +
formatCodeBlock(sExprBlock, generateFile,
false, _option)
1215 +
"<h4>" +
_lang.
get(
"DOC_HELP_DESC_HEADLINE") +
"</h4><p>");
1219 sHTML +=
"<p>" + vDocArticle[i] +
"</p>\n";
1223 if (vDocArticle[i] !=
"<syntax>")
1224 sHTML +=
"<p>" + (vDocArticle[i].substr(0, vDocArticle[i].find(
"<syntax>"))) +
"</p>\n";
1226 sHTML +=
"<h4>Syntax</h4>\n";
1227 std::string sCodeContent;
1229 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1231 if (vDocArticle[j].find(
"</syntax>") != std::string::npos)
1234 sHTML +=
formatCodeBlock(sCodeContent.substr(0, sCodeContent.length()-2), generateFile,
false, _option)
1235 +
"<h4>" +
_lang.
get(
"DOC_HELP_DESC_HEADLINE") +
"</h4>\n";
1239 sCodeContent += vDocArticle[j] +
"\\n";
1243 else if (vDocArticle[i].find(
"<list") != std::string::npos)
1247 sHTML +=
"<h4>"+
_lang.
get(
"DOC_HELP_OPTIONS_HEADLINE") +
"</h4>\n";
1248 sHTML +=
"<table style=\"border-collapse:collapse; border-color:rgb(136,136,136);border-width:1px\" border=\"1\" bordercolor=\"#888\" cellspacing=\"0\">\n <tbody>\n";
1252 sHTML +=
"<table border=\"1\" bordercolor=\"#888\" cellspacing=\"0\">\n <tbody>\n";
1255 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1257 if (vDocArticle[j].find(
"</list>") != std::string::npos)
1259 sHTML +=
" </tbody>\n</table>\n";
1271 sHTML +=
" <td style=\"width:200px;height:19px\"><code><span style=\"color:#00008B;\">"
1273 +
"</span></code></td>\n"
1274 +
" <td style=\"width:400px;height:19px\">"
1275 + (vDocArticle[j].substr(vDocArticle[j].find(
'>', vDocArticle[j].find(
"node=")+5+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5).length()+2)+1, vDocArticle[j].find(
"</item>")-1-vDocArticle[j].find(
'>', vDocArticle[j].find(
"node=")+5+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5).length()+2)))
1277 sHTML +=
" </tr>\n";
1283 sHTML +=
" <tr>\n <td width=\"200\"><a href=\"nhlp://"+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5)+
"?frame=self\"><code><span style=\"color:#00008B;\">"
1285 +
"</span></code></a></td>\n <td>"
1286 + vDocArticle[j].substr(vDocArticle[j].find(
'>', vDocArticle[j].find(
"node=")+5+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5).length()+2)+1, vDocArticle[j].find(
"</item>")-1-vDocArticle[j].find(
'>', vDocArticle[j].find(
"node=")+5+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5).length()+2))
1287 +
"</td>\n </tr>\n";
1291 sHTML +=
" <tr>\n <td width=\"200\"><code><span style=\"color:#00008B;\">"
1293 +
"</span></code></td>\n <td>"
1294 + vDocArticle[j].substr(vDocArticle[j].find(
'>', vDocArticle[j].find(
"node=")+5+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5).length()+2)+1, vDocArticle[j].find(
"</item>")-1-vDocArticle[j].find(
'>', vDocArticle[j].find(
"node=")+5+
Documentation::getArgAtPos(vDocArticle[j], vDocArticle[j].find(
"node=")+5).length()+2))
1295 +
"</td>\n </tr>\n";
1301 else if (vDocArticle[i].find(
"<table") != std::string::npos)
1304 sHTML +=
"<div align=\"center\"><table style=\"border-collapse:collapse; border-color:rgb(136,136,136);border-width:1px\" border=\"1\" bordercolor=\"#888\" cellspacing=\"0\">\n <tbody>\n";
1306 sHTML +=
"<div align=\"center\"><table border=\"1\" bordercolor=\"#888\" cellspacing=\"0\">\n <tbody>\n";
1308 for (
unsigned int j = i+1; j < vDocArticle.size(); j++)
1310 if (vDocArticle[j].find(
"</table>") != std::string::npos)
1312 sHTML +=
" </tbody>\n</table></div>\n";
1319 sHTML += vDocArticle[j] +
"\n";
1326 sHTML +=
"<p>" + vDocArticle[i] +
"</p>";
1334 sHTML +=
"<!-- END COPYING HERE -->\n</body>\n</html>\n";
1336 sHTML +=
"</body>\n</html>\n";
1355 static std::vector<double> vWeighting({3.0, 2.0, 1.0});
1358 if (!findDataBase.
size())
1360 findDataBase.
addData(
"<>/docs/find.ndb");
1363 findDataBase.
addData(
"<>/user/docs/find.ndb");
1370 if (!mMatches.size())
1380 double dMax = mMatches.rbegin()->first;
1389 for (
auto iter = mMatches.rbegin(); iter != mMatches.rend(); ++iter)
1391 for (
size_t j = 0; j < iter->second.size(); j++)
1395 if (
intCast(iter->first / dMax * 100) != 100)
1400 if (findDataBase.
getElement(iter->second[j], 0) ==
"NumeRe v $$$")
1407 if (findDataBase.
getElement(iter->second[j], 0) ==
"NumeRe v $$$")
const std::string sVersion
std::string toLowerCase(const std::string &)
Converts uppercase to lowercase letters.
std::string getHelpArticleID(const std::string &sTopic)
This member function returns the article ID corresponding to the queried topic.
std::string getHelpIdxKey(const std::string &sTopic)
This member function returns an index key, which corresponds to the queried topic.
std::vector< std::string > getHelpArticle(const std::string &sTopic)
This member function returns the documentation article, which corresponds to the passed documentation...
std::string getHelpArticleTitle(const std::string &_sIdxKey)
This member function returns the documentation article title corresponding to the queried index key.
static std::string getArgAtPos(const std::string &sCmd, unsigned int pos)
This static member is a fallback for the XML-parsing logic-stuff.
std::string ValidizeAndPrepareName(const std::string &_sFileName, const std::string &sExtension=".dat") const
This member function validizes the passed file name and creates the needed folders on-the-fly.
std::string ValidFileName(std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const
This member function evaluates, whether the passed filename is a valid filename. One may supply a pre...
void declareFileType(const std::string &sFileType)
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class is an implementation of a database. It will handle the *.ndb data format an provides an in...
std::map< double, std::vector< size_t > > findRecordsUsingRelevance(const std::string &_sSearchString, std::vector< double > vWeighting=std::vector< double >()) const
This member function will search multiple search strings in the database and returns a map,...
std::string getElement(size_t i, size_t j) const
This member function will return the contents of the selected database field, or an empty string,...
void addData(const std::string &sDataBaseFile)
This member function will use the passed database file name to update its internal contents (i....
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
static void printPreFmt(const std::string &__sLine, bool printingEnabled=true)
This member function appends the pre- formatted string to the buffer and informs the terminal that we...
std::vector< std::string > getPluginCommands()
This member function is used by the syntax highlighter to hightlight the plugin commands.
static void print(const std::string &__sLine, bool printingEnabled=true)
This member function appends the passed string as a new output line to the buffer and informs the ter...
FileSystem & getFileSystem()
static void setDocumentation(const std::string &_sDocumentation)
This member function handles the display of a documentation window as requested by the kernel.
static void toggleTableStatus()
Toggles the table writing status, which will reduce the number or events send to the terminal.
This class contains all needed keywords to highlight their occurences correspondingly....
std::string highlightLine(const std::string &sCommandLine)
This function applies the highlighting colors to the command line (only used in the terminal).
This class manages the setting values of the internal (kernel) settings of this application.
std::string getLoadPath() const
Returns the current loading path.
std::string getSavePath() const
Returns the current saving path.
std::string getProcPath() const
Returns the current procedure root import path.
std::string getPlotPath() const
Returns the current plotting path (plot storing location).
std::string getExePath() const
Returns the current application root folder path.
SettingsValue & getSetting(const std::string &value)
Returns a reference to the setting value, which corresponds to the passed string. Throws an exception...
bool useCustomLangFiles() const
Returns, whether user language files shall be used to override internal language strings.
std::string getScriptPath() const
Returns the current script import folder path.
std::string & stringval()
Returns a reference to a std::string value type setting.
Common exception class for all exceptions thrown in NumeRe.
static size_t invalid_position
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.
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...
static std::string createCssString(int style, const Settings &_option)
This static function creates the CSS string for the span element containing the lexed symbol....
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 counterpar...
static bool isFunction(const std::string &sExpr, size_t nPos, size_t nLength)
Static helper function for doc_ReplaceExprContentForHTML to determine functions in expressions.
#define VIEWER_CODEBLOCK_START
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.
#define FILE_CODEBLOCK_START
#define VIEWER_CODEBLOCK_END
void doc_SearchFct(const std::string &sToLookFor, Settings &_option)
This function provides the logic for searching for entries in the keywords database.
static std::string getHighlightedCode(std::string sCode, bool verbatim, Settings &_option)
Returns the final HTML string containing the already lexed and highlighted code.
static void doc_ReplaceExprContentForHTML(std::string &sExpr, Settings &_option)
This function replaces tokens in <expr>-tags to improve the readability of mathematical code.
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....
static bool isOperator(const std::string &sExpr, size_t nPos, size_t nLength)
Static helper function for doc_ReplaceExprContentForHTML to determine operators in expressions.
#define FILE_CODEBLOCK_END
void doc_Help(const std::string &__sTopic, Settings &_option)
This function shows the content of a documentation article based upon the passed topic....
std::string toSystemCodePage(std::string)
Converts an internal to an external string. Does nothing currently.
std::string replacePathSeparator(const std::string &)
This function replaces the Windows style path sparators to UNIX style.
bool fileExists(const string &)
This function checks, whether the file with the passed file name exists.
unsigned int getMatchingParenthesis(const StringView &)
Returns the position of the closing parenthesis.
void StripSpaces(std::string &)
Removes leading and trailing white spaces and tabulator characters.
int findParameter(const std::string &sCmd, const std::string &sParam, const char cFollowing)
This function searches the passed parameter in the passed command string. If something is found,...
#define SETTING_S_ST_FUNCTION
#define SETTING_S_ST_OPTION
#define SETTING_S_ST_METHODS
#define SETTING_S_ST_PROCEDURE
#define SETTING_S_ST_SPECIALVAL
#define SETTING_S_ST_COMMENT
#define SETTING_S_ST_STRING
#define SETTING_S_ST_OPERATOR
#define SETTING_S_ST_NUMBER
#define SETTING_S_ST_COMMAND
#define SETTING_S_ST_CONSTANT
long long int intCast(const std::complex< double > &)
Casts the real part of the complex number to an integer and avoids rounding errors.
std::string toString(int)
Converts an integer to a string without the Settings bloat.