[Moin-devel] CVS: MoinMoin/parser wiki.py,1.77,1.78

J?rgen Hermann jhermann at users.sourceforge.net
Wed Feb 6 17:04:28 EST 2002


Update of /cvsroot/moin/MoinMoin/parser
In directory usw-pr-cvs1:/tmp/cvs-serv27418/MoinMoin/parser

Modified Files:
	wiki.py 
Log Message:
Added TWikiDrawPlugin support, which freaking rocks


Index: wiki.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/parser/wiki.py,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -r1.77 -r1.78
*** wiki.py	2002/02/06 23:15:17	1.77
--- wiki.py	2002/02/07 01:03:32	1.78
***************
*** 31,35 ****
  
      # some common strings
!     attachment_schemas = ["attachment", "inline"]
      punct_pattern = re.escape('''"'}]|:,.)?!''')
      url_pattern = ('http|https|ftp|nntp|news|mailto|telnet|wiki|file|' +
--- 31,35 ----
  
      # some common strings
!     attachment_schemas = ["attachment", "inline", "drawing"]
      punct_pattern = re.escape('''"'}]|:,.)?!''')
      url_pattern = ('http|https|ftp|nntp|news|mailto|telnet|wiki|file|' +
***************
*** 186,193 ****
  
          inline = url[0] == 'i'
!         if inline:
!             url = url[7:] # remove "inline:"
!         else:
!             url = url[11:] # remove "attachment:"
          text = text or url
  
--- 186,191 ----
  
          inline = url[0] == 'i'
!         drawing = url[0] == 'd'
!         url = string.split(url, ":", 1)[1]
          text = text or url
  
***************
*** 202,213 ****
          from MoinMoin.action import AttachFile
          fname = wikiutil.taintfilename(url)
          fpath = os.path.join(AttachFile.getAttachDir(pagename), fname)
  
          # check whether attachment exists, possibly point to upload form
          if not os.path.exists(fpath):
              return wikiutil.link_tag(
!                 '%s?action=AttachFile&rename=%s' % (
!                     wikiutil.quoteWikiname(pagename), urllib.quote_plus(fname)),
!                 _('Upload new attachment "%(filename)s"') % {'filename': fname})
  
          # check for image URL, and possibly return IMG tag
--- 200,221 ----
          from MoinMoin.action import AttachFile
          fname = wikiutil.taintfilename(url)
+         if drawing:
+             drawing = fname
+             fname = fname + ".gif"
+             url = url + ".gif"
          fpath = os.path.join(AttachFile.getAttachDir(pagename), fname)
  
          # check whether attachment exists, possibly point to upload form
          if not os.path.exists(fpath):
+             if drawing:
+                 linktext = _('Create new drawing "%(filename)s"')
+             else:
+                 linktext = _('Upload new attachment "%(filename)s"')
              return wikiutil.link_tag(
!                 '%s?action=AttachFile&rename=%s%s' % (
!                     wikiutil.quoteWikiname(pagename),
!                     urllib.quote_plus(fname),
!                     drawing and ('&drawing=%s' % urllib.quote(drawing)) or ''),
!                 linktext % {'filename': fname})
  
          # check for image URL, and possibly return IMG tag
***************
*** 215,219 ****
          if not kw.get('pretty_url', 0) and wikiutil.isPicture(url):
              return self.formatter.image(border=0, alt=url,
!                 src=AttachFile.getAttachUrl(pagename, url))
  
          # try to inline the attachment (we only accept a list
--- 223,227 ----
          if not kw.get('pretty_url', 0) and wikiutil.isPicture(url):
              return self.formatter.image(border=0, alt=url,
!                 src=AttachFile.getAttachUrl(pagename, url, addts=1))
  
          # try to inline the attachment (we only accept a list
***************
*** 324,331 ****
          """Handle literal URLs including inline images."""
          self._check_p()
!         scheme = string.split(words[0], ":", 1)[0]
  
          if scheme == "wiki": return self.interwiki([word])
!         if scheme in attachment_schemas:
              return self.attachment([word])
  
--- 332,339 ----
          """Handle literal URLs including inline images."""
          self._check_p()
!         scheme = string.split(word, ":", 1)[0]
  
          if scheme == "wiki": return self.interwiki([word])
!         if scheme in self.attachment_schemas:
              return self.attachment([word])
  
***************
*** 350,354 ****
          scheme = string.split(words[0], ":", 1)[0]
          if scheme == "wiki": return self.interwiki(words, pretty_url=1)
!         if scheme in attachment_schemas:
              return self.attachment(words, pretty_url=1)
  
--- 358,362 ----
          scheme = string.split(words[0], ":", 1)[0]
          if scheme == "wiki": return self.interwiki(words, pretty_url=1)
!         if scheme in self.attachment_schemas:
              return self.attachment(words, pretty_url=1)
  





More information about the Moin-devel mailing list