# Bugs

88 posts, 8 voices

Let’s discuss bugs in Instiki.

Let’s see if this shows up here on the forum. It’s to do with newlines and lists.

1. This is a list. I want to put some maths in it, so I merrily go ahead and do so.

$\left[\begin{array}{cc}a& b\\ c& d\end{array}\right]$\begin{bmatrix} a & b \\ c & d \end{bmatrix}
2. This is the next item in the list.

Let’s see if the above shows what I want it to show.

Right, I now appear to be logged in again.

What I was trying to demonstrate in the above was that I don’t always get the indentation right with maths in lists I’ll have to think again to get an example that demonstrates it, though.

Right, I now appear to be logged in again.

The second, “mystery” user is a bit of a … mystery. Clearly, there are many parts of the code which work in inscrutable ways.

That didn’t, show what I wanted to show so let me try again.

1. This is a list.

This is in the same item, indented to ensure that.

This is also in the same item, indented one step more.

###### Theorem ###### This is an amazing theorem.

2. Another list item.

Yes, that worked. Because I modified the indentation a little, the theorem no longer got noticed. All-in-all, I find the indentation rules to be a little too strict! As can be seen, indenting one space extra made no difference between the second and third lines, but caused the fourth line to not be seen as a theorem.

To be honest, I find the whole indentation system for preserving environments a nightmare! Particularly, with regard to cut-and-pasting. It’d be great if there were alternatives available, like there is for code blocks.

(I’m right about that, aren’t I: the “fences” from PHP Markdown Extra work in maruku, don’t they? Let’s try:

some code

I’ll find out when I hit “save reply”! Incidentally, I think that a preview makes a little more sense on a forum than on a wiki.)

Maybe:

>>>
a quote
>>>

for quotes, and

123
1. For lists.
123

With the assumption that everything between one M. and another N. ($M,N\in ℕ$) is in a single list item.

Can’t think of anything else that relies on indentation.

Both this request (for “fenced” quotations and lists) and this one, in the other thread, are for extensions to the Markdown syntax in Maruku.

Frankly, I’m very reluctant to spend any time working on Maruku.

The author (who is no longer actively developing the software) insists on a GPL license, which conflicts with the licenses for both Instiki (Ruby) and Heterotic Beast (MIT). Unless he changes his mind (which seems unlikely, as I’ve asked several times), I would prefer to ditch Maruku, in favour of another Markdown engine.

Consequently, I’d rather spend my time extending that engine (whatever it turns out to be). Of course, for the present, I am still going to fix bugs in Maruku.

#### Update:

Well, OK, I didn’t exactly keep that promise…

Ah, that’s unfortunate. What other markdown engines are available for Ruby?

If you’re actively looking, I could run some searches on the nLab pages to see what syntax is used and what isn’t.

I do think that the attribute stuff is a brilliant addition; it makes it possible to make the pages a little more easily customised.

Incidentally, I got around my immediate indentation problem, so you can consider that one downgraded!

Ah, that’s unfortunate. What other markdown engines are available for Ruby?

There are several.

1. There’s rdiscount, based on discount.
2. There’s BlueCloth, which was the “original” Markdown interpreter for Ruby, which sucked bigtime. But Bluecloth 2.x has been rewritten to use discount.
3. There’s rpeg-markdown, based on peg-markdown.

The latter is probably the most promising. One “just” needs to write a PEG grammar for Maruku’s extended Markdown syntax, and then drop it in as a replacement.

“Just”

Maruku doesn’t like starting bold text with bizarre unicode symbols, or named entities (presumably these are converted to unicode symbols). Example **∞-gerbe**.

This causes a crash in instiki:

#<ActionView::TemplateError:
ActionView::TemplateError (invalid byte sequence in UTF-8) on line #15 of
app/views/wiki/page.rhtml:
12:     </p>
13:     <%= @renderer.display_diff %>
14:   <%- else -%>
15:     <%= @renderer.display_content %>
16:   <%- end -%>
17: </div>
18: 

PS: This showed up after I installed the latest version of instiki.

Fixed in Revision 736.

Thanks! I’ve updated the nLab and Azimuth Project. That’s great.

I originally thought that this one was due to old browsers, but I’m now using FF6.0 so it can’t be that. Anyway, when I create a new page, the “Page X does not exist” is getting escaped once too often and I see:

Page &quot;Proper Homotopy Theory&quot; does not exist.<br/>
Please create it now, or hit the &quot;back&quot; button in your browser.

Okay, next one. I’m recording the error message first. It’ll take me a few minutes to track down exactly what is causing it.

#<ActionView::TemplateError:
ActionView::TemplateError (undefined method children' for nil:NilClass) on line #15 of
app/views/wiki/page.rhtml:
12:     </p>
13:     <%= @renderer.display_diff %>
14:   <%- else -%>
15:     <%= @renderer.display_content %>
16:   <%- end -%>
17: </div>
18: 

Actually, didn’t take long at all. The last line of the document was *  (the previous line had been a list item as well) so presumably maruku was looking for the rest of the item, couldn’t find it, and gave up in disgust.

I guess that getting a more sensible error (this causes smoke) would involve hacking maruku more than you’d like.

Thanks for the report. Fixed in Revision 742.

I think this bug was a long-standing one. The other, fixed in that Revision, was completely iatrogenic.

Oh, and your double-escaping bug is fixed in Revision 743.

Great! I’ll apply those tomorrow morning.

(And I learnt a new word. Doubt I’ll be able to get it in to Boggle, though.)

Next bug. For some strange reason, empty anchors mess up wikilinks:

<a id="anchor"></a>

Here's a [[wikilink]]

means that Instiki does not process the wikilink. If I put text in the anchor, then it’s fine. If I replace the a tag by p or div then it’s fine (didn’t test other tags). The problem persists for a bit, and then starts working again (not quite figured out the rule for when it does, sometimes it seems to be in the middle of a paragraph).

This does feel a bit like a “when I bang my head on the wall then it hurts” bug, but still it is strange behaviour particularly given the tag-dependence.

(See http://ncatlab.org/nlab/show/Sandbox for some experiments.)

Same thing happen(ed) when you typed (the equally useless)

<code></code>

Here's a [[wikilink]].

Fixed in Revision 744.

Yet again: thanks!

Though I dispute the “equally useless”. I was using the empty anchor tag to put an anchor at a particular place on the page when there wasn’t an obvious thing to “hang” it on. Of course, I could always find something to put it with, but it was coming from my automatic LaTeX-to-iTeX package and it’s much easier to have an empty anchor than try to figure out automatically where it can be put.

<a id="anchor"> </a>

Here's a [[wikilink]

would not have triggered the bug. Only empty elements (which get converted to short-tag syntax, <a id="anchor"/>, in the output) triggered this bug. Since you probably don’t want empty a or code elements (they are perfectly correct in XHTML, but wreak havoc, when the same document is parsed as HTML), you probably didn’t want the problematic (if you prefer that to uselesss) empty elements in the first place.

I’m afraid I’m not very well informed on the differences between XHTML and HTML. I probably ought to be (I found the w3c page on it which was useful). So <a> </a> is actually different to <a></a>, then. But it seems as though when rendered then the extra space has no actual effect. (Let’s try: a a and aa. Though my actual use case has them on lines by themselves:

Text

Text

Text

Text)

The reason why I’m using these is that in a LaTeX document, whenever a counter is stepped then hyperref inserts a bookmark in to the PDF. As there’s no actual text at that point, there’s no way to figure out what that bookmark should be attached to so I made it in to an empty anchor. But maybe I need to suppress it altogether and suppress implicit anchors, only inserting anchors that correspond to actual labels.

Of course they are different.

• <a> </a>” is an ”a” element with a single child node, which is a text node, containing ” “.
• <a></a>” is an ”a” element with no children.

In X(HT)ML, the latter is equivalent to ”<a/>”.

The short-tag construction does not exist in HTML and all browsers interpret the latter as the opening tag, ”<a>”, of an ”a” element (which is not what you want).

Of course they are different.

I reserve the right to be stupid!

New bug! I think that the page view is not getting “expired” (is that the right term?) when a file is uploaded. Here’s the “steps to reproduce”:

1. Edit a page to include a file upload whatsit.
2. Upload the file. Upon upload, the page looks fine and the question-mark link has been replaced by a link to the file.
3. Reload the page. Then it reverts to the previous view and the question-mark link is back again.
4. Next time the page is edited, it looks correct.

Because of that last, my guess is that the pre-upload version is still in the cache, but that the page shown when the file is uploaded doesn’t read the cache version.

So long as the cache hasn’t been expired, you can see this at http://ncatlab.org/doriath/show/uploads+and+caches. If you click on the question mark, you should get a copy of the Snake Lemma.

Because of that last, my guess is that the pre-upload version is still in the cache, but that the page shown when the file is uploaded doesn’t read the cache version.

You’re probably correct. The rule is that pages with Flash messages on them (like the one that tells you that the file was successfully-uploaded) are not cached. So you get to see the correct page once, but if the incorrect one wasn’t deleted from the cache, that’s what you’ll see the second time.

Fixed in Revision 756 Revision 757.

I’m on the latest version (758) on my course wiki and this still didn’t work (I thought that it did work just recently, though, did you undo something?). I uploaded a few files, then reloaded the page, and it had the greyed-out-with-question-mark look again.

I’m a little baffled. It should work. Sometimes it does (saving the file triggers the cache sweeper); sometimes it doesn’t. I can’t see what the difference is.

Will have to investigate further …

Just saw the following in the logs:

ActionView::TemplateError (can't convert nil into String) on line #25 of app/views/wiki/atom.rxml:
22:       else
23:         xml.content('type' => 'xhtml', 'xml:base' => url_for(:only_path => false, :web => @web_name,
:action => @link_action, :id => page.name) ) do
24:           xml.div('xmlns' => 'http://www.w3.org/1999/xhtml' ) do
25:             |x| x << rendered_content(page)
26:           end
27:         end
28:       end`