numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
200 stars 117 forks source link

Textile not working? #118

Closed BillFoster closed 12 years ago

BillFoster commented 12 years ago

Compiling recent exams with textile included - textile display not working

BillFoster commented 12 years ago

Just pushed mas3214 1_7 to exams/examples. There I have replaced the textile table formation with html in order to keep up with timetabled work. This need to be looked at to see if I have made some basic mistakes in using textile or whether or not this is a problem with Numbas code. Also how to control the position of tables dynamically generated by direct html as in the solution. This urgent as I need this to be resolved!!

BillFoster commented 12 years ago

The html generated table is fine in terms of its display using IE but not using Chrome or FireFox - the table is pushed to the bottom in those browsers leaving a lot of white space. You will find 3214 1_7 on inishmore.ncl.ac.uk/MAS3214_20122013_CBA1_7

christianp commented 12 years ago

Your CBA1_7 question fell foul of a couple of quirks of textile that, while not obvious, are definitely the way it's meant to work.

Because you didn't have empty lines above and below the table, it was interpreted as being part of the paragraph block, so
tags were inserted at every newline.

Even after fixing that, you need to do a little work because most of the time you don't want subbed-in strings to be their own paragraph block. To make this happen, Numbas puts a space before a subbed-in string before running it through textile, which prevents it from being interpreted as a block.

Sadly, in this case you do want a separate block, so you need to put two newlines at the start of the string to force the matter.

I'll see if I can fiddle with the textile parser to make this less of a hassle.

Anyway, the upshot of this seems to be that complicated string substitutions like this are very difficult in the current version of Numbas. It's something to think about for the handlebars branch.