/[navidoc]/navidoc/navidoc/link/__init__.py
ViewVC logotype

Diff of /navidoc/navidoc/link/__init__.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by humppake, Fri Apr 25 17:03:09 2003 UTC revision 1.13 by humppake, Tue May 20 09:49:19 2003 UTC
# Line 36  from navidoc.util.path import * Line 36  from navidoc.util.path import *
36    
37  dbg = config.dbg.shorthand('link')  dbg = config.dbg.shorthand('link')
38    
39    class JLinkPackage(navidoc.Element):
40        key = "linkpackage"
41    
42        def __init__(self, var, s, list):
43            dbg("Set linkpackage to: "+s)
44            config.linkpackage = s
45    
46        def setup_code(self): return ''
47    
48        def draw_code(self):  return ''
49    
50  class Link (navidoc.Element):  class Link (navidoc.Element):
51      key = 'link'      key = 'link'
52    
# Line 50  class Link (navidoc.Element): Line 61  class Link (navidoc.Element):
61          """          """
62          Initilizes link.          Initilizes link.
63          """          """
64          dbg(self.key+" VAR: %s, S: %s, LIST: %s" % (var, s, list))          dbg(self.key+' VAR: %s, S: %s, LIST: %s' % (var, s, list))
65    
66            redirection_path = config.working_directory
67            if (len(s.split(' ')) > 0):
68                """
69                The 'link' may be followed by an attributed, which is
70                interpreted as keyword for one of the redirections mapped
71                in config.
72                """
73                redirection = s.split(' ')[-1]
74                s = s[0:len(s)-len(redirection)-1]
75                if config.link_redirection.has_key(redirection):
76                    redirection_path = config.link_redirection[redirection]
77                    dbg('Redirection %s: %s' % (redirection, redirection_path))
78    
79          self.title = s.strip()          self.title = s.strip()
80    
81          if (len(list) > 0):          if (len(list) > 0):
82              """              """
83              Multiple link could be given.              Multiple link could be given.
84              Let working link overwrite current.              Let the last working one overwrite others.
85              """              """
86              for link in list:              for link in list:
87                  if type(link) == type([]):                  if type(link) == type([]):
# Line 64  class Link (navidoc.Element): Line 89  class Link (navidoc.Element):
89                  if self.target == None or \                  if self.target == None or \
90                         not os.path.isfile(self.target):                         not os.path.isfile(self.target):
91                      if config.link_base_directory == None:                      if config.link_base_directory == None:
92                          self.target = os.path.normpath(slashify(config.working_directory) + link)                          self.target = os.path.normpath(slashify(redirection_path) + link)
93                      else:                      else:
94                          self.target = os.path.normpath(slashify(config.link_base_directory) + link)                          self.target = os.path.normpath(slashify(redirection_path) + link)
95    
96              """              """
97              Final check and setting attributes.              Final check and setting attributes.

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26