New code cleaned. Indev: wip. Some converting done
This commit is contained in:
parent
38e977ec1d
commit
fc1c059fda
|
@ -214,17 +214,21 @@ def wip_images():
|
||||||
image_link = '<a class="%s" href="%s" title="%s">%s</a>'
|
image_link = '<a class="%s" href="%s" title="%s">%s</a>'
|
||||||
image_show = '<img class="%s" src="%s" alt="%s"%s />'
|
image_show = '<img class="%s" src="%s" alt="%s"%s />'
|
||||||
|
|
||||||
|
# Check each line
|
||||||
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
||||||
|
# match line
|
||||||
if line.startswith('_image:'):
|
if line.startswith('_image:'):
|
||||||
values = line.rsplit(' ')
|
values = line.rsplit(' ')
|
||||||
#print(values)
|
|
||||||
|
|
||||||
|
# search match tag in DB
|
||||||
for i in range(1, uniq_images + 1):
|
for i in range(1, uniq_images + 1):
|
||||||
image = 'image_%s'%i
|
image = 'image_%s'%i
|
||||||
target = width = height = False
|
target = width = height = False
|
||||||
set_css = tyto.domain_css + '_image'
|
set_css = tyto.domain_css + '_image'
|
||||||
|
imag_html = ''
|
||||||
|
|
||||||
if eval(image)[0] == values[0]:
|
if eval(image)[0] == values[0]:
|
||||||
|
# Get parameters from match line
|
||||||
for value in values:
|
for value in values:
|
||||||
if 't=' in value:
|
if 't=' in value:
|
||||||
target = value.rsplit('=',1)[1]
|
target = value.rsplit('=',1)[1]
|
||||||
|
@ -249,10 +253,12 @@ def wip_images():
|
||||||
else:
|
else:
|
||||||
style = ''
|
style = ''
|
||||||
|
|
||||||
|
# set <img /> from parameter
|
||||||
image_src = image_show%(
|
image_src = image_show%(
|
||||||
set_css, eval(image)[1], eval(image)[2], style
|
set_css, eval(image)[1], eval(image)[2], style
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Set link for image
|
||||||
if target:
|
if target:
|
||||||
image_tgt = image_link%(
|
image_tgt = image_link%(
|
||||||
set_css, image_target, eval(image)[2], '%s'
|
set_css, image_target, eval(image)[2], '%s'
|
||||||
|
@ -260,8 +266,10 @@ def wip_images():
|
||||||
else:
|
else:
|
||||||
image_tgt = '%s'
|
image_tgt = '%s'
|
||||||
|
|
||||||
|
# Set HTML to replace line number
|
||||||
image_html = image_tgt%image_src
|
image_html = image_tgt%image_src
|
||||||
|
|
||||||
article_bottom = article_bottom.replace(
|
article_bottom = article_bottom.replace(
|
||||||
article_bottom.rsplit('\n')[ln], image_html
|
article_bottom.rsplit('\n')[ln], image_html
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue