/[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.1 by humppake, Tue Mar 18 14:32:53 2003 UTC revision 1.2 by humppake, Thu Mar 27 09:33:48 2003 UTC
# Line 1  Line 1 
1    #
2    # Copyright (c) 2002, 2003 by Tuomas Lukka, Asko Soukka
3    #
4    # This file is part of Navidoc.
5    #
6    # Navidoc is free software; you can redistribute it and/or modify it under
7    # the terms of the GNU Lesser General Public License as published by
8    # the Free Software Foundation; either version 2 of the License, or
9    # (at your option) any later version.
10    #
11    # Navidoc is distributed in the hope that it will be useful, but WITHOUT
12    # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13    # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
14    # Public License for more details.
15    #
16    # You should have received a copy of the GNU Lesser General
17    # Public License along with Navidoc; if not, write to the Free
18    # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19    # MA  02111-1307  USA
20    #
21    
22    #$Id$
23    
24  #  #
25    # Written by Tuomas Lukka, Asko Soukka
26    #
27    
28    __docformat__ = 'reStructuredText'
29    
30    from navidoc.parser import *
31    
32    import config
33    
34    from navidoc.utils.path import *
35    
36    dbg = config.dbg.shorthand('link')
37    
38    class Link:
39        key = 'link'
40    
41        def __init__(self, target):
42            self.target = target
43            self.title = target
44    
45        def draw_code(self, target, title, bbox):
46            """
47            This should be overwritten elsewhere.
48            """
49            dbg("Link.draw_code has no implementation.")
50            pass
51      
52    #        if jlink != None:
53    #             #trimming jlink to comparable
54    #             name = jlink
55    #             if name.rfind("#") != -1:
56    #                 name = name[0:name.rfind("#")]
57    #             if name.endswith(".html"): name = name[0:len(name)-5]
58    #             if name.endswith(".gen"): name = name[0:len(name)-4]
59    #             #Marking "Broken link" if file not found
60    #             if settings.has_key('path'):
61    #                slash = settings['path'].rfind("/")
62    #                if slash != -1:
63    #                    path = (settings['path'][0:slash+1] + target(jlink)).replace("//", "/")
64    #                else:
65    #                    path = target(jlink).replace("//", "/")
66    #                if path.rfind("#") != -1:
67    #                    path = path[0:path.rfind("#")]
68    #                if not os.path.isfile(path):
69    #     #               print path
70    #                     return 'showlinkerror("'+jlink+'", ('+box+'));'
71    #                else:
72    #                     file = open(path)                
73    #                     title = re.compile('<title>([^<]*)</title>')
74    #                     title = title.findall(file.read())
75    #                     file.close()
76    #                     if len(title) > 0: title = title[0]
77    #                     else: title = jlink
78    #                     titles[jlink] = title#
79    
80    #             """ If focus is set and 'focus' matches, focus jlink. """
81    #             #comparing
82    #             if settings.has_key('focus') and (\
83    #                settings['focus'].find("_"+name.replace(".", "_")+".") != -1 or \
84    #                settings['focus'].find("_"+name.replace(".", "_")+"_package") != -1):
85    #                 if RoughEdge: return 'showfocus("'+jlink+'", ('+box+'));'+"\n"+'drawRoughEdge(('+box+'));'
86    #                 else: return 'showfocus("'+jlink+'", ('+box+'));'
87    #             return 'showjlink("'+jlink+'", ('+box+'));'
88    #         return ""
89            
90    #         """Returns target file of the jlink with
91    #         path from the current directory."""
92    #         ts = jlink.split(".")
93    #         if re.search("html", ts[-1]):
94    #             settings2 = settings.copy()
95    #             if settings.has_key('path') and settings.has_key('tmpdir') \
96    #                    and settings.has_key('name'):
97    #                 if (os.path.isfile(mputils._slashify(settings['tmpdir'])+settings['name']+".gen.refers")):
98    #                     refer_file = open(mputils._slashify(settings['tmpdir'])+settings['name']\
99    #                                       +".gen.refers", "r")
100    #                     #print "NEEDLE:", ts[-3].split("/")[-1]
101    #                     refers = refer_file.readlines()
102    #                     if len(refers) > 0 and \
103    #                            "".join([refer for refer in refers]).find(ts[-3].split("/")[-1]) == -1:
104    #                         tmp = mputils.transition_path(settings['path'], refers[0].replace(".rst", ".gen.html"))
105    #                         slash = tmp.rfind("/")
106    #                         if slash != -1:
107    #                             settings['to_context'] = (tmp[0:slash+1]).replace("//", "/")
108    #                             #print "REFERS:",refers
109    #                             #print "PATH:", settings['path']
110    #                             #print "JLINK:",jlink
111    #                             #print "TO_CONTEXT:", settings['to_context']
112    #                     refer_file.close()
113    #             if settings.has_key('to_context') and not \
114    #                 jlink.startswith(settings['to_context']):
115    #                 if settings['to_context'].endswith("/"):
116    #                     target = settings['to_context']+jlink
117    #                 else:
118    #                     target = settings['to_context']+"/"+jlink
119    #                 while target.startswith("/"):
120    #                     target = target[1:len(target)]
121    #             else: target = jlink
122    #             settings.restore(settings2)
123    #         elif re.match("^[a-z]", ts[-1]):
124    #             target = (settings['to_javadoc']+"/"\
125    #                       +"/".join(ts)
126    #                       + "/package-summary.html#package_description")
127    #         else:
128    #             target = (settings['to_javadoc']+"/"\
129    #                       +"/".join(ts)
130    #                       + ".html")
131    #         return target

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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