while (isize > 0) {
obuf = buf;
osize = 4096;
-#if defined(Linux) || defined(FreeBSDPortsIConv)
rsize = ::iconv (cd, (char**)&ibuf, &isize, &obuf, &osize);
-#else
- rsize = ::iconv (cd, &ibuf, &isize, &obuf, &osize);
-#endif
if (rsize == -1) {
if (errno == EILSEQ) {
ibuf ++;
buildHeader ();
switch (method) {
case METHOD_POST:
- if (! rawquery.isEmpty ()) {
+ if (! rawQuery.isEmpty ()) {
setRawQuery (fd);
} else {
- rawquery.setText ();
- buildQuery (queryParam (), rawquery.param);
+ rawQuery.setText ();
+ buildQuery (queryParam (), rawQuery.param);
setRawQuery (fd);
}
break;
ne_set_request_body_provider (req, qbody->calcLength (), qbodyProvider, qbody.get ());
break;
case METHOD_PUT:
- if (! rawquery.isEmpty ()) {
+ if (! rawQuery.isEmpty ()) {
setRawQuery (fd);
}
break;
ustring NeonQuery::buildGetQuery () {
ustring ans;
- if (! isNil (queryParamGet ())) {
- buildQuery (queryParamGet (), ans);
+ if (! isNil (getQueryParam ())) {
+ buildQuery (getQueryParam (), ans);
+ } else if (! rawGetQuery.isEmpty () && rawGetQuery.isText ()) {
+ ans = rawGetQuery.read ();
} else if (method == METHOD_GET) {
- if (! rawquery.isEmpty () && rawquery.isText ()) {
- ans = rawquery.read ();
+ if (! rawQuery.isEmpty () && rawQuery.isText ()) {
+ ans = rawQuery.read ();
} else if (! isNil (queryParam ())) {
buildQuery (queryParam (), ans);
}
void NeonQuery::setRawQuery (FileMacro& fd) {
setFormType ();
- if (rawquery.isText ()) {
- ne_set_request_body_buffer (req, rawquery.param.c_str (), rawquery.param.size ());
+ if (rawQuery.isText ()) {
+ ne_set_request_body_buffer (req, rawQuery.param.c_str (), rawQuery.param.size ());
} else {
- ustring src = rawquery.src ();
+ ustring src = rawQuery.src ();
if (src.length () > 0) {
if (fd.openRead (src.c_str ())) {
ne_set_request_body_fd (req, fd.fd, 0, fd.size ());
:basic-user '(ID . PASSWORD)
:query '((NAME . VALUE) ...)
:get-query '((NAME . VALUE) ...)
- #no-encode
+// #no-encode
:post-file-serial '((NAME . FILE) ...)
:post-file-named '((NAME . FILE) ...)
:post-file-static '((NAME . FILE) ...)
:raw-query TEXT :raw-file-serial FILE :raw-file-named FILE :raw-file-static FILE
+ :raw-get-query TEXT
:query-type MIMETYPE
:cookie '((NAME . VALUE) ...) :header '((NAME . VALUE) ...)
[#sjis | #euc-jp | :iconv NAME]
{CharConst ("euc-jp"), true}, // 20
{CharConst ("iconv"), false}, // 21
{CharConst ("module"), false}, // 22
+ {CharConst ("raw-get-query"), false}, // 23
{NULL, 0, 0}
};
if (evkw (7, t)) // 7:query
obj->query->queryParam = checkConsList (t ());
if (evkw (8, t)) // 8:get-query
- obj->query->queryParamGet = checkConsList (t ());
+ obj->query->getQueryParam = checkConsList (t ());
+ if (evkw (23, t)) // 23:raw-get-query
+ obj->query->rawGetQuery.srcText (to_string (t ()));
if (evkw (9, t)) // 9:post-file-serial
postFileSerial = checkConsList (t ());
if (evkw (10, t)) // 10:post-file-named
if (evkw (11, t)) // 11:post-file-static
postFileStatic = checkConsList (t ());
if (evkw (12, t)) // 12:raw-query
- obj->query->rawquery.srcText (to_string (t ()));
+ obj->query->rawQuery.srcText (to_string (t ()));
if (evkw (13, t)) // 13:raw-file-serial
- obj->query->rawquery.srcSerial (to_string (t ()));
+ obj->query->rawQuery.srcSerial (to_string (t ()));
if (evkw (14, t)) // 14:raw-file-named
- obj->query->rawquery.srcNamed (to_string (t ()));
+ obj->query->rawQuery.srcNamed (to_string (t ()));
if (evkw (15, t)) // 15:raw-file-static
- obj->query->rawquery.srcStatic (to_string (t ()));
+ obj->query->rawQuery.srcStatic (to_string (t ()));
if (evkw (16, t)) { // 16:query-type
obj->query->querytype = to_string (t ());
if (! matchASCII (obj->query->querytype.begin (), obj->query->querytype.end ()))
}
/*DOC:
-====get-cookie====
- (get-cookie NAME :module MODULE) -> STRING
+====http-get-cookie====
+ (http-get-cookie NAME :module MODULE) -> STRING
*/
-//#SFUNC get-cookie ml_neon_get_cookie $neon
-//#SFUNC get-cookie ml_neon_get_cookie %neon
-MNode* ml_neon_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
+//#SFUNC http-get-cookie ml_neon_http_get_cookie $neon
+//#SFUNC http-get-cookie ml_neon_http_get_cookie %neon
+//#SFUNC get-cookie ml_neon_http_get_cookie $neon
+//#SFUNC get-cookie ml_neon_http_get_cookie %neon
+MNode* ml_neon_http_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
ustring name;
}
/*DOC:
-====get-cookie-all====
- (get-cookie-all :module MODULE) -> LIST of (NAME . VALUE)
+====http-get-all-cookies====
+ (http-get-all-cookies :module MODULE) -> LIST of (NAME . VALUE)
*/
-//#SFUNC get-cookie-all ml_neon_get_cookie_all $neon
-//#SFUNC get-cookie-all ml_neon_get_cookie_all %neon
-MNode* ml_neon_get_cookie_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
+//#SFUNC http-get-all-cookies ml_neon_http_get_all_cookies $neon
+//#SFUNC http-get-all-cookies ml_neon_http_get_all_cookies %neon
+// --quirk
+//#SFUNC get-cookie-all ml_neon_http_get_all_cookies $neon
+//#SFUNC get-cookie-all ml_neon_http_get_all_cookies %neon
+// quirk--
+MNode* ml_neon_http_get_all_cookies (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
MNodePtr t;
}
/*DOC:
-====http-get-header-all====
- (http-get-header-all :module MODULE) -> LIST of (NAME . VALUE)
+====http-get-all-headers====
+ (http-get-all-headers :module MODULE) -> LIST of (NAME . VALUE)
*/
-//#SFUNC http-get-header-all ml_neon_http_get_header_all $neon
-//#SFUNC http-get-header-all ml_neon_http_get_header_all %neon
-MNode* ml_neon_http_get_header_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
+//#SFUNC http-get-all-headers ml_neon_http_get_all_headers $neon
+//#SFUNC http-get-all-headers ml_neon_http_get_all_headers %neon
+// --quirk
+//#SFUNC http-get-header-all ml_neon_http_get_all_headers $neon
+//#SFUNC http-get-header-all ml_neon_http_get_all_headers %neon
+// quirk--
+MNode* ml_neon_http_get_all_headers (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
MNodePtr t;
ustring basicID;
ustring basicPW;
MNodePtr queryParam;
- MNodePtr queryParamGet;
- StoreType rawquery;
+ MNodePtr getQueryParam;
+ StoreType rawQuery;
+ StoreType rawGetQuery;
ustring querytype; /* リクエストヘッダのcontent-type */
MNodePtr cookie;
MNodePtr header;
std::vector<CookieInfo> replyCookie;
bool replyCookieDone;
- NeonQuery (ne_session* _session, MlEnv* _mlenv): rawquery (_mlenv) {
+ NeonQuery (ne_session* _session, MlEnv* _mlenv): rawQuery (_mlenv), rawGetQuery (_mlenv) {
session = _session;
req = NULL;
method = METHOD_GET;
MNode* ml_neon_http_response (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
MNode* ml_neon_http_response_file (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
MNode* ml_neon_http_response_output (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
-MNode* ml_neon_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
-MNode* ml_neon_get_cookie_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
+MNode* ml_neon_http_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
+MNode* ml_neon_http_get_all_cookies (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
MNode* ml_neon_http_content_type (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
MNode* ml_neon_http_get_header (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
-MNode* ml_neon_http_get_header_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
+MNode* ml_neon_http_get_all_headers (MNode* cell, MlEnv* mlenv, MLFunc* mobj);
#endif /* ML_NEON_H */
/*DOC:
===vector-get===
- (vector-get VECTOR N) -> VALUE
+ (vector-get VECTOR N [) -> VALUE
*/
-//#AFUNC vector-get ml_vector_get
+//#AFUNC vector-get ml_table_get
//#WIKIFUNC vector-get
+////#AFUNC vector-get ml_vector_get
+////#WIKIFUNC vector-get
+/*
MNode* ml_vector_get (MNode* cell, MlEnv* mlenv) {
MNode* arg = cell->cdr ();
MNodePtr vec;
else
return mlenv->retval = vec ()->vectorGet (n);
}
+*/
/*DOC:
===vector-back===
/*DOC:
===table-get===
- (table-get TABLE NAME) -> VALUE
+ (table-get TABLE NAME [NAME | N]...) -> VALUE
*/
//#AFUNC table-get ml_table_get
MNode* ml_table_get (MNode* cell, MlEnv* mlenv) {
MNode* arg = cell->cdr ();
MNodePtr tbl;
- ustring name;
+ MNodePtr e;
if (! arg)
throw (uErrorWrongNumber);
tbl = eval (arg->car (), mlenv);
nextNodeNonNil (arg);
- name = eval_str (arg->car (), mlenv);
- nextNode (arg);
- if (arg)
- throw (uErrorWrongNumber);
-
- if (isNil (tbl ()))
- return NULL;
- if (! tbl ()->isTable ())
- throw (uErrorWrongType);
+ while (arg) {
+ e = eval (arg->car (), mlenv);
+ nextNode (arg);
+ if (isNil (tbl ())) {
+ return NULL;
+ } else if (tbl ()->isTable ()) {
+ tbl = tbl ()->tableGet (to_string (e ()));
+ } else if (tbl ()->isVector ()) {
+ tbl = tbl ()->vectorGet (to_int (e ()));
+ } else {
+ throw (uErrorWrongType);
+ }
+ }
- return mlenv->retval = tbl ()->tableGet (name);
+ return mlenv->retval = tbl ();
}
/*DOC:
};
MNode* ml_vector (MNode* cell, MlEnv* mlenv);
-MNode* ml_vector_get (MNode* cell, MlEnv* mlenv);
+//MNode* ml_vector_get (MNode* cell, MlEnv* mlenv);
MNode* ml_vector_back (MNode* cell, MlEnv* mlenv);
MNode* ml_vector_size (MNode* cell, MlEnv* mlenv);
MNode* ml_vector_put (MNode* cell, MlEnv* mlenv);
for (int i = 0; i < args.size (); i ++) {
ustring value (args[i]->textOut (wiki));
if (value.length () > 0) {
- if (matchWikiID (value)) {
+ if ((selector & SEL_DIRECT) && value[0] == '#' && matchWikiID (ustring (value.begin () + 1, value.end ()))) {
+ directlist.push_back (value); // SEL_DIRECTが指定してある場合のみ有効
+ } else if (matchWikiID (value)) {
var.push_back (value);
} else {
wiki->errorMsg.append (value).append (CharConst (": bad class name\n"));
static const uint32_t SEL_MULTIPLE2 = 0x0100;
static const uint32_t SEL_SCRIPT2 = 0x0200;
static const uint32_t SEL_START = 0x0400;
+ static const uint32_t SEL_DIRECT = 0x0800; // #指定
typedef enum {
M_NORMAL,
M_ATTRIB,
bool ferr;
ustring id;
std::vector<ustring> classlist;
+ std::vector<ustring> directlist; // #指定
ustring onclick;
ustring onfocus;
ustring onblur;
^行頭が他のマークアップ文字になるときは,行頭に^を書く。
空行は,段落を分ける。
-
+
+
段落と段落の間に空行を2行以上入れると、「<div class="pggap"></div>」を出力する。
+{div:greenbox
+マークアップ文字以外の文字で書き出すと,段落になる。
+^行頭が他のマークアップ文字になるときは,行頭に^を書く。
+
+空行は,段落を分ける。
+
+
+段落と段落の間に空行を2行以上入れると、「<div class="pggap"></div>」を出力する。
+}
+
*/
bool WikiBlockParagraph::nextLine (uiterator b, uiterator e) {
if (*b == kWikiP) {
/* ============================================================ */
/*DOC:
===タイトル===
+行頭に=を書くと,タイトルになる。行末の=は,省略可。
+
=タイトル1=
==タイトル2==
===タイトル3===#anchor1
-
-行頭に=を書くと,タイトルになる。行末の=は,省略可。
+{div:greenbox
+=タイトル1=
+==タイトル2==
+===タイトル3===#anchor1
+}
*/
===フォーマット済みテキストブロック===
行頭に空白文字を書くと,<pre>〜</pre>タグで囲まれます。
インライン要素の解釈は行われない。
+{div:greenbox
+ 行頭に空白文字を書くと,<pre>〜</pre>タグで囲まれます。
+}
*/
bool WikiBlockPreformatRaw::nextLine (uiterator b, uiterator e) {
if (indentHack) {
outputBlock (out);
} else {
- out->out_raw (CharConst ("<li"));
- attrib.output (out);
- out->out_raw (CharConst (">"));
- out->out_toText (html);
- outputBlock (out);
- out->out_raw (CharConst ("</li>\n"));
+ if (html.length () > 0) {
+ out->out_raw (CharConst ("<li"));
+ attrib.output (out);
+ out->out_raw (CharConst (">"));
+ out->out_toText (html);
+ outputBlock (out);
+ out->out_raw (CharConst ("</li>\n"));
+ } else {
+ outputBlock (out);
+ }
}
}
+インデント1
++インデント1-1
*''[OPTION1:OPTION2:...:]''TEXT
+ *id=item1:class=style1:onclick=[[ignore:]]:TEXT
+
行頭に「*」を書くと,<UL>タグによるリスト,「#」を書くと<NL>タグによる番号付きリスト,「+」を書くとnobullクラス指定の<UL>タグによるリスト。
オプションパラメータ
|'''onchange='''''Link''||onchange属性。Javascriptリンク。|
|'''start='''''Number''||start属性。OLのみ。|
+{div:greenbox
+*項目1
+**項目1-1
+#ナンバリング1
+##ナンバリング1-2
++インデント1
+++インデント1-1
+*id=item1:class=style1:onclick=[[ignore:]]:TEXT
+}
+
*/
bool WikiBlockItem::nextLine (uiterator b, uiterator e) {
if (*b == ch) {
===定義リスト===
;見出し:説明文
+{div:greenbox
+;見出し:説明文
+}
+
*/
bool WikiBlockItemDL::nextLine (uiterator b, uiterator e) {
if (*b == kWikiDL) {
行オプションで指定できる属性はセルオプションと同じものである。
+・セルオプション
- |header:名前|class=big:東武|
- |header:
+// |header:名前|class=big:東武|
+// |header:
|table:w=100%:行オプション,セルオプション|t:w=20%|c:w=10%|t:|
|h:オプション|h:省略形|h:説明|
|'''onfocus='''''Link''||onfocus属性。Javascriptリンク。|
|'''onblur='''''Link''||onblur属性。Javascriptリンク。|
|'''onchange='''''Link''||onchange属性。Javascriptリンク。|
-|'''ClassList'''||class=は省略できる。|
+|''ClassList''||class=は省略できる。|
+|'''#nop'''||divタグを出力しない。pタグを抑制する。|
*/
bool WikiBlockDiv::nextLine (uiterator b, uiterator e) {
}
void WikiBlockDiv::addLine (uiterator b, uiterator e) {
-// bool rc = matchSkip (b, e, CharConst ("{div:"));
- bool rc = matchSkip (b, e, CharConst (uWikiDIV));
+ bool rc = matchSkip (b, e, CharConst (uWikiDIV)); // {div:
assert (rc);
WikiMotor motor (b, e, wiki);
WikiMotorObjVecPtr vec (new WikiMotorObjVec);
motor.compile (*vec);
attrib.shiftAttrib (vec);
+ {
+ std::vector<ustring>::const_iterator b = attrib.directlist.begin ();
+ std::vector<ustring>::const_iterator e = attrib.directlist.end ();
+ for (; b < e; ++ b) {
+ if (match (*b, CharConst ("#nop"))) {
+ nopflag = true;
+ } else {
+ wiki->errorMsg.append (*b).append (CharConst (": bad attribute.\n"));
+ }
+ }
+ }
}
WikiBlock::closeType WikiBlockDiv::closeLine (uiterator b, uiterator e) {
void WikiBlockDiv::output (MotorOutput* out) {
bool nonl = false;
- if (block.size () == 1 && block[0].type == BlockParagraph) {
- WikiBlockParagraph* b = WikiBlockParagraph_type (&block[0]);
- if (! b->pflag) {
- b->singleTag = true;
- nonl = true;
+ if (nopflag) {
+ boost::ptr_vector<WikiBlock>::iterator b = block.begin ();
+ boost::ptr_vector<WikiBlock>::iterator e = block.end ();
+ for (; b < e; ++ b) {
+ if (b->type == BlockParagraph) {
+ WikiBlockParagraph* p = WikiBlockParagraph_type (&(*b));
+ if (! p->pflag) {
+ p->singleTag = true;
+ nonl = true;
+ }
+ }
+ }
+ } else {
+ if (block.size () == 1 && block[0].type == BlockParagraph) {
+ WikiBlockParagraph* b = WikiBlockParagraph_type (&block[0]);
+ if (! b->pflag) {
+ b->singleTag = true;
+ nonl = true;
+ }
}
+ out->out_raw (CharConst ("<div"));
+ attrib.output (out);
+ if (nonl)
+ out->out_raw (CharConst (">"));
+ else
+ out->out_raw (CharConst (">\n"));
}
- out->out_raw (CharConst ("<div"));
- attrib.output (out);
- if (nonl)
- out->out_raw (CharConst (">"));
- else
- out->out_raw (CharConst (">\n"));
outputBlock (out);
- out->out_raw (CharConst ("</div>\n"));
+ if (! nopflag) {
+ out->out_raw (CharConst ("</div>\n"));
+ } else {
+ out->out_raw (uLF);
+ }
}
/* ============================================================ */
class WikiBlockDiv: public WikiBlockComplex {
public:
WikiAttrib1 attrib;
+ bool nopflag;
- WikiBlockDiv (WikiFormat* w): WikiBlockComplex (BlockDiv, w), attrib (w, WikiAttrib1::SEL_CLASS2, false, WikiAttrib1::M_ATTRIB) {};
+ WikiBlockDiv (WikiFormat* w): WikiBlockComplex (BlockDiv, w), attrib (w, WikiAttrib1::SEL_CLASS2 | WikiAttrib1::SEL_DIRECT, false, WikiAttrib1::M_ATTRIB) {
+ nopflag = false;
+ };
virtual ~WikiBlockDiv () {};
virtual bool nextLine (uiterator b, uiterator e);