ソースを参照

Render the entire textbuffer correctly.

tags/v0.2
Ben Kurtovic 12年前
コミット
c5fea8ea34
1個のファイルの変更13行の追加1行の削除
  1. +13
    -1
      mwparserfromhell/parser/tokenizer.c

+ 13
- 1
mwparserfromhell/parser/tokenizer.c ファイルの表示

@@ -120,7 +120,17 @@ Tokenizer_push(Tokenizer* self, int context)
static PyObject*
Textbuffer_render(struct Textbuffer* self)
{
return PyUnicode_FromUnicode(self->data, self->size);
PyObject *result = PyUnicode_FromUnicode(self->data, self->size);
PyObject *left, *concat;
while (self->next) {
self = self->next;
left = PyUnicode_FromUnicode(self->data, self->size);
concat = PyUnicode_Concat(left, result);
Py_DECREF(left);
Py_DECREF(result);
result = concat;
}
return result;
}

/*
@@ -155,6 +165,7 @@ Tokenizer_push_textbuffer(Tokenizer* self)

Py_DECREF(token);

Textbuffer_dealloc(buffer);
self->topstack->textbuffer = Textbuffer_new();
if (!self->topstack->textbuffer) {
return -1;
@@ -305,6 +316,7 @@ Tokenizer_write_all(Tokenizer* self, PyObject* tokenlist)
}
Py_DECREF(text);

Textbuffer_dealloc(buffer);
self->topstack->textbuffer = Textbuffer_new();
if (!self->topstack->textbuffer) {
return -1;


読み込み中…
キャンセル
保存