/[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.21 by humppake, Wed Jun 4 12:19:18 2003 UTC revision 1.22 by humppake, Wed Jun 11 07:49:34 2003 UTC
# Line 46  class Link (navidoc.Element): Line 46  class Link (navidoc.Element):
46      error = 0      error = 0
47      target = None      target = None
48    
49      def __init__(self, var, s, list):      def __init__(self, var, toks, list):
50          """          """
51          Initilizes link.          Initilizes link.
52          """          """
53          dbg(self.key+' VAR: %s, S: %s, LIST: %s' % (var, s, list))          dbg("link: %s %s %s" % (var, toks,list))
54    
55          if config.link_base_directory == None:          if config.link_base_directory == None:
56              redirection_path = config.working_directory              redirection_path = config.working_directory
57          else: redirection_path = config.link_base_directory          else: redirection_path = config.link_base_directory
58                            
59          if (len(s.split(' ')) > 0):          if (len(toks) > 0):
60                self.title = toks[0]
61    
62            if (len(toks) > 1):
63              """              """
64              The 'link' may be followed by an attributed, which is              The 'link' may be followed by an attribute, which is
65              interpreted as keyword for one of the redirections mapped              interpreted as keyword for one of the redirections mapped
66              in config.              in config.
67              """              """
68              redirection = s.split(' ')[-1]              self.title = toks[0]
69                redirection = toks[-1]
70              if config.link_redirection.has_key(redirection):              if config.link_redirection.has_key(redirection):
71                  s = s[0:len(s)-len(redirection)-1]                  toks.remove(redirection)
72                  redirection_path = config.link_redirection[redirection]                  redirection_path = config.link_redirection[redirection]
73                  dbg('Redirection %s: %s' % (redirection, redirection_path))                  dbg('Redirection %s: %s' % (redirection, redirection_path))
74    
         self.title = s.strip()  
   
75          if (len(list) > 0):          if (len(list) > 0):
76              """              """
77              Multiple link could be given.              Multiple link could be given.
78              Let the last working one overwrite others.              Let the last working one overwrite others.
79              """              """
80              for link in list:              for link in list:
81                  if type(link) == type([]):                  if type(link[0]) == type([]):
82                      link = link[0]                      link = link[0][0]
83                    else: link = link[0]
84                  if self.target == None or \                  if self.target == None or \
85                         not os.path.isfile(self.target):                         not os.path.isfile(self.target):
86                      if link.startswith('http://'): self.target = link                      if link.startswith('http://'): self.target = link

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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