[rkward-cvs] [rkward] Support header at lower level and indentation in Header()/makeHeaderCode()
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Nov 17 19:16:28 UTC 2014
NOTE: This is a manual resend of a commit notification that was missing due to
commit hooks not yet activated.
---
commit 78e100551e4b53b1c9a2a70418216db64e451a58
Author: Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de>
Commit: Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de>
Support header at lower level and indentation in Header()/makeHeaderCode()
diff --git a/rkward/scriptbackends/common.js b/rkward/scriptbackends/common.js
index e004998..3d97161 100644
--- a/rkward/scriptbackends/common.js
+++ b/rkward/scriptbackends/common.js
@@ -93,28 +93,31 @@ comment = function (message, indentation) {
printIndented (indentation + "# ", message + "\n");
}
-makeHeaderCode = function (title, parameters) {
- echo ("rk.header(" + quote (title));
+makeHeaderCode = function (title, parameters, level) {
+ if (typeof (indentation) == 'undefined') indentation = "";
+ echo (indentation + "rk.header (" + quote (title));
if (parameters.length) {
echo (", parameters=list(");
for (var p = 0; p < parameters.length; p += 2) {
- if (p) echo (",\n\t");
+ if (p) echo (",\n" + indentation + "\t");
echo (quote (parameters[p]) + "=" + quote (parameters[p+1]));
}
echo (")");
}
+ if (typeof (level) != 'undefined') echo (", level=" + level);
echo (")\n");
}
-Header = function (title) {
+Header = function (title, level) {
this.title = title;
+ this.level = level;
this.parameters = [];
this.add = function (caption, value) {
this.parameters.push (caption, value);
return this;
}
- this.print = function () {
- makeHeaderCode (this.title, this.parameters);
+ this.print = function (indentation) {
+ makeHeaderCode (this.title, this.parameters, this.level,
this.indentation);
}
}
More information about the rkward-tracker
mailing list