check: add inline-code check for markers in same line
This commit is contained in:
parent
b2f0df2fe4
commit
45c915e421
|
@ -57,6 +57,8 @@ def manage_check(target, option):
|
||||||
# Start processes
|
# Start processes
|
||||||
file_to_string(tyto.uri_root)
|
file_to_string(tyto.uri_root)
|
||||||
|
|
||||||
|
# Specific to inline-code: check markers on same line
|
||||||
|
check_icodes(article.rsplit('\n'))
|
||||||
# Protect inline-codes
|
# Protect inline-codes
|
||||||
tyto.protect_icodes(post_bottom, article_bottom)
|
tyto.protect_icodes(post_bottom, article_bottom)
|
||||||
post_bottom = tyto.protect_article.rsplit('\n')
|
post_bottom = tyto.protect_article.rsplit('\n')
|
||||||
|
@ -118,6 +120,37 @@ def file_to_string(post_file):
|
||||||
post_bottom = article.rsplit('-----')[1].rsplit('\n')
|
post_bottom = article.rsplit('-----')[1].rsplit('\n')
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check inline code, for markers on same line
|
||||||
|
#
|
||||||
|
def check_icodes(article):
|
||||||
|
quote = bcode = False
|
||||||
|
|
||||||
|
for ln, line in enumerate(article, 1):
|
||||||
|
icode_m1 = icode_m2 = 0
|
||||||
|
|
||||||
|
# Pass Comments
|
||||||
|
if line.startswith('#'): continue
|
||||||
|
|
||||||
|
# Pass quotes
|
||||||
|
if line.startswith(tyto.words_tags[11][0]): quote = True
|
||||||
|
if line.startswith(tyto.words_tags[11][1]): quote = False
|
||||||
|
|
||||||
|
# Pass bcode
|
||||||
|
if line.startswith(tyto.words_tags[12][0]): bcode = True
|
||||||
|
if line.startswith(tyto.words_tags[12][1]): bcode = False
|
||||||
|
|
||||||
|
if bcode or quote: continue
|
||||||
|
|
||||||
|
if tyto.words_tags[9][0] or tyto.words_tags[9][1] in line:
|
||||||
|
icode_m1 = line.count(tyto.words_tags[9][0])
|
||||||
|
icode_m2 = line.count(tyto.words_tags[9][1])
|
||||||
|
if icode_m1 != icode_m2:
|
||||||
|
tyto.exiting("8", 'inline-code: line %s. %s %s'%(ln,
|
||||||
|
tyto.words_tags[9][0], tyto.words_tags[9][1]
|
||||||
|
), True
|
||||||
|
)
|
||||||
|
|
||||||
#==================================#
|
#==================================#
|
||||||
# Check tags from article's header #
|
# Check tags from article's header #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
|
@ -127,8 +160,6 @@ def check_headers(post_header):
|
||||||
global stat_links, stat_images, stat_files, stat_bruts, stat_abbrs
|
global stat_links, stat_images, stat_files, stat_bruts, stat_abbrs
|
||||||
global post_tags
|
global post_tags
|
||||||
|
|
||||||
#post_tags = 0
|
|
||||||
|
|
||||||
# Needed Tags
|
# Needed Tags
|
||||||
title = author = tags = about = ''
|
title = author = tags = about = ''
|
||||||
date = ()
|
date = ()
|
||||||
|
|
Loading…
Reference in New Issue