jenkins-bot has submitted this change and it was merged.

Change subject: Don't crash on `;#`.
......................................................................


Don't crash on `;#`.

The article [[en:1988 in film]] contains `;#` -- which is a typo, what
is meant is `; #` (that is, the definition list term is "#").  But `;#`
generates `<dl><dt><ol><li>...` which confuses LaTeX.  Generate a
`\parbox` in this case so that even this broken markup works.

(Our test for whether the definition term is "too complicated" is
hacky.  A better one would be welcome.)

Change-Id: Ic45aff072660f4ad46b622fe90e4796c57eb16ab
---
M lib/index.js
A samples/1988.zip
M test/samples.js
3 files changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Arlolra: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/index.js b/lib/index.js
index d66c8bb..bfafcfa 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -933,6 +933,10 @@
 
 Visitor.prototype.visitDT = function(node) {
        var longDT = node.textContent.length > 60; // hackity hackity
+       var child = DomUtil.first_child(node);
+       if (child && /^(.L)$/.test(child.nodeName)) {
+               longDT = true;
+       }
        this.listInfo.sawDT = false;
        this.format.envBreak();
        this.format.writeDecorated('\\item[');
diff --git a/samples/1988.zip b/samples/1988.zip
new file mode 100644
index 0000000..3072b09
--- /dev/null
+++ b/samples/1988.zip
Binary files differ
diff --git a/test/samples.js b/test/samples.js
index 3034bfe..70c856a 100644
--- a/test/samples.js
+++ b/test/samples.js
@@ -34,7 +34,7 @@
 describe("Basic crash test", function() {
        var hasXeLaTeX = checkExecutable('xelatex');
        var hasJpegtran = checkExecutable('jpegtran');
-       ['tao.zip', 'hurricanes.zip', 'malayalam.zip', 'multiwiki.zip', 
'papier.zip', 'titlecrash.zip', 'us.zip', 'jabug.zip', 
'bug68854.zip'].forEach(function(bundle) {
+       ['tao.zip', 'hurricanes.zip', 'malayalam.zip', 'multiwiki.zip', 
'papier.zip', 'titlecrash.zip', 'us.zip', 'jabug.zip', 'bug68854.zip', 
'1988.zip'].forEach(function(bundle) {
                describe(bundle, function() {
                        var dest = hasXeLaTeX ? 'pdf' : 'tex';
                        it('should compile to '+dest, function() {

-- 
To view, visit https://gerrit.wikimedia.org/r/162140
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic45aff072660f4ad46b622fe90e4796c57eb16ab
Gerrit-PatchSet: 2
Gerrit-Project: 
mediawiki/extensions/Collection/OfflineContentGenerator/latex_renderer
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to