wip: indev, added raw file module (some checks on URI left)
This commit is contained in:
parent
ebdeac513f
commit
93b9fc7a2e
|
@ -669,7 +669,7 @@ def create_database():
|
||||||
'stat_underlines = %s\n'%(int(post_underlines)) + \
|
'stat_underlines = %s\n'%(int(post_underlines)) + \
|
||||||
'stat_cites = %s\n'%(int(post_cites)) + \
|
'stat_cites = %s\n'%(int(post_cites)) + \
|
||||||
'stat_customs = %s\n'%(int(post_customs)) + \
|
'stat_customs = %s\n'%(int(post_customs)) + \
|
||||||
'stat_codes = %s\n'%(int(tyto.nbr_codes)) + \
|
'stat_icodes = %s\n'%(int(tyto.nbr_icodes)) + \
|
||||||
'stat_bcodes = %s\n'%(int(tyto.nbr_bcodes)) + \
|
'stat_bcodes = %s\n'%(int(tyto.nbr_bcodes)) + \
|
||||||
'stat_quotes = %s\n'%(int(tyto.nbr_quotes)) + \
|
'stat_quotes = %s\n'%(int(tyto.nbr_quotes)) + \
|
||||||
'stat_lists = %s\n'%(int(post_lists))
|
'stat_lists = %s\n'%(int(post_lists))
|
||||||
|
|
|
@ -282,9 +282,9 @@ def get_css(line):
|
||||||
#-----------------------~
|
#-----------------------~
|
||||||
def protect_icodes(post_bottom, article_bottom):
|
def protect_icodes(post_bottom, article_bottom):
|
||||||
global protect_article
|
global protect_article
|
||||||
global nbr_codes
|
global nbr_icodes
|
||||||
|
|
||||||
nbr_codes = 0 # Stats here for DB as content will change
|
nbr_icodes = 0 # Stats here for DB as content will change
|
||||||
protect_article = article_bottom
|
protect_article = article_bottom
|
||||||
incode = False
|
incode = False
|
||||||
src_code = rep_code = ''
|
src_code = rep_code = ''
|
||||||
|
@ -304,7 +304,7 @@ def protect_icodes(post_bottom, article_bottom):
|
||||||
# incode if
|
# incode if
|
||||||
if c_b == '{' and not c_bb == '\\':
|
if c_b == '{' and not c_bb == '\\':
|
||||||
incode = True
|
incode = True
|
||||||
nbr_codes += 1
|
nbr_icodes += 1
|
||||||
code = words_tags[9][2]
|
code = words_tags[9][2]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -86,17 +86,13 @@ def wip_article(target):
|
||||||
wip_words_tags() # Paragraphs, strongs, italics
|
wip_words_tags() # Paragraphs, strongs, italics
|
||||||
wip_links() # Links_%i from headers in DB
|
wip_links() # Links_%i from headers in DB
|
||||||
wip_images() # Images_%i from headers in DB
|
wip_images() # Images_%i from headers in DB
|
||||||
wip_titles()
|
wip_titles() # Convert #N, remove empty line, add divs
|
||||||
|
wip_quotes() # Quotes. Decode base64 Q64 and convert to HTML
|
||||||
# Quotes. Decode base64 Q64 and convert to HTML
|
wip_icodes() # inline_codes. Decode base64 icode and replace
|
||||||
wip_quotes()
|
wip_bcodes() # Block-codes. Decode B64 and convert to HTML
|
||||||
|
wip_raws(target) # Read file and convert to HTML
|
||||||
# inline_codes. Decode base64 icode and replace
|
|
||||||
wip_icodes()
|
|
||||||
|
|
||||||
# Block-codes. Decode B64 and convert to HTML
|
|
||||||
wip_bcodes()
|
|
||||||
|
|
||||||
|
# Result (temp display)
|
||||||
print(article_bottom)
|
print(article_bottom)
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,6 +215,8 @@ def get_wh_image(value):
|
||||||
# Convert _images:%name to HTML #
|
# Convert _images:%name to HTML #
|
||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
def wip_images():
|
def wip_images():
|
||||||
|
if uniq_images == 0: return
|
||||||
|
|
||||||
global article_bottom
|
global article_bottom
|
||||||
|
|
||||||
if uniq_images > 0:
|
if uniq_images > 0:
|
||||||
|
@ -298,6 +296,8 @@ def quote_params(qline):
|
||||||
# Convert quote in article #
|
# Convert quote in article #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
def wip_quotes() :
|
def wip_quotes() :
|
||||||
|
if stat_quotes == 0: return
|
||||||
|
|
||||||
global article_bottom
|
global article_bottom
|
||||||
global author, link, lang, book, date
|
global author, link, lang, book, date
|
||||||
|
|
||||||
|
@ -432,6 +432,8 @@ def wip_quotes() :
|
||||||
# Content is HTML ready #
|
# Content is HTML ready #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
def wip_icodes():
|
def wip_icodes():
|
||||||
|
if stat_icodes == 0: return
|
||||||
|
|
||||||
global article_bottom
|
global article_bottom
|
||||||
|
|
||||||
matches = re.findall(r'I64.(.*?).I64', article_bottom)
|
matches = re.findall(r'I64.(.*?).I64', article_bottom)
|
||||||
|
@ -446,6 +448,8 @@ def wip_icodes():
|
||||||
# Content is raw, and have to be converted in HTML #
|
# Content is raw, and have to be converted in HTML #
|
||||||
#--------------------------------------------------#
|
#--------------------------------------------------#
|
||||||
def wip_bcodes():
|
def wip_bcodes():
|
||||||
|
if stat_bcodes == 0: return
|
||||||
|
|
||||||
global article_bottom
|
global article_bottom
|
||||||
|
|
||||||
matches = re.findall(r'B64.(.*?).B64', article_bottom)
|
matches = re.findall(r'B64.(.*?).B64', article_bottom)
|
||||||
|
@ -536,3 +540,31 @@ def wip_titles():
|
||||||
|
|
||||||
# Replace article with new contents
|
# Replace article with new contents
|
||||||
article_bottom = article_temp
|
article_bottom = article_temp
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Convert raw file to HTML with <pre> + <code>
|
||||||
|
#
|
||||||
|
def wip_raws(target):
|
||||||
|
if uniq_raws == 0: return
|
||||||
|
|
||||||
|
global article_bottom
|
||||||
|
|
||||||
|
for i in range(1, uniq_raws + 1):
|
||||||
|
raw = 'raw_%s'%i
|
||||||
|
raw_file = open(
|
||||||
|
'%s%s'%(
|
||||||
|
tyto.domain_articles, eval(raw)[1]
|
||||||
|
)
|
||||||
|
).read()
|
||||||
|
raw_html = '<pre class="%s" title="%s">\n'%(
|
||||||
|
tyto.domain_css, eval(raw)[2]
|
||||||
|
) + \
|
||||||
|
' <code class="bcode">'
|
||||||
|
for line in raw_file.rsplit('\n'):
|
||||||
|
raw_html = '%s\n <span class="bcode">%s</span>'%(raw_html, line)
|
||||||
|
|
||||||
|
raw_html = '%s\n </code>\n</pre>'%(raw_html)
|
||||||
|
article_bottom = article_bottom.replace(
|
||||||
|
eval(raw)[0], raw_html
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue