UTF-8 Bug

Create a test case for utf-8 bug reported by Diego Restrepo. Seems to be related to WikiWord chunk handling.
Add some other tests, and fix a minor bug in vendor/plugins/maruku/lib/maruku/ext/math/latex_fix.rb.
This commit is contained in:
Jacques Distler 2007-10-26 00:48:43 -05:00
parent a92b593949
commit 8ce5016b41
4 changed files with 14 additions and 5 deletions

View file

@ -50,7 +50,7 @@ home_page_second_revision:
updated_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %> updated_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %>
revised_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %> revised_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %>
page_id: 1 page_id: 1
content: HisWay would be MyWay in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEngine in that SmartEngineGUI content: HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEngine in that SmartEngineGUI
author: DavidHeinemeierHansson author: DavidHeinemeierHansson
first_page_first_revision: first_page_first_revision:
@ -59,7 +59,7 @@ first_page_first_revision:
updated_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %> updated_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %>
revised_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %> revised_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %>
page_id: 6 page_id: 6
content: HisWay would be MyWay in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI content: HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}$ in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI
author: DavidHeinemeierHansson author: DavidHeinemeierHansson
oak_first_revision: oak_first_revision:

View file

@ -702,7 +702,6 @@ class WikiControllerTest < Test::Unit::TestCase
% Because of conflicts, \space and \mathop are converted to % Because of conflicts, \space and \mathop are converted to
% \itexspace and \operatorname during preprocessing. % \itexspace and \operatorname during preprocessing.
% \over is simply unsupported.
% itex: \space{ht}{dp}{wd} % itex: \space{ht}{dp}{wd}
% %
@ -868,7 +867,7 @@ class WikiControllerTest < Test::Unit::TestCase
\section*{HomePage} \section*{HomePage}
HisWay would be MyWay in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI HisWay would be MyWay $\sin(x) $ in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI

View file

@ -66,6 +66,16 @@ class PageRendererTest < Test::Unit::TestCase
%{Smart Engine GUI<a href="../show/SmartEngineGUI">?</a></span></p>}, %{Smart Engine GUI<a href="../show/SmartEngineGUI">?</a></span></p>},
"#My Headline#\n\nthat SmartEngineGUI") "#My Headline#\n\nthat SmartEngineGUI")
assert_markup_parsed_as(
%{ecuasi\303\263n <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'>} +
%{<mi>sin</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></math>},
"ecuasi\303\263n $\\sin(x)$")
assert_markup_parsed_as(
%{ecuasi\303\263n <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>} +
%{<mi>sin</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><semantics><annotation-xml encoding="SVG1.1"><svg/></annotation-xml></semantics></math>},
"$$\\sin(x) \\begin{svg}<svg/>\\end{svg}$$")
code_block = [ code_block = [
'This is a code block:', 'This is a code block:',
'', '',

View file

@ -3,7 +3,7 @@ class String
def fix_latex def fix_latex
if #{html_math_engine} == 'itex2mml' if #{html_math_engine} == 'itex2mml'
s = self.gsub("\\mathop{", "\\operatorname{") s = self.gsub("\\mathop{", "\\operatorname{")
s.gsub!(/\\begin{svg}.*?\\end{svg}/m, " ") s.gsub!(/\\begin\{svg\}.*?\\end\{svg\}/m, " ")
s.gsub("\\space{", "\\itexspace{") s.gsub("\\space{", "\\itexspace{")
else else
self self