@@ -169,7 +169,6 @@ func TestEmphasis(t *testing.T) {
169169
170170 "*What is A\\ * algorithm?*\n " ,
171171 "<p><em>What is A* algorithm?</em></p>\n " ,
172-
173172 }
174173 doTestsInline (t , tests )
175174}
@@ -1075,7 +1074,7 @@ func TestNestedFootnotes(t *testing.T) {
10751074func TestInlineComments (t * testing.T ) {
10761075 var tests = []string {
10771076 "Hello <!-- there ->\n " ,
1078- "<p>Hello <!-- there - ></p>\n " ,
1077+ "<p>Hello <!— there – ></p>\n " ,
10791078
10801079 "Hello <!-- there -->\n " ,
10811080 "<p>Hello <!-- there --></p>\n " ,
@@ -1098,7 +1097,7 @@ func TestInlineComments(t *testing.T) {
10981097 "blahblah\n <!--- foo -->\n rhubarb\n " ,
10991098 "<p>blahblah\n <!--- foo -->\n rhubarb</p>\n " ,
11001099 }
1101- doTestsInlineParam (t , tests , 0 , 0 , HtmlRendererParameters {})
1100+ doTestsInlineParam (t , tests , 0 , HTML_USE_SMARTYPANTS | HTML_SMARTYPANTS_DASHES , HtmlRendererParameters {})
11021101}
11031102
11041103func TestCitationXML (t * testing.T ) {
@@ -1163,3 +1162,83 @@ func TestShortReferenceXML(t *testing.T) {
11631162 }
11641163 doTestsInlineXML (t , tests )
11651164}
1165+
1166+ func TestSmartDoubleQuotes (t * testing.T ) {
1167+ var tests = []string {
1168+ "this should be normal \" quoted\" text.\n " ,
1169+ "<p>this should be normal “quoted” text.</p>\n " ,
1170+ "this \" single double\n " ,
1171+ "<p>this “ single double</p>\n " ,
1172+ "two pair of \" some\" quoted \" text\" .\n " ,
1173+ "<p>two pair of “some” quoted “text”.</p>\n " }
1174+
1175+ doTestsInlineParam (t , tests , 0 , HTML_USE_SMARTYPANTS , HtmlRendererParameters {})
1176+ }
1177+
1178+ func TestSmartAngledDoubleQuotes (t * testing.T ) {
1179+ var tests = []string {
1180+ "this should be angled \" quoted\" text.\n " ,
1181+ "<p>this should be angled «quoted» text.</p>\n " ,
1182+ "this \" single double\n " ,
1183+ "<p>this « single double</p>\n " ,
1184+ "two pair of \" some\" quoted \" text\" .\n " ,
1185+ "<p>two pair of «some» quoted «text».</p>\n " }
1186+
1187+ doTestsInlineParam (t , tests , 0 , HTML_USE_SMARTYPANTS | HTML_SMARTYPANTS_ANGLED_QUOTES , HtmlRendererParameters {})
1188+ }
1189+
1190+ func TestSmartFractions (t * testing.T ) {
1191+ var tests = []string {
1192+ "1/2, 1/4 and 3/4; 1/4th and 3/4ths\n " ,
1193+ "<p>½, ¼ and ¾; ¼th and ¾ths</p>\n " ,
1194+ "1/2/2015, 1/4/2015, 3/4/2015; 2015/1/2, 2015/1/4, 2015/3/4.\n " ,
1195+ "<p>1/2/2015, 1/4/2015, 3/4/2015; 2015/1/2, 2015/1/4, 2015/3/4.</p>\n " }
1196+
1197+ doTestsInlineParam (t , tests , 0 , HTML_USE_SMARTYPANTS , HtmlRendererParameters {})
1198+
1199+ tests = []string {
1200+ "1/2, 2/3, 81/100 and 1000000/1048576.\n " ,
1201+ "<p><sup>1</sup>⁄<sub>2</sub>, <sup>2</sup>⁄<sub>3</sub>, <sup>81</sup>⁄<sub>100</sub> and <sup>1000000</sup>⁄<sub>1048576</sub>.</p>\n " ,
1202+ "1/2/2015, 1/4/2015, 3/4/2015; 2015/1/2, 2015/1/4, 2015/3/4.\n " ,
1203+ "<p>1/2/2015, 1/4/2015, 3/4/2015; 2015/1/2, 2015/1/4, 2015/3/4.</p>\n " }
1204+
1205+ doTestsInlineParam (t , tests , 0 , HTML_USE_SMARTYPANTS | HTML_SMARTYPANTS_FRACTIONS , HtmlRendererParameters {})
1206+ }
1207+
1208+ func TestDisableSmartDashes (t * testing.T ) {
1209+ doTestsInlineParam (t , []string {
1210+ "foo - bar\n " ,
1211+ "<p>foo - bar</p>\n " ,
1212+ "foo -- bar\n " ,
1213+ "<p>foo -- bar</p>\n " ,
1214+ "foo --- bar\n " ,
1215+ "<p>foo --- bar</p>\n " ,
1216+ }, 0 , 0 , HtmlRendererParameters {})
1217+ doTestsInlineParam (t , []string {
1218+ "foo - bar\n " ,
1219+ "<p>foo – bar</p>\n " ,
1220+ "foo -- bar\n " ,
1221+ "<p>foo — bar</p>\n " ,
1222+ "foo --- bar\n " ,
1223+ "<p>foo —– bar</p>\n " ,
1224+ }, 0 , HTML_USE_SMARTYPANTS | HTML_SMARTYPANTS_DASHES , HtmlRendererParameters {})
1225+ doTestsInlineParam (t , []string {
1226+ "foo - bar\n " ,
1227+ "<p>foo - bar</p>\n " ,
1228+ "foo -- bar\n " ,
1229+ "<p>foo – bar</p>\n " ,
1230+ "foo --- bar\n " ,
1231+ "<p>foo — bar</p>\n " ,
1232+ }, 0 , HTML_USE_SMARTYPANTS | HTML_SMARTYPANTS_LATEX_DASHES | HTML_SMARTYPANTS_DASHES ,
1233+ HtmlRendererParameters {})
1234+ doTestsInlineParam (t , []string {
1235+ "foo - bar\n " ,
1236+ "<p>foo - bar</p>\n " ,
1237+ "foo -- bar\n " ,
1238+ "<p>foo -- bar</p>\n " ,
1239+ "foo --- bar\n " ,
1240+ "<p>foo --- bar</p>\n " ,
1241+ }, 0 ,
1242+ HTML_USE_SMARTYPANTS | HTML_SMARTYPANTS_LATEX_DASHES ,
1243+ HtmlRendererParameters {})
1244+ }
0 commit comments