Fix Theorem Environment
The fixRunIn() Javascript method assumed that the next element after the header was a 'p' element. Reported by Andrew Stacey.
This commit is contained in:
parent
f6d350302c
commit
22a27c8391
|
@ -23,15 +23,22 @@ function fixRunIn() {
|
||||||
// work around lack of gecko support for display:run-in
|
// work around lack of gecko support for display:run-in
|
||||||
var re = /^num_|\s+num_|^un_|\s+un_|proof/;
|
var re = /^num_|\s+num_|^un_|\s+un_|proof/;
|
||||||
$$('div > h6').each(function(element) {
|
$$('div > h6').each(function(element) {
|
||||||
if(re.test($(element.parentNode).className)) {
|
next_p = element.next('p');
|
||||||
|
if(re.test($(element.parentNode).className)) {
|
||||||
var new_span = new Element('span').update(element.textContent);
|
var new_span = new Element('span').update(element.textContent);
|
||||||
new_span.addClassName('theorem_label');
|
new_span.addClassName('theorem_label');
|
||||||
var next_el = element.next().firstChild;
|
|
||||||
next_el.parentNode.insertBefore(new_span, next_el);
|
|
||||||
var period = new Element('span').update('. ');
|
var period = new Element('span').update('. ');
|
||||||
next_el.parentNode.insertBefore(period, next_el);
|
if (next_p) {
|
||||||
element.remove();
|
var next_el = next_p.firstChild;
|
||||||
}
|
next_p.insertBefore(new_span, next_el);
|
||||||
|
next_p.insertBefore(period, next_el);
|
||||||
|
element.remove();
|
||||||
|
} else {
|
||||||
|
var p = new Element('p').update(new_span);
|
||||||
|
p.appendChild(period);
|
||||||
|
element.replace(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// add tombstone to proof, since gecko doesn't support :last-child properly
|
// add tombstone to proof, since gecko doesn't support :last-child properly
|
||||||
$$('div.proof').each(function(element) {
|
$$('div.proof').each(function(element) {
|
||||||
|
|
Loading…
Reference in a new issue