Attachment 'MoinAlternateStylesheets.txt'

Download

   1 # HG changeset patch
   2 # User Matthew Nuzum <matthew.nuzum@canonical.com>
   3 # Date 1227220793 21600
   4 # Node ID 917f05e2fd4b95445a643ec319b322991fdb08bb
   5 # Parent  02f68dc10be011d23179ec7d5aa04ffa249c8cd1
   6 Adding support for alternate stylesheets by adding an optional third value in tuples added to the wikiconfig.py stylesheets
   7 list. Also adding support for implicit screen media type if the tuple contains only a single value.
   8 
   9 diff -r 02f68dc10be0 -r 917f05e2fd4b MoinMoin/theme/__init__.py
  10 --- a/MoinMoin/theme/__init__.py	Sun Aug 03 14:51:11 2008 +0200
  11 +++ b/MoinMoin/theme/__init__.py	Thu Nov 20 16:39:53 2008 -0600
  12 @@ -625,6 +625,7 @@
  13          @return: stylesheets links
  14          """
  15          link = '<link rel="stylesheet" type="text/css" charset="%s" media="%s" href="%s">'
  16 +        altlink = '<link rel="alternate stylesheet" type="text/css" charset="%s" media="%s" href="%s" title="%s">'
  17  
  18          # Check mode
  19          if d.get('print_mode'):
  20 @@ -647,8 +648,17 @@
  21                  usercss = None
  22  
  23          # admin configurable additional css (farm or wiki level)
  24 -        for media, csshref in self.request.cfg.stylesheets:
  25 -            html.append(link % (self.stylesheetsCharset, media, csshref))
  26 +        for stylesheet in self.request.cfg.stylesheets:
  27 +            media, csshref, title = ('','','')
  28 +            if len(stylesheet) == 3: media, csshref, title = stylesheet
  29 +            elif len(stylesheet) == 2: media,csshref = stylesheet
  30 +            elif len(stylesheet) == 1:
  31 +                media = 'screen'
  32 +                csshref = stylesheet[0]
  33 +            if title :
  34 +                html.append(altlink % (self.stylesheetsCharset, media, csshref, title))
  35 +            else:
  36 +                html.append(link % (self.stylesheetsCharset, media, csshref))
  37  
  38          csshref = '%s/%s/css/msie.css' % (prefix, self.name)
  39          html.append("""

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-11-20 22:52:02, 1.8 KB) [[attachment:MoinAlternateStylesheets.diff]]
  • [get | view] (2008-11-20 22:46:44, 1.8 KB) [[attachment:MoinAlternateStylesheets.txt]]
  • [get | view] (2008-11-20 23:10:18, 1.4 KB) [[attachment:MoinAlternateStylesheetsPep8.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.