diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-08-01 17:18:07 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-08-01 17:22:24 +0300 |
commit | d8a4e3719e300869759393e9df7dd473f15be781 (patch) | |
tree | 7781fd56761a5c33befb34ca5eaf16ad9e9970ae /testdata | |
parent | a85089f4495839590c791c02c833cd0f9b49733e (diff) | |
download | wikitrans-d8a4e3719e300869759393e9df7dd473f15be781.tar.gz wikitrans-d8a4e3719e300869759393e9df7dd473f15be781.tar.bz2 |
Fix wiki2text
* WikiTrans/wiki2html.py (HtmlTextNode): Escape html entities
* WikiTrans/wiki2text.py: Remove the format method.
* testdata/headings.html: Fix.
* testdata/nowiki-tag.html: Fix.
* tests/test.py: Rename to tests/test-html.py
* tests/test-text.py: New file.
* testdata/bold.text: New file.
* testdata/boldit1.text: New file.
* testdata/boldit2.text: New file.
* testdata/boldit3.text: New file.
* testdata/colon.text: New file.
* testdata/deflist.text: New file.
* testdata/headings.text: New file.
* testdata/hz.text: New file.
* testdata/it.text: New file.
* testdata/itbold1.text: New file.
* testdata/itbold2.text: New file.
* testdata/itbold3.text: New file.
* testdata/nowiki-ind.text: New file.
* testdata/nowiki-tag.text: New file.
* testdata/nowiki.text: New file.
* testdata/numlist.text: New file.
* testdata/para.text: New file.
* testdata/unlist.text: New file.
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/bold.text | 3 | ||||
-rw-r--r-- | testdata/boldit1.text | 3 | ||||
-rw-r--r-- | testdata/boldit2.text | 3 | ||||
-rw-r--r-- | testdata/boldit3.text | 3 | ||||
-rw-r--r-- | testdata/colon.text | 8 | ||||
-rw-r--r-- | testdata/deflist.text | 7 | ||||
-rw-r--r-- | testdata/headings.html | 2 | ||||
-rw-r--r-- | testdata/headings.text | 20 | ||||
-rw-r--r-- | testdata/hz.text | 8 | ||||
-rw-r--r-- | testdata/it.text | 3 | ||||
-rw-r--r-- | testdata/itbold1.text | 3 | ||||
-rw-r--r-- | testdata/itbold2.text | 3 | ||||
-rw-r--r-- | testdata/itbold3.text | 3 | ||||
-rw-r--r-- | testdata/nowiki-ind.text | 7 | ||||
-rw-r--r-- | testdata/nowiki-tag.html | 3 | ||||
-rw-r--r-- | testdata/nowiki-tag.text | 3 | ||||
-rw-r--r-- | testdata/nowiki.text | 3 | ||||
-rw-r--r-- | testdata/numlist.text | 9 | ||||
-rw-r--r-- | testdata/para.text | 6 | ||||
-rw-r--r-- | testdata/unlist.text | 12 |
20 files changed, 110 insertions, 2 deletions
diff --git a/testdata/bold.text b/testdata/bold.text new file mode 100644 index 0000000..30042f6 --- /dev/null +++ b/testdata/bold.text @@ -0,0 +1,3 @@ +now is the time for ALL GOOD men to come to + + diff --git a/testdata/boldit1.text b/testdata/boldit1.text new file mode 100644 index 0000000..adad116 --- /dev/null +++ b/testdata/boldit1.text @@ -0,0 +1,3 @@ +A B _C_ D + + diff --git a/testdata/boldit2.text b/testdata/boldit2.text new file mode 100644 index 0000000..2ac53de --- /dev/null +++ b/testdata/boldit2.text @@ -0,0 +1,3 @@ +_A B_ C D + + diff --git a/testdata/boldit3.text b/testdata/boldit3.text new file mode 100644 index 0000000..27ebe3f --- /dev/null +++ b/testdata/boldit3.text @@ -0,0 +1,3 @@ +A B _C D_ + + diff --git a/testdata/colon.text b/testdata/colon.text new file mode 100644 index 0000000..b315cec --- /dev/null +++ b/testdata/colon.text @@ -0,0 +1,8 @@ + A colon (:) indents a line or paragraph. +A newline starts a new paragraph. Should only be used on talk pages. For +articles, you probably want the blockquote tag. + + We use 1 colon to indent once. + We use 2 colons to indent twice. + 3 colons to indent 3 times, and so on. + diff --git a/testdata/deflist.text b/testdata/deflist.text new file mode 100644 index 0000000..b04fa95 --- /dev/null +++ b/testdata/deflist.text @@ -0,0 +1,7 @@ + +item 1 + definition 1 +item 2 + definition 2-1 + definition 2-2 + diff --git a/testdata/headings.html b/testdata/headings.html index 445c821..9a8eaf0 100644 --- a/testdata/headings.html +++ b/testdata/headings.html @@ -5,7 +5,7 @@ sections. The Wiki software can automatically generate a <a href="http://pl.wiktionary.org/wiki/table%20of%20contents">table of contents</a> from them.</p> <h3>Subsection</h3> -<p>Using more "equals" (=) signs creates a subsection.</p> +<p>Using more "equals" (=) signs creates a subsection.</p> <h4>A smaller subsection</h4> <p>Don't skip levels, diff --git a/testdata/headings.text b/testdata/headings.text new file mode 100644 index 0000000..e6c30ea --- /dev/null +++ b/testdata/headings.text @@ -0,0 +1,20 @@ + +** Section headings + +_Headings_ organize your writing into sections. The Wiki software can +automatically generate a table of contents from them. + + +*** Subsection + +Using more "equals" (=) signs creates a subsection. + + +**** A smaller subsection + +Don't skip levels, like from two to four equals signs. + +Start with 2 equals signs not 1 because 1 creates H1 tags which should be +reserved for page title. + + diff --git a/testdata/hz.text b/testdata/hz.text new file mode 100644 index 0000000..bdc1764 --- /dev/null +++ b/testdata/hz.text @@ -0,0 +1,8 @@ +You can make horizontal dividing lines (----) to separate text. + + + ------------------------------------------------------------------------- +But you should usually use sections instead, so that they go in the table of +contents. + + diff --git a/testdata/it.text b/testdata/it.text new file mode 100644 index 0000000..3de3b6b --- /dev/null +++ b/testdata/it.text @@ -0,0 +1,3 @@ +now is the time for _all good_ men to come to + + diff --git a/testdata/itbold1.text b/testdata/itbold1.text new file mode 100644 index 0000000..ef1dee6 --- /dev/null +++ b/testdata/itbold1.text @@ -0,0 +1,3 @@ +_a b C d_ + + diff --git a/testdata/itbold2.text b/testdata/itbold2.text new file mode 100644 index 0000000..f4ec078 --- /dev/null +++ b/testdata/itbold2.text @@ -0,0 +1,3 @@ +_A B c d_ + + diff --git a/testdata/itbold3.text b/testdata/itbold3.text new file mode 100644 index 0000000..619c8af --- /dev/null +++ b/testdata/itbold3.text @@ -0,0 +1,3 @@ +_a b C D_ + + diff --git a/testdata/nowiki-ind.text b/testdata/nowiki-ind.text new file mode 100644 index 0000000..9d7c468 --- /dev/null +++ b/testdata/nowiki-ind.text @@ -0,0 +1,7 @@ +Para + +a b c + +para + + diff --git a/testdata/nowiki-tag.html b/testdata/nowiki-tag.html index 58b96fc..47edb4a 100644 --- a/testdata/nowiki-tag.html +++ b/testdata/nowiki-tag.html @@ -1 +1,2 @@ -<p>A <tag></p>
\ No newline at end of file +<p>A <tag></p> + diff --git a/testdata/nowiki-tag.text b/testdata/nowiki-tag.text new file mode 100644 index 0000000..1a9bf08 --- /dev/null +++ b/testdata/nowiki-tag.text @@ -0,0 +1,3 @@ +A <tag> + + diff --git a/testdata/nowiki.text b/testdata/nowiki.text new file mode 100644 index 0000000..7a6814f --- /dev/null +++ b/testdata/nowiki.text @@ -0,0 +1,3 @@ +#:version=1.0_rest_ of line + + diff --git a/testdata/numlist.text b/testdata/numlist.text new file mode 100644 index 0000000..869fd9b --- /dev/null +++ b/testdata/numlist.text @@ -0,0 +1,9 @@ + + 1. _Numbered lists_ are: + 1. Very organized + 2. Easy to follow +A newline marks the end of the list. + + + 1. New numbering starts with 1. + diff --git a/testdata/para.text b/testdata/para.text new file mode 100644 index 0000000..65ec74a --- /dev/null +++ b/testdata/para.text @@ -0,0 +1,6 @@ +First paragraph consists of two sentences. Each sentence occupies a line. + +Second paragraph consists of two sentences as well. Each of them, again, +occupies its own line. + + diff --git a/testdata/unlist.text b/testdata/unlist.text new file mode 100644 index 0000000..5745cb0 --- /dev/null +++ b/testdata/unlist.text @@ -0,0 +1,12 @@ + + - _Unordered lists_ are easy to do: + - Start every line with a star. + - More stars indicate a deeper level. + Previous item continues. + - A newline + - in a list +marks the end of the list. + + + - Of course you can start again. + |