summaryrefslogtreecommitdiff
path: root/client/docgen/generate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/docgen/generate.cc')
-rw-r--r--client/docgen/generate.cc44
1 files changed, 42 insertions, 2 deletions
diff --git a/client/docgen/generate.cc b/client/docgen/generate.cc
index 73734a5..5cff6b7 100644
--- a/client/docgen/generate.cc
+++ b/client/docgen/generate.cc
@@ -29,9 +29,47 @@
#include <QTextStream>
#include <QDate>
+#include <QStringList>
#include "genimage.h"
+static QString function(QString f)
+{
+ QString out;
+
+ if(f.indexOf(" ") > f.indexOf("(") || f.indexOf(" ") == -1) {
+ printf("MISSING return type in \"%s\".\n", f.toStdString().c_str());
+ return f;
+ }
+
+ QString ret = f.left(f.indexOf(" "));
+ QString name = f.mid(f.indexOf(" ") + 1, f.indexOf("(") - f.indexOf(" ") - 1);
+ QString ps = f.mid(f.indexOf("(") + 1,
+ f.indexOf(")") - f.indexOf("(") - 1);
+
+ QStringList parms = ps.split(",");
+
+ out += "<span class=\"luatype\">" + ret + "</span> ";
+ out += "<span class=\"luamethod\">" + name + "</span>";
+ out += "(<span class=\"luaparms\">";
+ for(int i = 0; i < parms.size(); i++) {
+ QStringList l = parms.at(i).split(" ", QString::SkipEmptyParts);
+ if(l.length() != 2) {
+ out += parms.at(i);
+ continue;
+ }
+ QString type = l.at(0);
+ QString name = l.at(1);
+ if(i != 0) out += ", ";
+ out += "<span class=\"luatype\">" + type + "</span>";
+ out += " <span class=\"luaparm\">" + name + "</span>";
+ }
+ out += "</span>)";
+
+
+ return out;
+}
+
static QString generateMethods(QVector<Method> meths)
{
QString out;
@@ -39,7 +77,7 @@ static QString generateMethods(QVector<Method> meths)
foreach(Method meth, meths) {
out += " <div class=\"method\">\n";
out += " <a name=\"" + meth.name +
- "\"></a><div class=\"name\">" + meth.name + "</div>\n";
+ "\"></a><div class=\"name\">" + function(meth.name) + "</div>\n";
out += " <div class=\"description\">" + meth.description +
"</div>\n";
@@ -189,7 +227,9 @@ QString generate(Doc &doc, QMap<QString, QVector<Method> > &meths,
out += " </div>\n";
out += " <div class=\"footer\">This documentation is generated for"
- " Pracro version "VERSION" at "+QDate::currentDate().toString()+"</div>\n";
+ " <a href=\"http://www.aasimon.org/pracro\">Pracro</a>"
+ " version "VERSION" at "+QDate::currentDate().toString()+"</div>\n";
+
return out;
}