27 |
|
|
28 |
__docformat__ = 'reStructuredText' |
__docformat__ = 'reStructuredText' |
29 |
|
|
30 |
|
""" |
31 |
|
Module contain the default link elements and basic methods for |
32 |
|
checking the existence of a target file. |
33 |
|
""" |
34 |
|
|
35 |
import config |
import config |
36 |
|
|
|
import navidoc |
|
37 |
import os.path, re |
import os.path, re |
38 |
|
|
39 |
|
import navidoc |
40 |
|
|
41 |
from navidoc.util.path import * |
from navidoc.util.path import * |
42 |
|
|
43 |
dbg = config.dbg.shorthand('link') |
dbg = config.dbg.shorthand('link') |
53 |
target = '' #None |
target = '' #None |
54 |
|
|
55 |
def __init__(self, var, toks, list): |
def __init__(self, var, toks, list): |
|
""" |
|
|
Initilizes link. |
|
|
""" |
|
56 |
dbg("link: %s %s %s" % (var, toks,list)) |
dbg("link: %s %s %s" % (var, toks,list)) |
57 |
|
|
58 |
self.var = var or toks[0] |
self.var = var or toks[0] |
64 |
|
|
65 |
if (len(toks) > 1): |
if (len(toks) > 1): |
66 |
""" |
""" |
67 |
The 'link' may be followed by an attribute, which is |
The ``link`` may be followed by an attribute, which is |
68 |
interpreted as keyword for one of the redirections mapped |
interpreted as keyword for one of the redirections mapped |
69 |
in config. |
in config. |
70 |
""" |
""" |
98 |
|
|
99 |
def set_status(self, set_title=0): |
def set_status(self, set_title=0): |
100 |
""" |
""" |
101 |
Checks if the link target exists. Checks if the target |
set_status(set_title=0) |
102 |
|
|
103 |
|
Check if the link target exists. Check if the target |
104 |
file is the current file. Could also parse |
file is the current file. Could also parse |
105 |
<title> from the file and set it to title. |
<title> from the file and set it to title. |
106 |
""" |
""" |
134 |
|
|
135 |
def draw_code(self): |
def draw_code(self): |
136 |
""" |
""" |
137 |
This should be overwritten elsewhere. |
This should be overwritten by drawing implementation. |
138 |
""" |
""" |
139 |
return '' |
return '' |