summaryrefslogtreecommitdiff
path: root/client/docgen
diff options
context:
space:
mode:
Diffstat (limited to 'client/docgen')
-rw-r--r--client/docgen/docgen.cc3
-rw-r--r--client/docgen/generate.cc44
-rw-r--r--client/docgen/genimage.cc17
-rw-r--r--client/docgen/parse.cc2
-rw-r--r--client/docgen/style.css15
5 files changed, 76 insertions, 5 deletions
diff --git a/client/docgen/docgen.cc b/client/docgen/docgen.cc
index e5a8bff..ee5b8f4 100644
--- a/client/docgen/docgen.cc
+++ b/client/docgen/docgen.cc
@@ -145,7 +145,8 @@ int main(int argc, char *argv[])
QStringList l = dir.entryList(QDir::Files);
foreach(QString file, l) {
Doc doc = parse(QString(INPUT) + "/" + file);
- docs[doc.name] = doc;
+ if(doc.title != "" || doc.tag != "")
+ docs[doc.name] = doc;
}
writeIndex(docs);
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;
}
diff --git a/client/docgen/genimage.cc b/client/docgen/genimage.cc
index 332887c..f598553 100644
--- a/client/docgen/genimage.cc
+++ b/client/docgen/genimage.cc
@@ -64,6 +64,15 @@ void genImage(QString widget)
}
if(widget == "combobox" || widget == "listbox") {
+
+ if(widget == "listbox") {
+ QDomElement e = node.createElement("item");
+ e.setAttribute("type", "header");
+ e.setAttribute("caption", "Header 1");
+ e.setAttribute("value", "Header 1");
+ elem.appendChild(e);
+ }
+
{
QDomElement e = node.createElement("item");
e.setAttribute("caption", "List item 1");
@@ -77,6 +86,14 @@ void genImage(QString widget)
elem.appendChild(e);
}
+ if(widget == "listbox") {
+ QDomElement e = node.createElement("item");
+ e.setAttribute("type", "separator");
+ e.setAttribute("caption", "sep 1");
+ e.setAttribute("value", "sep 1");
+ elem.appendChild(e);
+ }
+
{
QDomElement e = node.createElement("item");
e.setAttribute("caption", "List item 3");
diff --git a/client/docgen/parse.cc b/client/docgen/parse.cc
index bcf137b..d1631c1 100644
--- a/client/docgen/parse.cc
+++ b/client/docgen/parse.cc
@@ -69,7 +69,7 @@ Doc parse(QString filename)
if(running) {
line.remove(QRegExp("^[ \t*]*"));
- printf("line [%s]\n", line.toStdString().c_str());
+ // printf("line [%s]\n", line.toStdString().c_str());
if(state == indesc && line.left(1) == "@") state = none;
if(state == inatt && line.left(1) == "@") state = none;
diff --git a/client/docgen/style.css b/client/docgen/style.css
index 778c69d..9ef9a68 100644
--- a/client/docgen/style.css
+++ b/client/docgen/style.css
@@ -85,7 +85,6 @@ a:hover {
background-color: #D5E1E8;
width: *;
border: solid #84B0C7 1px;
- font-weight: bold;
padding: 4px;
border-radius: 8px 8px 8px 8px;
}
@@ -106,3 +105,17 @@ a:hover {
.parameter .description {
display: inline;
}
+
+.method .luamethod {
+ font-weight: bold;
+}
+
+.method .luatype {
+ font-style: italic;
+ color: blue;
+}
+
+.method .luaparms {
+ font-style: italic;
+ color: green;
+} \ No newline at end of file