typograph 0.0.1.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ �������� "������", "���������" � "������� ���".
2
+ �������� �������, ����������� � �������� ���.
3
+
4
+ ��������: "�������� ������ "����" ���!" ������
5
+ ��������: ��������� ������ ������ ���!� ������
6
+
7
+ "word "word" word"
8
+ �word �word� word�
9
+
10
+ ("�����")
11
+ (������)
12
+
13
+ asd"test"asd
14
+ asd �test� asd
15
+
16
+ "������ � ���� � ����� �����";
17
+ ������� � ���� � ����� �����;
18
+
19
+ �� �������������� "quot" ������� � ������, � ������.
20
+ �� �������������� �quot� ������� � ������, � ������.
21
+
22
+ �� �������������� ������� ������� � ������, � ������.
23
+ �� �������������� ������� ������� � ������, � ������.
24
+
25
+ ��������軻
26
+ ��������蓻
27
+
28
+ "����� "�����"!"
29
+ ������ ������!�
30
+
31
+ <b>"�����"</b> <b>"�����"</b>
32
+ <b>������</b> <b>������</b>
33
+
34
+ "��"
35
+ ���
@@ -0,0 +1,83 @@
1
+ 1/2 3/4 1/4
2
+ &frac12; &frac34; &frac14;
3
+
4
+ (c)Microsoft 2000
5
+ �Microsoft 2000
6
+
7
+ Microsft(tm)
8
+ Microsft<sup>�</sup>
9
+
10
+ Microsoft(r)
11
+ Microsoft<sup><small>�</small></sup>
12
+
13
+ 3�4, 3 � 6
14
+ 3&times;4, 3&times;6
15
+
16
+ 10*12
17
+ 10&times;12
18
+
19
+ 10X12
20
+ 10&times;12
21
+
22
+ 10x12
23
+ 10&times;12
24
+
25
+ 10�12
26
+ 10&times;12
27
+
28
+ 10�12
29
+ 10&times;12
30
+
31
+ <-
32
+ &larr;
33
+
34
+ ->
35
+ &rarr;
36
+
37
+ -->
38
+ -->
39
+
40
+ <--
41
+ <--
42
+
43
+ +-10 ������
44
+ &plusmn;10&nbsp;������
45
+
46
+ 100 %
47
+ 100%
48
+
49
+ ����� !!!
50
+ �����!!!
51
+
52
+ ����� !
53
+ �����!
54
+
55
+ ����� !?
56
+ �����?!
57
+
58
+ ����� !!?
59
+ �����?!
60
+
61
+ ����� .
62
+ �����.
63
+
64
+ ���������� .net
65
+ ���������� .net
66
+
67
+ ����� ?
68
+ �����?
69
+
70
+ ����� :
71
+ �����:
72
+
73
+ "�����" :
74
+ ������:
75
+
76
+ ���!!!
77
+ ���!!!
78
+
79
+ ��???
80
+ ��???
81
+
82
+ ���!!! ! !! ! !
83
+ ���!!!
@@ -0,0 +1,2 @@
1
+ ������� ���������� ��"Vista" ������� ���� ����� ������������?
2
+ �����&nbsp;�� ���������� ��&nbsp;�Vista� �&nbsp;������ ���� ����� ������������?
@@ -0,0 +1,39 @@
1
+ # encoding: utf-8
2
+ # $KCODE = "utf-8" if defined?($KCODE)
3
+
4
+ require "typograph"
5
+ require "rspec"
6
+
7
+ # base_path = File.expand_path('../data', __FILE__);
8
+ # Dir.glob(base_path + "/_test.*.dat") do |file|
9
+ # test_name = File.basename(file, ".dat").gsub('_test.', '')
10
+ # describe test_name do
11
+ # test_data = File.open(file, "r:CP1251").read.encode("UTF-8").split("\n\n")
12
+ # test_data.each do |test_item|
13
+ # test_item = test_item.split("\n")
14
+ # input = test_item[0]
15
+ # expected = test_item[1]
16
+ # it input do
17
+ # Typograph.process(input).should eq expected
18
+ # end
19
+ # end
20
+ # end
21
+ # end
22
+
23
+ require 'xmlsimple'
24
+
25
+ base_path = File.expand_path('../xml', __FILE__);
26
+ Dir.glob(base_path + "/*.xml") do |file|
27
+ test_data = XmlSimple.xml_in(File.open(file, "r:UTF-8"))
28
+ test_data['group'].each do |group|
29
+ describe group['description'] do
30
+ group['test'].each do |test|
31
+ input = test['input'][0]
32
+ expected = test['expected'][0]
33
+ it input do
34
+ Typograph.process(input).should eq expected
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
data/spec/xml/core.xml ADDED
@@ -0,0 +1,107 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Typographus core tests
4
+ Author: Alexander Makarov
5
+ -->
6
+ <tests>
7
+ <group>
8
+ <description>Тесты ядра (обход HTML)</description>
9
+ <test>
10
+ <input><![CDATA[<span class="test">тест - тест</span>]]></input>
11
+ <expected><![CDATA[<span class="test">тест&nbsp;— тест</span>]]></expected>
12
+ </test>
13
+ <test>
14
+ <!--<name>Тест на обход HTML ядром типографа 2</name>-->
15
+ <input><![CDATA[<code class="php">тест - тест</code>]]></input>
16
+ <expected><![CDATA[<code class="php">тест - тест</code>]]></expected>
17
+ </test>
18
+ <test>
19
+ <input><![CDATA[<i>тест - тест</i>]]></input>
20
+ <expected><![CDATA[<i>тест&nbsp;— тест</i>]]></expected>
21
+ </test>
22
+ <test>
23
+ <input><![CDATA[<b aaa="1">]]></input>
24
+ <expected><![CDATA[<b aaa="1">]]></expected>
25
+ </test>
26
+ <test>
27
+ <input><![CDATA[<b aaa="1" bbb="2">]]></input>
28
+ <expected><![CDATA[<b aaa="1" bbb="2">]]></expected>
29
+ </test>
30
+ <test>
31
+ <input><![CDATA[<b aaa="1" bbb="2" ccc="3">]]></input>
32
+ <expected><![CDATA[<b aaa="1" bbb="2" ccc="3">]]></expected>
33
+ </test>
34
+ <test>
35
+ <input><![CDATA[<b aaa="1" bbb="2" ccc="3" ddd="4">]]></input>
36
+ <expected><![CDATA[<b aaa="1" bbb="2" ccc="3" ddd="4">]]></expected>
37
+ </test>
38
+ <test>
39
+ <input><![CDATA[123 <img alt=":)" src="/images/smiles/smile.gif"> 123]]></input>
40
+ <expected><![CDATA[123 <img alt=":)" src="/images/smiles/smile.gif"> 123]]></expected>
41
+ </test>
42
+ <test>
43
+ <input><![CDATA[<img alt=":)" src="/images/smiles/smile.gif">]]></input>
44
+ <expected><![CDATA[<img alt=":)" src="/images/smiles/smile.gif">]]></expected>
45
+ </test>
46
+ <test>
47
+ <input><![CDATA[<a href="http://www.professionalconsulting.ru/blog/realcms/">"CMS на самом деле"</a>]]></input>
48
+ <expected><![CDATA[<a href="http://www.professionalconsulting.ru/blog/realcms/">«CMS на&nbsp;самом деле»</a>]]></expected>
49
+ </test>
50
+ <test>
51
+ <input><![CDATA[<img width="200" height="150" src="/images/cds.jpg" alt="/images/cds.jpg">]]></input>
52
+ <expected><![CDATA[<img width="200" height="150" src="/images/cds.jpg" alt="/images/cds.jpg">]]></expected>
53
+ </test>
54
+ <test>
55
+ <input><![CDATA[<b>"done"</b>]]></input>
56
+ <expected><![CDATA[<b>«done»</b>]]></expected>
57
+ </test>
58
+ <test>
59
+ <input><![CDATA["word" <pre as="is" is="as">"q"</pre> "word"]]></input>
60
+ <expected><![CDATA[«word» <pre as="is" is="as">"q"</pre> «word»]]></expected>
61
+ </test>
62
+ <test>
63
+ <input><![CDATA["word" <pre as="is" is="as">word</pre> "word"]]></input>
64
+ <expected><![CDATA[«word» <pre as="is" is="as">word</pre> «word»]]></expected>
65
+ </test>
66
+ <test>
67
+ <input><![CDATA[doo "bee" <!-- doo "bee" --> doo]]></input>
68
+ <expected><![CDATA[doo «bee» <!-- doo "bee" --> doo]]></expected>
69
+ </test>
70
+ <test>
71
+ <input><![CDATA[(c) <pre>(c)</pre> (c) <pre>(c)</pre> (c)]]></input>
72
+ <expected><![CDATA[© <pre>(c)</pre> © <pre>(c)</pre> ©]]></expected>
73
+ </test>
74
+ <test>
75
+ <input><![CDATA[(c) <pre>(c)</pre> (c) (c)]]></input>
76
+ <expected><![CDATA[© <pre>(c)</pre> © ©]]></expected>
77
+ </test>
78
+ <test>
79
+ <input><![CDATA[word "<a href="http://url.ru/">word</a>".]]></input>
80
+ <expected><![CDATA[word «<a href="http://url.ru/">word</a>».]]></expected>
81
+ </test>
82
+ <test>
83
+ <input><![CDATA[radio "<a href="http://ya.ru/">voice of africa</a>" ddddd]]></input>
84
+ <expected><![CDATA[radio «<a href="http://ya.ru/">voice of africa</a>» ddddd]]></expected>
85
+ </test>
86
+ <test>
87
+ <input><![CDATA["text" <pre> "code" </pre> "text"]]></input>
88
+ <expected><![CDATA[«text» <pre> "code" </pre> «text»]]></expected>
89
+ </test>
90
+ <test>
91
+ <input><![CDATA[text <a href="htrt" b="sdf">kiss "me" </a> text]]></input>
92
+ <expected><![CDATA[text <a href="htrt" b="sdf">kiss «me» </a> text]]></expected>
93
+ </test>
94
+ <test>
95
+ <input><![CDATA["<a href="http://rmc.net.ru/article/photo/001/">Фотография</a>"]]></input>
96
+ <expected><![CDATA[«<a href="http://rmc.net.ru/article/photo/001/">Фотография</a>»]]></expected>
97
+ </test>
98
+ <test>
99
+ <input><![CDATA[Сегодня был создан раздел "<a href="http://rmc.net.ru/article/photo/001/">Фотография</a>", куда будут выкладываться сделанные нами фото.]]></input>
100
+ <expected><![CDATA[Сегодня был создан раздел «<a href="http://rmc.net.ru/article/photo/001/">Фотография</a>», куда будут выкладываться сделанные нами фото.]]></expected>
101
+ </test>
102
+ <test>
103
+ <input><![CDATA[<img src="http://dash-domain-here.com" alt="http://dash-domain-here.com">]]></input>
104
+ <expected><![CDATA[<img src="http://dash-domain-here.com" alt="http://dash-domain-here.com">]]></expected>
105
+ </test>
106
+ </group>
107
+ </tests>