update wiki functions.
}
/*DOC:
+===escape-wiki===
+ (escape-wiki STRING ...) -> STRING
+
+*/
+//#AFUNC escape-wiki ml_escape_wiki
+//#WIKIFUNC escape-wiki
+MNode* ml_escape_wiki (MNode* cell, MlEnv* mlenv) {
+ MNode* arg = cell->cdr ();
+ ustring text;
+ ustring ans;
+ uiterator b, e;
+ umatch m;
+ static uregex re ("([\\[\\]&|:])|(\n)");
+
+ while (arg) {
+ text.append (eval_str (arg->car (), mlenv));
+ nextNode (arg);
+ }
+ b = text.begin ();
+ e = text.end ();
+ while (b < e && usearch (b, e, m, re)) {
+ if (b < m[0].first)
+ ans.append (b, m[0].first);
+ if (m[1].matched) {
+ ans.append (uAmp).append (m[1].first, m[1].second).append (CharConst (";"));
+ } else if (m[2].matched) {
+ ans.append (uSPC);
+ } else {
+ assert (0);
+ }
+ b = m[0].second;
+ }
+ if (b < e)
+ ans.append (b, e);
+
+ return newMNode_str (new ustring (ans));
+}
+
+/*DOC:
===escape-wiki-q===
// (escape-wiki STRING ...) -> STRING
(escape-wiki-q STRING ...) -> STRING
MNode* ml_escape_regexp (MNode* cell, MlEnv* mlenv);
MNode* ml_encode_control_char (MNode* cell, MlEnv* mlenv);
MNode* ml_decode_control_char (MNode* cell, MlEnv* mlenv);
+MNode* ml_escape_wiki (MNode* cell, MlEnv* mlenv);
MNode* ml_escape_wiki_q (MNode* cell, MlEnv* mlenv);
MNode* ml_percent_encode (MNode* cell, MlEnv* mlenv);
MNode* ml_percent_decode (MNode* cell, MlEnv* mlenv);
#include "ustring.h"
#include <exception>
+static ustring kGuestuserFunction (CharConst ("guestuser-function"));
+
/*DOC:
==wiki processing==
}
/*DOC:
+===guestuser-function===
+ (guestuser-function) -> NIL
+
+*/
+//#AFUNC guestuser-function ml_guestuser_function
+MNode* ml_guestuser_function (MNode* cell, MlEnv* mlenv) {
+ MNode* arg = cell->cdr ();
+ if (arg)
+ throw (uErrorWrongNumber);
+
+ return NULL;
+}
+
+/*DOC:
===wiki-output===
(wiki-output TEXT... [#flush | :flush BOOL]) -> NIL
MNode* ml_defun_wiki_command (MNode* cell, MlEnv* mlenv);
MNode* ml_get_wiki_command (MNode* cell, MlEnv* mlenv);
MNode* ml_wiki_guestuser_function (MNode* cell, MlEnv* mlenv);
+MNode* ml_guestuser_function (MNode* cell, MlEnv* mlenv);
MNode* ml_wiki_output (MNode* cell, MlEnv* mlenv);
#endif /* ML_WIKI_H */
/* ============================================================ */
bool WikiAttribImg::readAttribMore (const ustring& key, WikiMotorObjVec& vval, bool& ferr) {
if (paramWidth (key, vval, width, ferr)) {
+ if (checkNum (width))
+ width.append (CharConst ("px"));
} else if (paramHeight (key, vval, height, ferr)) {
+ if (checkNum (height))
+ height.append (CharConst ("px"));
} else if (match (key, CharConst ("alt"))) {
alt = vval.textOut (wiki);
} else {
}
void WikiAttribImg::outputMore (MotorOutput* out) {
- wiki->outputName (out, CharConst ("width"), width);
- wiki->outputName (out, CharConst ("height"), height);
+// wiki->outputName (out, CharConst ("width"), width);
+// wiki->outputName (out, CharConst ("height"), height);
+ if (width.length () > 0 || height.length () > 0) {
+ out->out_raw (CharConst (" style=\""));
+ if (width.length () > 0)
+ out->out_raw (CharConst ("width:"))->out_toHTML_noCtrl (width)->out_raw (CharConst (";"));
+ if (height.length () > 0)
+ out->out_raw (CharConst ("height:"))->out_toHTML_noCtrl (height)->out_raw (CharConst (";"));
+ out->out_raw (CharConst ("\""));
+ }
// longdesc
}