wip: links are converted to base64
This commit is contained in:
parent
42bd5a40d8
commit
fc47d177e2
|
@ -218,15 +218,15 @@ def check_article(post_uri, Force):
|
||||||
check_post_header(headers.rsplit('\n'))
|
check_post_header(headers.rsplit('\n'))
|
||||||
|
|
||||||
# Protect bCodes, keep markers for stats, before checking other markers
|
# Protect bCodes, keep markers for stats, before checking other markers
|
||||||
wip.convert_bcodes(article.rsplit('\n'),
|
wip.convert_bcodes(article.rsplit('\n'),
|
||||||
'[[', ']]',
|
'[[', ']]',
|
||||||
domain.domain_css)
|
domain.domain_css)
|
||||||
article = wip.article_temp
|
article = wip.article_temp
|
||||||
|
|
||||||
# Protect quotes, keep markers for stats, before checking other markers
|
# Protect quotes, keep markers for stats, before checking other markers
|
||||||
wip.convert_bcodes(article.rsplit('\n'),
|
wip.convert_bcodes(article.rsplit('\n'),
|
||||||
'((', '))',
|
'((', '))',
|
||||||
domain.domain_css)
|
domain.domain_css)
|
||||||
article = wip.article_temp
|
article = wip.article_temp
|
||||||
|
|
||||||
# Protect iCodes, keep markers for stats
|
# Protect iCodes, keep markers for stats
|
||||||
|
@ -304,13 +304,8 @@ def post_to_strings(post_uri):
|
||||||
post = True
|
post = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# In post content
|
if post: article = '%s\n%s'%(article,line) # In post content
|
||||||
if post:
|
else: headers = '%s\n%s'%(headers,line) # In post header
|
||||||
article = '%s\n%s'%(article,line)
|
|
||||||
|
|
||||||
# In post header
|
|
||||||
else:
|
|
||||||
headers = '%s\n%s'%(headers,line)
|
|
||||||
|
|
||||||
# Get number lines in headers, min line separator
|
# Get number lines in headers, min line separator
|
||||||
headers_ln = len(headers.split("\n")) - 1
|
headers_ln = len(headers.split("\n")) - 1
|
||||||
|
@ -601,7 +596,7 @@ def check_files(line, ln, stats_files_uniq):
|
||||||
else:
|
else:
|
||||||
file_uri = '/%s'%(file_uri)
|
file_uri = '/%s'%(file_uri)
|
||||||
|
|
||||||
# Current or curstom URI
|
# Current or custom URI
|
||||||
else:
|
else:
|
||||||
usr_file = '%s%s'%(domain.domain_articles,file_uri)
|
usr_file = '%s%s'%(domain.domain_articles,file_uri)
|
||||||
if not os.path.exists(usr_file):
|
if not os.path.exists(usr_file):
|
||||||
|
@ -687,7 +682,7 @@ def check_images(line, ln, stats_images_uniq):
|
||||||
else:
|
else:
|
||||||
image_uri = '/%s'%(image_uri)
|
image_uri = '/%s'%(image_uri)
|
||||||
|
|
||||||
# Current or curstom URI
|
# Current or custom URI
|
||||||
else:
|
else:
|
||||||
usr_file = '%s%s'%(domain.domain_articles,image_uri)
|
usr_file = '%s%s'%(domain.domain_articles,image_uri)
|
||||||
if not os.path.exists(usr_file):
|
if not os.path.exists(usr_file):
|
||||||
|
|
|
@ -197,8 +197,9 @@ def wip_titles(wip_lines):
|
||||||
|
|
||||||
|
|
||||||
#================================================#
|
#================================================#
|
||||||
# Create Anchors (links) #
|
# Create Anchors (links) and convert to HTML #
|
||||||
# Target anchors are done with wip_begin_markers #
|
# Target anchors are done with wip_begin_markers #
|
||||||
|
# Each are converted to Base64 #
|
||||||
#------------------------------------------------#
|
#------------------------------------------------#
|
||||||
def wip_anchors(article):
|
def wip_anchors(article):
|
||||||
global wip_html
|
global wip_html
|
||||||
|
@ -209,14 +210,16 @@ def wip_anchors(article):
|
||||||
for anchor in anchors_link:
|
for anchor in anchors_link:
|
||||||
anchor_id = anchor.rsplit(':',1)[0]
|
anchor_id = anchor.rsplit(':',1)[0]
|
||||||
anchor_name = anchor.rsplit(':',1)[1]
|
anchor_name = anchor.rsplit(':',1)[1]
|
||||||
article = article.replace('>_%s_<'%anchor,
|
anchor_b64 = anchor_fmt%(anchor_id, anchor_name)
|
||||||
anchor_fmt%(anchor_id, anchor_name)
|
convert_to_b64(anchor_b64)
|
||||||
)
|
article = article.replace('>_%s_<'%anchor, b64_content)
|
||||||
wip_html = article
|
|
||||||
|
wip_html = article
|
||||||
|
|
||||||
#
|
#==============================#
|
||||||
# Convert links
|
# Convert links to HTML #
|
||||||
#
|
# Each are converted to Base64 #
|
||||||
|
#------------------------------#
|
||||||
def wip_links(article):
|
def wip_links(article):
|
||||||
global wip_html
|
global wip_html
|
||||||
|
|
||||||
|
@ -225,19 +228,20 @@ def wip_links(article):
|
||||||
|
|
||||||
for var in all_vars:
|
for var in all_vars:
|
||||||
if var.startswith('link_'):
|
if var.startswith('link_'):
|
||||||
link = globals()[var]
|
link = globals()[var]
|
||||||
article = article.replace('_%s'%link[0],
|
link_b64 = link_fmt%(domain.domain_css, link[1],
|
||||||
link_fmt%(
|
link[2], link[0]
|
||||||
domain.domain_css, link[1],
|
)
|
||||||
link[2], link[0]
|
convert_to_b64(link_b64)
|
||||||
)
|
article = article.replace('_%s'%link[0], b64_content)
|
||||||
)
|
|
||||||
|
|
||||||
wip_html = article
|
wip_html = article
|
||||||
|
|
||||||
#
|
#===========================================#
|
||||||
#
|
# Convert abbrs to HTML #
|
||||||
#
|
# each found are converted to Base64 #
|
||||||
|
# (avoid mismatch HTML if same word inside) #
|
||||||
|
#-------------------------------------------#
|
||||||
def wip_abbrs(article):
|
def wip_abbrs(article):
|
||||||
global wip_html
|
global wip_html
|
||||||
|
|
||||||
|
@ -246,11 +250,10 @@ def wip_abbrs(article):
|
||||||
|
|
||||||
for var in all_vars:
|
for var in all_vars:
|
||||||
if var.startswith('abbr_'):
|
if var.startswith('abbr_'):
|
||||||
abbr = globals()[var]
|
abbr = globals()[var]
|
||||||
abbr_b64 = abbr_fmt%(domain.domain_css, abbr[1], abbr[2])
|
abbr_b64 = abbr_fmt%(domain.domain_css, abbr[1], abbr[2])
|
||||||
convert_to_b64(abbr_b64)
|
convert_to_b64(abbr_b64)
|
||||||
print('B64 for %s :> %s'%(abbr[1], b64_content))
|
article = article.replace(abbr[0], b64_content)
|
||||||
article = article.replace(abbr[0], b64_content)
|
|
||||||
|
|
||||||
wip_html = article
|
wip_html = article
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue