Anchors. Fix and process change (Needs tests)
This commit is contained in:
parent
b3506baeb1
commit
809fa6edaa
|
@ -87,7 +87,7 @@ headers = (
|
|||
# [6] = Check content differently. 't' = startswith
|
||||
#-------------------------------------------------------------
|
||||
words_tags = [
|
||||
('>_', '_<', '<a class="anchor"', '</a>', 'anchors', 'w'),
|
||||
('>_', '_<', '<a class="anchor" href="#%s">', '</a>', 'anchors', 'w'),
|
||||
('*_', '_*', '<strong class="strong">', '</strong>', 'strongs', 'w'),
|
||||
('+_', '_+', '<b class="bold">', '</b>', 'bolds', 'w'),
|
||||
('/_', '_/', '<em class="em">', '</em>', 'emphasis', 'w'),
|
||||
|
|
|
@ -199,10 +199,17 @@ def wip_single_tags():
|
|||
def wip_words_tags():
|
||||
global article_bottom
|
||||
|
||||
# Strongs, italics... (8 tags)
|
||||
# Strongs, italics...
|
||||
# (Stop after 8 tags)
|
||||
# For anchor (0), must do it differently
|
||||
m = 0
|
||||
for tag in tyto.words_tags:
|
||||
if m > 8: break
|
||||
if m == 0:
|
||||
m += 1
|
||||
# Close anchor (generic)
|
||||
article_bottom = article_bottom.replace(tag[1], tag[3])
|
||||
continue
|
||||
elif m > 8: break
|
||||
|
||||
# Open tag
|
||||
article_bottom = article_bottom.replace(tag[0], tag[2])
|
||||
|
@ -210,8 +217,9 @@ def wip_words_tags():
|
|||
article_bottom = article_bottom.replace(tag[1], tag[3])
|
||||
m += 1
|
||||
|
||||
# Paragraphs
|
||||
|
||||
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
||||
# Paragraphs
|
||||
# Open tag
|
||||
if line.startswith(tyto.words_tags[10][0]):
|
||||
set_css = tyto.get_css(line)
|
||||
|
@ -220,12 +228,20 @@ def wip_words_tags():
|
|||
tyto.words_tags[10][2]%set_css
|
||||
)
|
||||
# Close tag
|
||||
if line.startswith(tyto.words_tags[10][1]):
|
||||
elif line.startswith(tyto.words_tags[10][1]):
|
||||
article_bottom = article_bottom.replace(
|
||||
line,
|
||||
tyto.words_tags[10][3]
|
||||
)
|
||||
|
||||
# Open anchors
|
||||
anchor_links = re.findall(r'>_(.+?):', line)
|
||||
for item in anchor_links:
|
||||
anchor_id = '%s%s:'%(tyto.words_tags[0][0], item)
|
||||
print(anchor_id)
|
||||
article_bottom = article_bottom.replace(
|
||||
anchor_id, tyto.words_tags[0][2]%item
|
||||
)
|
||||
|
||||
|
||||
#=======================#
|
||||
# Convert links from DB #
|
||||
|
@ -632,7 +648,7 @@ def wip_raws(target):
|
|||
|
||||
global article_bottom
|
||||
|
||||
for i in range(1, db.uniq_raws + 1):
|
||||
for i in range(1, db.xtuniq_raws + 1):
|
||||
raw = 'db.raw_%s'%i
|
||||
raw_file = open(
|
||||
'%s%s'%(
|
||||
|
|
Loading…
Reference in New Issue