default-markup.t 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # Copyright (C) 2006, 2009 Alex Schroeder <alex@gnu.org>
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. require './t/test.pl';
  16. package OddMuse;
  17. use Test::More tests => 60;
  18. update_page('InterMap', " OddMuse http://www.emacswiki.org/cgi-bin/oddmuse.pl?\n PlanetMath http://planetmath.org/encyclopedia/%s.html", 'required', 0, 1);
  19. # non links
  20. $NetworkFile = 1;
  21. $WikiLinks = 1;
  22. run_tests(split('\n',<<'EOT'));
  23. do not eat 0 from text
  24. do not eat 0 from text
  25. ordinary text
  26. ordinary text
  27. paragraph\n\nparagraph
  28. paragraph<p>paragraph</p>
  29. * one\n*two
  30. <ul><li>one *two</li></ul>
  31. * one\n\n*two
  32. <ul><li>one</li></ul><p>*two</p>
  33. * one\n** two
  34. <ul><li>one<ul><li>two</li></ul></li></ul>
  35. * one\n** two\n*** three\n* four
  36. <ul><li>one<ul><li>two<ul><li>three</li></ul></li></ul></li><li>four</li></ul>
  37. * one\n** two\n*** three\n* four\n** five\n* six
  38. <ul><li>one<ul><li>two<ul><li>three</li></ul></li></ul></li><li>four<ul><li>five</li></ul></li><li>six</li></ul>
  39. * one\n* two\n** one and two\n** two and three\n* three
  40. <ul><li>one</li><li>two<ul><li>one and two</li><li>two and three</li></ul></li><li>three</li></ul>
  41. * one and *\n* two and * more
  42. <ul><li>one and *</li><li>two and * more</li></ul>
  43. Foo::Bar
  44. Foo::Bar
  45. !WikiLink
  46. WikiLink
  47. !foo
  48. !foo
  49. file:///home/foo/tutorial.pdf
  50. file:///home/foo/tutorial.pdf
  51. named entities: &gt;
  52. named entities: &gt;
  53. garbage: &
  54. garbage: &amp;
  55. numbered entity: &#123;
  56. numbered entity: &#123;
  57. numbered hex entity: &#x123;
  58. numbered hex entity: &#x123;
  59. named entity: &copy;
  60. named entity: &copy;
  61. quoted named entity: &amp;copy;
  62. quoted named entity: &amp;copy;
  63. case: &Auml;
  64. case: &Auml;
  65. EOT
  66. test_page(update_page('entity', 'quoted named entity: &amp;copy;'),
  67. 'quoted named entity: &amp;copy;');
  68. # links and other attributes containing attributes
  69. %Smilies = ('HAHA!' => '/pics/haha.png',
  70. '&lt;3' => '/pics/heart.png',
  71. ':"\(' => '/pics/cat.png');
  72. xpath_run_tests(split('\n',<<'EOT'));
  73. HAHA!
  74. //img[@class="smiley"][@src="/pics/haha.png"][@alt="HAHA!"]
  75. i <3 you
  76. //img[@class="smiley"][@src="/pics/heart.png"][@alt="<3"]
  77. :"(
  78. //img[@class="smiley"][@src="/pics/cat.png"][@alt=':"(']
  79. WikiWord
  80. //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=WikiWord"][text()="?"]
  81. WikiWord:
  82. //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=WikiWord"][text()="?"]/following-sibling::text()[string()=":"]
  83. OddMuse
  84. //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OddMuse"][text()="?"]
  85. OddMuse:
  86. //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OddMuse"][text()="?"]/following-sibling::text()[string()=":"]
  87. OddMuse:test
  88. //a[@class="inter OddMuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span[@class="site"][text()="OddMuse"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="interpage"][text()="test"]
  89. OddMuse:test: or not
  90. //a[@class="inter OddMuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span[@class="site"][text()="OddMuse"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="interpage"][text()="test"]
  91. OddMuse:test, and foo
  92. //a[@class="inter OddMuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span[@class="site"][text()="OddMuse"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="interpage"][text()="test"]
  93. PlanetMath:ZipfsLaw, and foo
  94. //a[@class="inter PlanetMath"][@href="http://planetmath.org/encyclopedia/ZipfsLaw.html"]/span[@class="site"][text()="PlanetMath"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="interpage"][text()="ZipfsLaw"]
  95. [OddMuse:test]
  96. //a[@class="inter OddMuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
  97. ![[Free Link]]
  98. //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=Free_Link"][text()="?"]
  99. http://www.emacswiki.org
  100. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]
  101. <http://www.emacswiki.org>
  102. //text()[string()="<"]/following-sibling::a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=">"]
  103. http://www.emacswiki.org/
  104. //a[@class="url http"][@href="http://www.emacswiki.org/"][text()="http://www.emacswiki.org/"]
  105. http://www.emacswiki.org.
  106. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="."]
  107. http://www.emacswiki.org,
  108. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=","]
  109. http://www.emacswiki.org;
  110. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=";"]
  111. http://www.emacswiki.org:
  112. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=":"]
  113. http://www.emacswiki.org?
  114. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="?"]
  115. http://www.emacswiki.org/?
  116. //a[@class="url http"][@href="http://www.emacswiki.org/"][text()="http://www.emacswiki.org/"]/following-sibling::text()[string()="?"]
  117. http://www.emacswiki.org!
  118. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="!"]
  119. http://www.emacswiki.org'
  120. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="'"]
  121. http://www.emacswiki.org"
  122. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()='"']
  123. http://www.emacswiki.org!
  124. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="!"]
  125. http://www.emacswiki.org(
  126. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="("]
  127. http://www.emacswiki.org)
  128. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=")"]
  129. http://www.emacswiki.org&
  130. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="&"]
  131. http://www.emacswiki.org#
  132. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="#"]
  133. http://www.emacswiki.org%
  134. //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="%"]
  135. [http://www.emacswiki.org]
  136. //a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
  137. [http://www.emacswiki.org] and [http://www.emacswiki.org]
  138. //a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]/../../following-sibling::text()[string()=" and "]/following-sibling::a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="2"]/following-sibling::span[@class="bracket"][text()="]"]
  139. [http://www.emacswiki.org],
  140. //a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
  141. [http://www.emacswiki.org and a label]
  142. //a[@class="url http outside"][@href="http://www.emacswiki.org"][text()="and a label"]
  143. [file://home/foo/tutorial.pdf local link]
  144. //a[@class="url file outside"][@href="file://home/foo/tutorial.pdf"][text()="local link"]
  145. file://home/foo/tutorial.pdf
  146. //a[@class="url file"][@href="file://home/foo/tutorial.pdf"][text()="file://home/foo/tutorial.pdf"]
  147. mailto:alex@emacswiki.org
  148. //a[@class="url mailto"][@href="mailto:alex@emacswiki.org"][text()="mailto:alex@emacswiki.org"]
  149. EOT