69 |
diagram = html[insert+11:html.find('"', insert+11)] |
diagram = html[insert+11:html.find('"', insert+11)] |
70 |
|
|
71 |
context = filepath.replace("/","_") |
context = filepath.replace("/","_") |
72 |
if context.endswith(".gen.html"): context = context[0:len(context)-9] |
if context.endswith(config.midfix+'.html'): |
73 |
|
context = context[0:len(context)-(len(config.midfix)+5)] |
74 |
if context.endswith(".html"): context = context[0:len(context)-5] |
if context.endswith(".html"): context = context[0:len(context)-5] |
75 |
|
|
76 |
out = open(filepath, "w") |
out = open(filepath, "w") |
142 |
|
|
143 |
if insert != -1 and explicit == -1: |
if insert != -1 and explicit == -1: |
144 |
context = filepath.replace("/","_") |
context = filepath.replace("/","_") |
145 |
if context.endswith(".gen.html"): context = context[0:len(context)-9] |
if context.endswith(config.midfix+'.html'): |
146 |
|
context = context[0:len(context)-(len(config.midfix)+5)] |
147 |
if context.endswith(".html"): context = context[0:len(context)-5] |
if context.endswith(".html"): context = context[0:len(context)-5] |
148 |
context = context+'_implicit' |
context = context+'_implicit' |
149 |
|
|
168 |
config.link_base_directory = None |
config.link_base_directory = None |
169 |
|
|
170 |
def is_linked(diagram): |
def is_linked(diagram): |
171 |
log = open(slashify(config.mp_directory)+diagram+'.gen.mp.log').read() |
log = open(slashify(config.mp_directory)+diagram+config.midfix+'.mp.log').read() |
172 |
log = log.replace("\n",'') # MetaPost (mpost) splits lines awkwardly in the log. |
log = log.replace("\n",'') # MetaPost (mpost) splits lines awkwardly in the log. |
173 |
|
|
174 |
# Grep all linked areas from log file. |
# Grep all linked areas from log file. |
181 |
def get_imagemap(diagram, context, scale=1.0, id_postfix=''): |
def get_imagemap(diagram, context, scale=1.0, id_postfix=''): |
182 |
if len(context) > 0: context = '_'+context |
if len(context) > 0: context = '_'+context |
183 |
|
|
184 |
log = open(slashify(config.mp_directory)+diagram+context+'.gen.mp.log').read() |
log = open(slashify(config.mp_directory)+diagram+context+config.midfix+'.mp.log').read() |
185 |
log = log.replace("\n",'') # MetaPost (mpost) splits lines awkwardly in the log. |
log = log.replace("\n",'') # MetaPost (mpost) splits lines awkwardly in the log. |
186 |
|
|
187 |
links = [] |
links = [] |
206 |
+"\n".join([link.imgmapanchor(scale) for link in links]) \ |
+"\n".join([link.imgmapanchor(scale) for link in links]) \ |
207 |
+'</map>'+"\n" \ |
+'</map>'+"\n" \ |
208 |
+'<img src="'+slashify(relative_path(config.working_directory, config.mp_directory)) \ |
+'<img src="'+slashify(relative_path(config.working_directory, config.mp_directory)) \ |
209 |
+diagram+context+'.gen.png" usemap="#'+diagram+id_postfix+'_map" alt="'+diagram+id_postfix+'" />'+"\n" |
+diagram+context+config.midfix+'.png" usemap="#'+diagram+id_postfix+'_map" alt="'+diagram+id_postfix+'" />'+"\n" |
210 |
|
|
211 |
return imgmap |
return imgmap |
212 |
|
|
217 |
""" |
""" |
218 |
targets = [] |
targets = [] |
219 |
|
|
220 |
log = open(slashify(config.mp_directory)+diagram+'.gen.mp.log').read() |
log = open(slashify(config.mp_directory)+diagram+config.midfix+'.mp.log').read() |
221 |
log = log.replace("\n",'') # MetaPost (mpost) splits lines awkwardly in the log. |
log = log.replace("\n",'') # MetaPost (mpost) splits lines awkwardly in the log. |
222 |
|
|
223 |
# Grep all linked areas from log file. |
# Grep all linked areas from log file. |