Commits

step...@a60eed84-fc3d-0410-a09c-0d1a7a6707c9  committed ec9382d

links can include mark-up
creole_to_xhtml has no_wiki_monospace=True and use_additions=True
version moved to 0.2.1

  • Participants
  • Parent commits a501474

Comments (0)

Files changed (5)

-version 0.21
-(Nov ?? 2007)
+Version 0.2.1 (Nov 6 2007)
+--------------------------
+
+ * links can include mark-up
+ * creole_to_xhtml has no_wiki_monospace=True and use_additions=True
+ * fixed bug with bad links
+ * removed lone line break as an element (it wasn't valid xhtml)
+ * stopped inserting \n's after <br />'s
+ * wiki_links_space_char option added to dialects.Creole10
  * added inline_no_wiki_monospace option to dialects.Creole10 
  * refactored core.pre_escape()
  * CHANGES.txt, LISCENCE.txt, and INSTALL.txt added to distribution
  * implemented monospace (##) (for use_additions option only) 
 
 
-Version 0.2
-(Oct 26 2007)
+Version 0.2 (Oct 26 2007)
+-------------------------
 
  * module split into separate files to create the creoleparser package
  * other refactoring
 
 
-Version 0.1, 0.1.1, 0.1.2
-(Oct 2007)
+Version 0.1, 0.1.1, 0.1.2 (Oct 2007)
+------------------------------------
 
  * First public releases

File creoleparser/__init__.py

 
 
 creole_to_xhtml = Parser(dialect=Creole10(wiki_links_base_url='http://www.wikicreole.org/wiki/',
-                             interwiki_links_base_urls={'Ohana':'http://wikiohana.net/cgi-bin/wiki.pl/'}))
+                             interwiki_links_base_urls={'Ohana':'http://wikiohana.net/cgi-bin/wiki.pl/'},
+                         use_additions=True))
 """This is a parser created for convenience"""
 
+text2html = creole_to_xhtml
 
 def _test():
     import doctest

File creoleparser/dialects.py

 
     def __init__(self,wiki_links_base_url='http://',wiki_links_space_char='_',
                  interwiki_links_base_urls={},
-                 no_wiki_monospace=False, use_additions=False):
+                 no_wiki_monospace=True, use_additions=False):
         """Constructor for Creole10 oblects.
 
         Most attributes of new Creole objects are derived from the WikiElement
         self.link = Link('a',('[[',']]'),[],delimiter='|',
                         link_types=[self.http_link,self.interwiki_link,self.wiki_link])
         self.strong = InlineElement('strong', '**',[])
-        self.em = InlineElement('em', '//',[self.strong,self.br,self.link,self.img,self.http_link])
+        self.em = InlineElement('em', '//',[])
         if no_wiki_monospace:
             no_wiki_tag = 'tt'
         else:
             no_wiki_tag = 'span'
         self.no_wiki = NoWikiElement(no_wiki_tag,['{{{','}}}'],[])
-        self.strong.child_tags = [self.em,self.br,self.link,self.img,self.http_link]
-        self.link.child_tags = [(self.strong, self.em), self.img]
+        #self.strong.child_tags = [self.em,self.br,self.link,self.img,self.http_link]
+        #self.link.child_tags = [(self.strong, self.em), self.img]
 
         if use_additions:
-            self.tt = InlineElement('tt', '##',[(self.strong,self.em),self.br,self.link,self.img,self.http_link])
-            self.strong.child_tags = [(self.em,self.tt),self.br,self.link,self.img,self.http_link]
-            self.em.child_tags = [(self.strong,self.tt),self.br,self.link,self.img,self.http_link]
+            self.tt = InlineElement('tt', '##',[(self.strong,self.em,self.link),self.br,self.img,self.http_link])
+            self.strong.child_tags = [(self.em,self.tt,self.link),self.br,self.img,self.http_link]
+            self.em.child_tags = [(self.strong,self.tt,self.link),self.br,self.img,self.http_link]
             self.link.child_tags = [(self.strong, self.em,self.tt), self.img]
-            header_children = [self.no_wiki,(self.strong, self.em, self.tt), self.br,self.link,self.img,self.http_link]
+            header_children = [self.no_wiki,(self.strong, self.em, self.tt,self.link),
+                               self.br,self.img,self.http_link]
 
         else:
-            self.strong.child_tags = [self.em,self.br,self.link,self.img,self.http_link]
+            self.em.child_tags = [(self.strong,self.link),self.br,self.img,self.http_link]
+            self.strong.child_tags = [(self.em,self.link),self.br,self.img,self.http_link]
             self.link.child_tags = [(self.strong, self.em), self.img]
-            header_children = [self.no_wiki,(self.strong, self.em), self.br,self.link,self.img,self.http_link]
+            header_children = [self.no_wiki,(self.strong, self.em, self.link),
+                               self.br,self.img,self.http_link]
                 
         self.hr = LoneElement('hr','----',[])
         #self.lone_br = LoneElement('br',r'\\',[])

File creoleparser/tests.py

     assert creole_to_xhtml('steve **is strong**\n{{{\nnot **weak**\n}}}\n') == \
             '<p>steve <strong>is strong</strong></p>\n<pre>not **weak**\n</pre>\n'
     assert creole_to_xhtml('{{{no **wiki** in here}}} but //here// is fine') == \
-            '<p><span>no **wiki** in here</span> but <em>here</em> is fine</p>\n'
+            '<p><tt>no **wiki** in here</tt> but <em>here</em> is fine</p>\n'
     assert creole_to_xhtml('steve **is strong //you know\n dude{{{not **weak**}}}\n') == \
-            '<p>steve <strong>is strong <em>you know\n dude</em></strong><span>not **weak**</span></p>\n'
+            '<p>steve <strong>is strong <em>you know\n dude</em></strong><tt>not **weak**</tt></p>\n'
 
     assert creole_to_xhtml(
 r"""   |= Item|= Size|= Price |
 </table>
 """
 
+    assert creole_to_xhtml("\
+Names of pages have to LookLikeThis.\r\nIt's called a WikiName.\r\nIf you write\
+ a word that LookLikeThis.\r\n") == """\
+<p>Names of pages have to LookLikeThis.
+It's called a WikiName.
+If you write a word that LookLikeThis.</p>
+"""
+
     assert creole_to_xhtml(r"""
 {{{
 ** some ** unformatted {{{ stuff }}} ~~~
 
     assert creole_to_xhtml("""\
 {{{** some ** unformatted {{{ stuff ~~ }}}}}}""") == """\
-<p><span>** some ** unformatted {{{ stuff ~~ }}}</span></p>
+<p><tt>** some ** unformatted {{{ stuff ~~ }}}</tt></p>
 """
 
     assert creole_to_xhtml("""\
 """
 
 def test_no_wiki_monospace_option():
-    dialect = Creole10(no_wiki_monospace=True)
+    dialect = Creole10(no_wiki_monospace=False)
     parser = Parser(dialect)
     assert parser(r"""
-This block of {{{no_wiki **should** be monospace}}} now""") == """\
-<p>This block of <tt>no_wiki **should** be monospace</tt> now</p>
+This block of {{{no_wiki **shouldn't** be monospace}}} now""") == """\
+<p>This block of <span>no_wiki **shouldn't** be monospace</span> now</p>
 """
     
 def test_use_additions_option():
 
 
 setup(name='Creoleparser',
-      version='0.2',
+      version='0.2.1',
       install_requires=['Genshi>=0.4'],
       description='Parser for the Creole common wiki markup language',
       author='Stephen Day',