-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from ntadej/legacy-dialects
Support older versions of Discourse
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
(function() { | ||
// Don't bother with this code if the new dialect system is present | ||
if (Discourse.dialect_deprecated) { return; } | ||
|
||
Discourse.Dialect.inlineBetween({ | ||
start: '\\(', | ||
stop: '\\)', | ||
rawContents: true, | ||
emitter: function (contents) { | ||
return '\\(' + contents + '\\)'; | ||
} | ||
}); | ||
|
||
Discourse.Dialect.inlineBetween({ | ||
start: '\\[', | ||
stop: '\\]', | ||
rawContents: true, | ||
emitter: function (contents) { | ||
return '\\[' + contents + '\\]'; | ||
} | ||
}); | ||
|
||
Discourse.Dialect.inlineBetween({ | ||
start: '$$', | ||
stop: '$$', | ||
rawContents: true, | ||
emitter: function (contents) { | ||
return '$$' + contents + '$$'; | ||
} | ||
}); | ||
|
||
|
||
Discourse.Dialect.inlineBetween({ | ||
start: '$', | ||
stop: '$', | ||
rawContents: true, | ||
emitter: function (contents) { | ||
return '$' + contents + '$'; | ||
} | ||
}); | ||
|
||
Discourse.Dialect.inlineRegexp({ | ||
start: '\\begin', | ||
matcher: /(\\begin{[\S\s]+})([\S\s]*)(\\end{[\S\s]+})/, | ||
emitter: function (matches) { | ||
return matches[0]; | ||
} | ||
}); | ||
|
||
//these last two are to make asciimath support possible | ||
|
||
Discourse.Dialect.inlineBetween({ | ||
start: 'ˊˊ', | ||
stop: 'ˊˊ', | ||
rawContents: true, | ||
emitter: function (contents) { | ||
return 'ˊˊ' + contents + 'ˊˊ'; | ||
} | ||
}); | ||
|
||
Discourse.Dialect.inlineBetween({ | ||
start: 'ˊ', | ||
stop: 'ˊ', | ||
rawContents: true, | ||
emitter: function (contents) { | ||
return 'ˊ' + contents + 'ˊ'; | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# name: MathJax support for Discourse | ||
# version: 0.4.1 | ||
# authors: Sam Saffron, Kasper Peulen | ||
|
||
register_asset('javascripts/tex_dialect.js', :server_side) |