예제 #1
0
def addtext (fapage,text,addtemplate,msg_clean):
                if text.find(u'{{ابهام‌زدایی}}')!=-1:
                    return
                text=text.replace(addtemplate+u'\n',u'')
                if text.find(u'رده:')!=-1:    
                    num=text.find(u'[[رده:')
                    text=text[:num]+addtemplate+u'\n'+text[num:]
                else:
                    m = re.search(ur'\[\[([a-z]{2,3}|[a-z]{2,3}\-[a-z\-]{2,}|simple):.*?\]\]', text)
                    if m:
                        if m.group(0)==u'[[en:Article]]':    
                            try:
                                if string.count(text,u'[[en:Article]] --->')==1:    
                                    text=text.split(u'[[en:Article]] --->')[0]+u'[[en:Article]] --->\n'+addtemplate+text.split(u'[[en:Article]] --->')[1]
                                else:
                                    if fapage.namespace()!=0:
                                        return    
                                    text+='\n'+addtemplate                                
                            except:
                                if fapage.namespace()!=0:
                                    return
                                text+='\n'+addtemplate
                        else:
                            num=text.find(m.group(0))
                            text=text[:num]+addtemplate+'\n'+text[num:]
                    else:
                        if fapage.namespace()!=0:    
                            return                        
                        text+='\n'+addtemplate
                text,cleaning_version,msg_clean2=fa_cosmetic_changes.fa_cosmetic_changes(text,fapage)
                try:                
                    fapage.put(text,u'ربات:افزودن الگو ناوباکس '+addtemplate+msg_clean)
                except:
                    pass    
                return
예제 #2
0
def savepart( page,new_text,msg=msg):     
            pagename=page.replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
            page=wikipedia.Page(faSite,pagename)    
            new_text,cleaning_version,msg_clean=fa_cosmetic_changes.fa_cosmetic_changes(new_text,page,msg_short=False)
            if msg_clean:
                msg+=u' + '+msg_clean
            msg=msg.replace(u'+ +',u'+').strip()    
            try:
                page.put( new_text,msg ,watchArticle = None)   
            except wikipedia.EditConflict:
                wikipedia.output( u'Skipping %s because of edit conflict' % ( page.title() ) )
            except wikipedia.SpamfilterError,url:
                wikipedia.output( u'Cannot change %s because of blacklist entry %s' % ( page.title(),url ) )
예제 #3
0
def savepart( page,new_text,msg=msg):     
            pagename=page.replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
            page=wikipedia.Page(faSite,pagename)    
            new_text,cleaning_version,msg_clean=fa_cosmetic_changes.fa_cosmetic_changes(new_text,page,msg_short=False)
            if msg_clean:
                msg+=u' + '+msg_clean
            msg=msg.replace(u'+ +',u'+').strip()    
            try:
                page.put( new_text,msg ,watchArticle = None)   
            except wikipedia.EditConflict:
                wikipedia.output( u'Skipping %s because of edit conflict' % ( page.title() ) )
            except wikipedia.SpamfilterError,url:
                wikipedia.output( u'Cannot change %s because of blacklist entry %s' % ( page.title(),url ) )
예제 #4
0
def addtext(fapage, text, addtemplate, msg_clean):
    if text.find(u'{{ابهام‌زدایی}}') != -1:
        return
    text = text.replace(addtemplate + u'\n', u'')
    if text.find(u'رده:') != -1:
        num = text.find(u'[[رده:')
        text = text[:num] + addtemplate + u'\n' + text[num:]
    else:
        m = re.search(
            ur'\[\[([a-z]{2,3}|[a-z]{2,3}\-[a-z\-]{2,}|simple):.*?\]\]', text)
        if m:
            if m.group(0) == u'[[en:Article]]':
                try:
                    if string.count(text, u'[[en:Article]] --->') == 1:
                        text = text.split(
                            u'[[en:Article]] --->'
                        )[0] + u'[[en:Article]] --->\n' + addtemplate + text.split(
                            u'[[en:Article]] --->')[1]
                    else:
                        if fapage.namespace() != 0:
                            return
                        text += '\n' + addtemplate
                except:
                    if fapage.namespace() != 0:
                        return
                    text += '\n' + addtemplate
            else:
                num = text.find(m.group(0))
                text = text[:num] + addtemplate + '\n' + text[num:]
        else:
            if fapage.namespace() != 0:
                return
            text += '\n' + addtemplate
    text, cleaning_version, msg_clean2 = fa_cosmetic_changes.fa_cosmetic_changes(
        text, fapage)
    try:
        fapage.put(text,
                   u'ربات:افزودن الگو ناوباکس ' + addtemplate + msg_clean)
    except:
        pass
    return
예제 #5
0
def add_nav(preloadingGen):
    for tem in preloadingGen:
        user_pass, First_user = check_user(tem)
        if not user_pass:
            wikipedia.output(
                u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
            )
            wikipedia.output(
                "\03{lightgreen}Template creator does not have more than 1000 edits! so it is passed\03{default}"
            )
            wikipedia.output(
                u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
            )
            continue
        else:
            wikipedia.output(
                u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
            )
            wikipedia.output(
                u"\03{lightgreen}User:"******"\03{default} and s/he has more than\03{lightgreen} 1000\03{default} edits so it is ok!"
            )
            wikipedia.output(
                u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
            )
        passport = True
        enchar = u'qwertyuiopasdfghjklzxcvbnm'
        for i in enchar:
            if tem.title().replace(u'الگو:',
                                   u'').replace(u'template:', u'').replace(
                                       u'Template:', u'').find(i) != -1:
                passport = False
                break
        if not passport:
            continue
        if tem.title().find(u'/') != -1 or tem.title().find(u'\\') != -1:
            continue
        try:
            tem_text = tem.get()
        except:
            continue
        tem_text = tem_text.replace(u'{{ ', u'{{').replace(
            u'{{ ', u'{{').replace(u'{{الگو:', u'{{').replace(
                u'{{Template:', u'{{').replace(u'{{template:', u'{{')
        TempTemplates = templatequery(tem.title())
        if not u'Navbox' in TempTemplates:
            continue
        #if tem_text.find(u'{{جعبه گشتن')==-1 and tem_text.find(u'{{navbox')==-1 and tem_text.find(u'{{Navbox')==-1 and tem_text.find(u'{{National squad')==-1 and tem_text.find(u'{{national squad')==-1:
        #    continue
        wikipedia.output(tem)
        added_template = tem.title().replace(u'الگو:', u'').replace(
            u'template:', u'').replace(u'Template:', u'')
        if tem.namespace() != 10:
            continue
        redirects = tem.getReferences(redirectsOnly=True)
        redirect_list = []
        for i in redirects:
            redirect_list.append(i.title().replace(u'الگو:', u'').replace(
                u'template:', u'').replace(u'Template:', u''))
        links = tem.linkedPages()
        links, delink = link_filtering(tem_text, links)
        wikipedia.output(u'-----------------------------------------')
        old_tem_text = tem_text
        for nonlink in delink:
            tem_text = tem_text.replace(u'[[' + nonlink + u']]',
                                        nonlink.split(u'|')[0])
        if old_tem_text != tem_text:
            wikipedia.output(u'\03{lightred}delinking\03{default}')
            tem.put(tem_text, u'ربات:برداشتن پیوندهای نالازم')
        for fapage in links:
            try:
                text = fapage.get()
            except wikipedia.IsRedirectPage:
                fapage_redi = fapage.getRedirectTarget()
                try:
                    text = fapage_redi.get()
                    solve_redirect(tem, fapage, fapage_redi)
                    fapage = fapage_redi
                except:
                    continue
            except:
                wikipedia.output(u'\03{lightred}link was red\03{default}')
                continue
            wikipedia.output(u'\03{lightblue}--' + fapage.title() +
                             u'---------\03{default}')
            msg = u' '
            text, cleaning_version, msg_clean = fa_cosmetic_changes.fa_cosmetic_changes(
                text, fapage, msg)
            old_text = text
            for i in redirect_list:
                text = text.replace(u'{{' + i + u'}}',
                                    u'{{' + added_template + u'}}').replace(
                                        u'{{' + i + u'|',
                                        u'{{' + added_template + u'|')
            fatemplates = templatequery(fapage.title())
            text = text.replace(u'{{ ', u'{{').replace(u' }}', u'}}').replace(
                u'{{الگو:', u'{{').strip()
            if not fatemplates:
                continue
            if text.find(u'{{' + added_template +
                         u'}}') == -1 and (not added_template in fatemplates):
                addtemplate = u'{{' + added_template + u'}}'
                addtext(fapage, text, addtemplate, msg_clean)
                wikipedia.output(u'added= {{\03{lightpurple}' +
                                 added_template + u'\03{default}}}')
                continue

            if old_text != text:
                try:
                    fapage.put(text, u'ربات:اصلاح تغییرمسیر ناوباکس‌')
                    wikipedia.output(
                        u'\03{lightpurple}ربات:اصلاح تغییرمسیر ناوباکس\03{default}'
                    )
                except:
                    pass
                continue
예제 #6
0
def add_nav(preloadingGen):
    for tem in preloadingGen:
        user_pass,First_user=check_user(tem)
        if not user_pass:
            wikipedia.output(u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
            wikipedia.output("\03{lightgreen}Template creator does not have more than 1000 edits! so it is passed\03{default}")
            wikipedia.output(u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
            continue
        else:
            wikipedia.output(u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') 
            wikipedia.output(u"\03{lightgreen}User:"******"\03{default} and s/he has more than\03{lightgreen} 1000\03{default} edits so it is ok!")
            wikipedia.output(u'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
        passport=True
        enchar=u'qwertyuiopasdfghjklzxcvbnm'
        for i in enchar:
            if tem.title().replace(u'الگو:',u'').replace(u'template:',u'').replace(u'Template:',u'').find(i)!=-1:
                passport=False
                break
        if not passport:
            continue
        if tem.title().find(u'/')!=-1 or tem.title().find(u'\\')!=-1:
            continue  
        try:
            tem_text=tem.get()
        except:
            continue
        tem_text=tem_text.replace(u'{{ ',u'{{').replace(u'{{ ',u'{{').replace(u'{{الگو:',u'{{').replace(u'{{Template:',u'{{').replace(u'{{template:',u'{{')
        TempTemplates=templatequery(tem.title())
        if not u'Navbox' in TempTemplates:
            continue
        #if tem_text.find(u'{{جعبه گشتن')==-1 and tem_text.find(u'{{navbox')==-1 and tem_text.find(u'{{Navbox')==-1 and tem_text.find(u'{{National squad')==-1 and tem_text.find(u'{{national squad')==-1:
        #    continue
        wikipedia.output(tem)
        added_template=tem.title().replace(u'الگو:',u'').replace(u'template:',u'').replace(u'Template:',u'')
        if tem.namespace()!=10:
            continue
        redirects=tem.getReferences(redirectsOnly=True)
        redirect_list=[]
        for i in redirects:
            redirect_list.append(i.title().replace(u'الگو:',u'').replace(u'template:',u'').replace(u'Template:',u''))
        links=tem.linkedPages()
        links,delink=link_filtering(tem_text,links)
        wikipedia.output(u'-----------------------------------------')    
        old_tem_text=tem_text
        for nonlink in delink:
            tem_text=tem_text.replace(u'[['+nonlink+u']]',nonlink.split(u'|')[0])
        if old_tem_text!=tem_text:
            wikipedia.output(u'\03{lightred}delinking\03{default}')
            tem.put(tem_text,u'ربات:برداشتن پیوندهای نالازم')
        for fapage in links:
            try:
                text=fapage.get()
            except wikipedia.IsRedirectPage:
                fapage_redi = fapage.getRedirectTarget()
                try:
                    text=fapage_redi.get()
                    solve_redirect(tem,fapage,fapage_redi)
                    fapage=fapage_redi
                except:
                    continue
            except:
                wikipedia.output(u'\03{lightred}link was red\03{default}')
                continue
            wikipedia.output(u'\03{lightblue}--'+fapage.title()+u'---------\03{default}')
            msg=u' '
            text,cleaning_version,msg_clean=fa_cosmetic_changes.fa_cosmetic_changes(text,fapage,msg)
            old_text=text
            for i in redirect_list: 
                text=text.replace(u'{{'+i+u'}}',u'{{'+added_template+u'}}').replace(u'{{'+i+u'|',u'{{'+added_template+u'|')
            fatemplates=templatequery(fapage.title())
            text=text.replace(u'{{ ',u'{{').replace(u' }}',u'}}').replace(u'{{الگو:',u'{{').strip()
            if not fatemplates:
                continue
            if text.find(u'{{'+added_template+u'}}')==-1 and (not added_template in fatemplates):
               addtemplate=u'{{'+added_template+u'}}'
               addtext (fapage,text,addtemplate,msg_clean)
               wikipedia.output(u'added= {{\03{lightpurple}'+added_template+u'\03{default}}}')    
               continue
 
            if old_text!=text:
                try:
                    fapage.put(text,u'ربات:اصلاح تغییرمسیر ناوباکس‌')
                    wikipedia.output(u'\03{lightpurple}ربات:اصلاح تغییرمسیر ناوباکس\03{default}')
                except:
                    pass    
                continue
예제 #7
0
def senario_E(text, user, workpage_page, interwiki_list):
    #wikipedia.output(u'*******////****')
    page = wikipedia.Page(faSite, workpage_page)
    msg = u' '
    new_text, cleaning_version, msg_clean = fa_cosmetic_changes.fa_cosmetic_changes(
        text, page, msg)
    msg = u'ربات:مرتب‌سازی عنوان‌ها' + msg_clean
    msg = msg.replace(u'+ +', u'+')
    fapage_title = workpage_page.title()
    enpage_title = englishdictionry(fapage_title, 'fa', 'en')
    entemps = templatequery(enpage_title, enSite)
    fatemps = templatequery(fapage_title, faSite)
    At_faArticle = u'در مقالهٔ [[' + fapage_title + u']] > '
    if text != new_text:
        update_page(new_text, user, workpage_page, msg)
        text = new_text
    sections, toppage = findsection(text)
    if len(sections) < 2:
        wikipedia.output(
            u'\03{lightred}The article does not have any section!\03{default}')
        sections, toppage = [text], text

    alarm_text = u'{{جا:کاربر:FawikiPatroller/هشدار۱|' + workpage_page + u'|'
    alarmtup = []
    alarmnum = 0
    mytext = toppage + u'\n'
    after_source = False
    after_source_text = u'\n'
    for section in sections:
        if section.find(u'== منابع ==') != -1 or section.find(
                u'==منابع==') != -1 or section.find(
                    u'== منبع‌ها ==') != -1 or section.find(
                        u'==منبع‌ها==') != -1:
            after_source = True
            continue
        else:
            if not after_source:
                mytext += section
        if after_source:
            after_source_text += section

    mytext = re.sub(ur'\[\[رده\:.*?\]\]', u'', mytext)
    #-----------------------------------------------------------------
    force = False
    enchar = u'QWERTYUIOPASDFGHJKLZXCVBNM'
    if mytext.strip(
    ) and mytext.find(u'خرد}}') != -1 and after_source_text.find(
            u'خرد}}') == -1 and len(sections) > 1:  #1
        wikipedia.output(after_source_text)
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u"طبق [[وپ:بخش‌بندی|شیوهٔ ویرایش مرسوم در ویکی‌پدیا]] '''[[الگو:خرد]]''' باید بعد از بخش منابع قرار داده شود."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if Page_size(workpage_page) < 4000 and text.find(u'خرد}}') == -1:  #2
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u'با توجه به حجم کم [[:رده:الگو:مقاله‌های خرد|الگوی خرد مناسب]] را در انتهای مقاله قرار دهید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if mytext.find(u'[[') == -1 and sections:  #3
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u'[[وپ:ویکی‌سازی|ویکی‌سازی]] نمائید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if text.find(u'==') == -1 and workpage_page.find(u'فهرست') == -1:  #4
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u'[[وپ:بخش‌بندی|بخش‌بندی]] نمائید.'
        force = True
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if (u'Template:Infobox' in entemps) and enpage_title:
        checkinfo = True
    else:
        checkinfo = False

    if checkinfo and (not u'الگو:Infobox' in fatemps) and text.find(
            u'{{جعبه') == -1 and text.find(u'{|') == -1 and workpage_page.find(
                u'فهرست') == -1:  #5
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u'[[وپ:جعبه اطلاعات|جعبه اطلاعات]] مناسب بیافزائید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if mytext.strip() and text.find(u'== منابع ==') == -1 and text.find(
            u'== پانویس ==') == -1 and text.find(
                u'==پانویس==') == -1 and text.find(u'==منابع==') == -1:  #6
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u'منبع مناسب بیافزائید و همچنین [[وپ:بخش‌بندی|زیربخش منابع]] را در پائین مقاله بیافزائید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if mytext.strip() and not toppage.strip() and workpage_page.find(
            u'فهرست') == -1:  #7
        alarmnum += 1
        force = True
        alarm_message = At_faArticle
        alarm_message += u'طبق [[وپ:بخش‌بندی|شیوهٔ نگارش]] در ویکی‌پدیا باید در بخش ابتدایی مقاله چند خط مطلب به عنوان مقدمه وجود داشته باشد.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if toppage.find(u"'''") == -1 and toppage and workpage_page.find(
            u'فهرست') == -1:  #8
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u"طبق [[وپ:بخش‌بندی|شیوهٔ نگارش]] در ویکی‌پدیا باید عنوان مقاله در بخش مقدمه با <nowiki>'''</nowiki> پررنگ شود."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    textcat = text.replace(u'[[رده:مقاله‌های ایجاد شده توسط ایجادگر]]',
                           u'').replace(u'\n\n', u'\n')  #9
    if textcat.find(u'[[رده:') == -1 and textcat.find(
            u'[[category:') == -1 and textcat.find(u'[[Category:') == -1:
        alarmnum += 1
        force = True
        alarm_message = At_faArticle
        alarm_message += u"[[وپ:رده‌بندی|رده‌بندی]] انجام نشده‌است و به علت نبود [[وپ:میان‌ویکی|میان‌ویکی]] ربات‌های ردهٔ همسنگ نمی‌تواند به مقالهٔ شما رده بیافزایند در صورت امکان ردهٔ مناسب یا میان‌ویکی را به مقاله بیافزائید."
        if len(interwiki_list) > 0 and enpage_title:  #اگر میان‌ویکی نداشت
            encats = getEnCat(enpage_title)
            encats_Text = u'، '.join(encats)
            alarm_message = At_faArticle
            alarm_message += u"[[وپ:رده‌بندی|رده‌بندی]] انجام نشده‌است و به علت نبود [[ویکی‌پدیا:رده همسنگ|ردهٔ همسنگ با ویکی‌پدیای انگلیسی]] ربات‌های ردهٔ همسنگ نتوانستند به مقالهٔ شما رده بیافزایند در صورت امکان رده‌های زیر را همراه با میان‌ویکی ایجاد نمائید تا ربات‌های ردهٔ همسنگ آن را به این مقاله و مقالات مشابه بیافزایند."
            if len(encats) == 1:
                alarm_message += u"\n::::***" + encats_Text + u" ردهٔ همسنگ '''مورد نیاز''' برای مقالهٔ [[" + fapage_title + u"]] است؛ لطفاً در ساخت آن کمک کنید."
            else:
                alarm_message += u"\n::::***" + encats_Text + u" رده‌های همسنگ '''مورد نیاز''' برای مقالهٔ [[" + fapage_title + u"]] است؛ لطفاً در ساخت آنها کمک کنید."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if toppage.strip() and workpage_page.find(u'فهرست') == -1:  #10
        passport = False
        if toppage.find(u'(') < 250 and toppage.find(
                u'(') != -1 and toppage.find(u')') != -1:
            for i in enchar:
                entext = toppage.split(u'(')[1].split(u')')[0].strip()
                if entext.find(i) != -1 or entext.find(i.lower()) != -1:
                    if fatemps:
                        if not u'الگو:Lang' in fatemps:
                            passport = True
                    else:
                        passport = True
                    break
        if not check_user_editnum(user, 3000):
            if passport:
                alarmnum += 1
                alarm_message = At_faArticle
                alarm_message += u"برای نوشتن معادل‌های غیر فارسی از {{الگو|به زبان}} استفاده نمائید."
                wikipedia.output(alarm_message)
                alarmtup.append(alarm_message)
                alarm_text += alarm_message + u'|'

        if (text.find(u'.wikipedia.org') != -1 or text.find(u'*ویکی') != -1
                or text.find(u'* ویکی') != -1):
            if len(interwiki_list) < 1:  #11
                alarmnum += 1
                alarm_message = At_faArticle
                alarm_message += u"ویکی‌پدیا به زبان دیگر به عنوان منبع ذکر شده‌است یا پیوند به آن وجود دارد ولی مقاله [[وپ:میان‌ویکی|میان‌ویکی]] ندارد. میان‌ویکی مناسب را به مقاله بیافزائید یا اگر مقاله معادلی در ویکی‌های دیگر ندارد پیوند به ویکی‌پدیا را از مقاله بزدائید؛ توجه داشته باشید که نمی‌توان از ویکی‌پدیا به عنوان منبع استفاده کرد."
                force = True
                wikipedia.output(alarm_message)
                alarmtup.append(alarm_message)
                alarm_text += alarm_message + u'|'
    if not check_user_editnum(user, 2000):
        for i in enchar + u',0123456789' + u"'":  #12
            if workpage_page.find(i) != -1 or workpage_page.find(
                    i.lower()) != -1:
                alarmnum += 1
                alarm_message = At_faArticle
                alarm_message += u"عنوان را با حروف فارسی ترجمه یا آوانگاری نمائید؛ در ویکی‌پدیای فارسی [[وپ:عنوان|عنوان مقاله‌ها]] باید با حروف فارسی نوشته شوند."
                force = True
                wikipedia.output(alarm_message)
                alarmtup.append(alarm_message)
                alarm_text += alarm_message + u'|'
                break

    textdash = text.replace(u'۱', u'1').replace(u'۲', u'2').replace(
        u' :', u'').replace(u': ', u'').replace(u':', u'').replace(u'\r', u'')
    textdash = re.sub(r'\[\[.(?:\[\[.*?\]\]|[^\]])*\]\]', '', textdash, re.S)
    if textdash.find(u'\n1') != -1 and textdash.find(u'\n2') != -1:  #13
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u"به جای استفاده از اعداد شمارنده در سرخطوط مانند''' ۱- ۲-''' و... یا''' ۱) ۲)''' و... از علامت # استفاده نمائید.(برای اطلاعات بیشتر [[ویکی‌پدیا:آموزش سریع|آموزش سریع]] را مطالعه نمائید.)"
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'

    if string.count(text, u'{{سخ}}') > 3 and workpage_page.find(
            u'فهرست') == -1 and len(interwiki_list) < 0:  #14
        alarmnum += 1
        alarm_message = At_faArticle
        alarm_message += u"استفاده بیش از حد از الگوی {{الگو|سخ}} یا <nowiki><br></nowiki> در متن درست نیست به جای آن دوبار دکمهٔ {{key press|Enter}} بزنید."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text += alarm_message + u'|'
    if alarmnum > 3 or force:
        wikipedia.output(u'\03{lightgreen}' + workpage_page +
                         u' is added to bad edituin list!\03{default}')
        alarm_text = alarm_text[:-1] + u'}}'
        #-------------------------------------alarms------------
        if user in userdict:
            for item in alarmtup:
                userdict[user].append(item)
        else:
            userdict[user] = alarmtup
        #---------------------------------------articles------------------
        if user in user_article_dict:
            user_article_dict[user].append(workpage_page)
        else:
            user_article_dict[user] = [workpage_page]
def senario_E(text,user,workpage_page,interwiki_list):
    #wikipedia.output(u'*******////****')
    page= wikipedia.Page(faSite,workpage_page)
    msg=u' '
    new_text,cleaning_version,msg_clean=fa_cosmetic_changes.fa_cosmetic_changes(text,page,msg)
    msg=u'ربات:مرتب‌سازی عنوان‌ها'+msg_clean
    msg=msg.replace(u'+ +',u'+')
    fapage_title=workpage_page.title()
    enpage_title=englishdictionry(fapage_title,'fa','en')
    entemps=templatequery(enpage_title,enSite)
    fatemps=templatequery(fapage_title,faSite)
    At_faArticle=u'در مقالهٔ [['+fapage_title+u']] > '
    if text!=new_text:
        update_page(new_text,user,workpage_page,msg)    
        text=new_text
    sections,toppage=findsection(text)
    if len(sections)<2:
        wikipedia.output(u'\03{lightred}The article does not have any section!\03{default}')
        sections,toppage=[text],text
        
    alarm_text=u'{{جا:کاربر:FawikiPatroller/هشدار۱|'+workpage_page+u'|'
    alarmtup=[]
    alarmnum=0
    mytext=toppage+u'\n'
    after_source=False
    after_source_text=u'\n'
    for section in sections:
        if section.find(u'== منابع ==')!=-1 or section.find(u'==منابع==')!=-1 or section.find(u'== منبع‌ها ==')!=-1 or section.find(u'==منبع‌ها==')!=-1:
           after_source=True
           continue
        else:
            if not after_source:
                mytext+=section
        if after_source:
            after_source_text+=section

    mytext=re.sub(ur'\[\[رده\:.*?\]\]',u'',mytext)
    #-----------------------------------------------------------------
    force=False
    enchar=u'QWERTYUIOPASDFGHJKLZXCVBNM'
    if mytext.strip() and mytext.find(u'خرد}}')!=-1 and after_source_text.find(u'خرد}}')==-1 and len(sections)>1:#1
        wikipedia.output(after_source_text)
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u"طبق [[وپ:بخش‌بندی|شیوهٔ ویرایش مرسوم در ویکی‌پدیا]] '''[[الگو:خرد]]''' باید بعد از بخش منابع قرار داده شود."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'

    if Page_size(workpage_page)<4000 and text.find(u'خرد}}')==-1:#2
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u'با توجه به حجم کم [[:رده:الگو:مقاله‌های خرد|الگوی خرد مناسب]] را در انتهای مقاله قرار دهید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'

    if mytext.find(u'[[')==-1 and sections:#3    
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u'[[وپ:ویکی‌سازی|ویکی‌سازی]] نمائید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
        
    if text.find(u'==')==-1 and workpage_page.find(u'فهرست')==-1:#4
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u'[[وپ:بخش‌بندی|بخش‌بندی]] نمائید.'
        force=True
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'

    if (u'Template:Infobox' in entemps) and enpage_title:
        checkinfo=True
    else:
        checkinfo=False

    if checkinfo and (not u'الگو:Infobox' in fatemps) and text.find(u'{{جعبه')==-1 and text.find(u'{|')==-1 and workpage_page.find(u'فهرست')==-1:#5
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u'[[وپ:جعبه اطلاعات|جعبه اطلاعات]] مناسب بیافزائید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
        
    if mytext.strip() and text.find(u'== منابع ==')==-1 and text.find(u'== پانویس ==')==-1 and text.find(u'==پانویس==')==-1 and text.find(u'==منابع==')==-1:#6
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u'منبع مناسب بیافزائید و همچنین [[وپ:بخش‌بندی|زیربخش منابع]] را در پائین مقاله بیافزائید.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
        
    if mytext.strip() and not toppage.strip() and workpage_page.find(u'فهرست')==-1:#7
        alarmnum+=1
        force=True
        alarm_message=At_faArticle
        alarm_message+=u'طبق [[وپ:بخش‌بندی|شیوهٔ نگارش]] در ویکی‌پدیا باید در بخش ابتدایی مقاله چند خط مطلب به عنوان مقدمه وجود داشته باشد.'
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'

    if toppage.find(u"'''")==-1 and toppage and workpage_page.find(u'فهرست')==-1:#8
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u"طبق [[وپ:بخش‌بندی|شیوهٔ نگارش]] در ویکی‌پدیا باید عنوان مقاله در بخش مقدمه با <nowiki>'''</nowiki> پررنگ شود."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
    
    textcat=text.replace(u'[[رده:مقاله‌های ایجاد شده توسط ایجادگر]]',u'').replace(u'\n\n',u'\n')#9
    if textcat.find(u'[[رده:')==-1 and textcat.find(u'[[category:')==-1 and textcat.find(u'[[Category:')==-1:
        alarmnum+=1
        force=True
        alarm_message=At_faArticle
        alarm_message+=u"[[وپ:رده‌بندی|رده‌بندی]] انجام نشده‌است و به علت نبود [[وپ:میان‌ویکی|میان‌ویکی]] ربات‌های ردهٔ همسنگ نمی‌تواند به مقالهٔ شما رده بیافزایند در صورت امکان ردهٔ مناسب یا میان‌ویکی را به مقاله بیافزائید."
        if len(interwiki_list)>0 and enpage_title:#اگر میان‌ویکی نداشت
            encats=getEnCat(enpage_title)
            encats_Text=u'، '.join(encats)
            alarm_message=At_faArticle
            alarm_message+=u"[[وپ:رده‌بندی|رده‌بندی]] انجام نشده‌است و به علت نبود [[ویکی‌پدیا:رده همسنگ|ردهٔ همسنگ با ویکی‌پدیای انگلیسی]] ربات‌های ردهٔ همسنگ نتوانستند به مقالهٔ شما رده بیافزایند در صورت امکان رده‌های زیر را همراه با میان‌ویکی ایجاد نمائید تا ربات‌های ردهٔ همسنگ آن را به این مقاله و مقالات مشابه بیافزایند."
            if len(encats)==1:
                alarm_message+=u"\n::::***"+encats_Text+u" ردهٔ همسنگ '''مورد نیاز''' برای مقالهٔ [["+fapage_title+u"]] است؛ لطفاً در ساخت آن کمک کنید."
            else:
                alarm_message+=u"\n::::***"+encats_Text+u" رده‌های همسنگ '''مورد نیاز''' برای مقالهٔ [["+fapage_title+u"]] است؛ لطفاً در ساخت آنها کمک کنید."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
        
    if toppage.strip() and workpage_page.find(u'فهرست')==-1 :#10
        passport=False
        if toppage.find(u'(')<250 and toppage.find(u'(')!=-1 and toppage.find(u')')!=-1:
            for i in enchar:
                entext=toppage.split(u'(')[1].split(u')')[0].strip()
                if entext.find(i)!=-1 or entext.find(i.lower())!=-1:
                    if fatemps:
                        if not u'الگو:Lang' in fatemps:
                            passport=True
                    else:
                        passport=True        
                    break
        if not check_user_editnum(user,3000):
            if passport:
                alarmnum+=1
                alarm_message=At_faArticle
                alarm_message+=u"برای نوشتن معادل‌های غیر فارسی از {{الگو|به زبان}} استفاده نمائید."
                wikipedia.output(alarm_message)
                alarmtup.append(alarm_message)
                alarm_text+=alarm_message+u'|'
    
        if (text.find(u'.wikipedia.org')!=-1 or text.find(u'*ویکی')!=-1 or text.find(u'* ویکی')!=-1):
            if len(interwiki_list)<1:#11
                alarmnum+=1
                alarm_message=At_faArticle
                alarm_message+=u"ویکی‌پدیا به زبان دیگر به عنوان منبع ذکر شده‌است یا پیوند به آن وجود دارد ولی مقاله [[وپ:میان‌ویکی|میان‌ویکی]] ندارد. میان‌ویکی مناسب را به مقاله بیافزائید یا اگر مقاله معادلی در ویکی‌های دیگر ندارد پیوند به ویکی‌پدیا را از مقاله بزدائید؛ توجه داشته باشید که نمی‌توان از ویکی‌پدیا به عنوان منبع استفاده کرد."
                force=True
                wikipedia.output(alarm_message)    
                alarmtup.append(alarm_message)
                alarm_text+=alarm_message+u'|'
    if not check_user_editnum(user,2000):
        for i in enchar+u',0123456789'+u"'":#12
            if workpage_page.find(i)!=-1 or workpage_page.find(i.lower())!=-1:
                alarmnum+=1
                alarm_message=At_faArticle
                alarm_message+=u"عنوان را با حروف فارسی ترجمه یا آوانگاری نمائید؛ در ویکی‌پدیای فارسی [[وپ:عنوان|عنوان مقاله‌ها]] باید با حروف فارسی نوشته شوند."
                force=True
                wikipedia.output(alarm_message)    
                alarmtup.append(alarm_message)
                alarm_text+=alarm_message+u'|'
                break
    
    textdash=text.replace(u'۱',u'1').replace(u'۲',u'2').replace(u' :',u'').replace(u': ',u'').replace(u':',u'').replace(u'\r',u'')
    textdash=re.sub(r'\[\[.(?:\[\[.*?\]\]|[^\]])*\]\]','',textdash, re.S)
    if textdash.find(u'\n1')!=-1 and textdash.find(u'\n2')!=-1:#13 
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u"به جای استفاده از اعداد شمارنده در سرخطوط مانند''' ۱- ۲-''' و... یا''' ۱) ۲)''' و... از علامت # استفاده نمائید.(برای اطلاعات بیشتر [[ویکی‌پدیا:آموزش سریع|آموزش سریع]] را مطالعه نمائید.)"
        wikipedia.output(alarm_message)    
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
    
    if string.count(text,u'{{سخ}}')>3 and workpage_page.find(u'فهرست')==-1 and len(interwiki_list)<0:#14  
        alarmnum+=1
        alarm_message=At_faArticle
        alarm_message+=u"استفاده بیش از حد از الگوی {{الگو|سخ}} یا <nowiki><br></nowiki> در متن درست نیست به جای آن دوبار دکمهٔ {{key press|Enter}} بزنید."
        wikipedia.output(alarm_message)
        alarmtup.append(alarm_message)
        alarm_text+=alarm_message+u'|'
    if alarmnum > 3 or force:
        wikipedia.output(u'\03{lightgreen}'+workpage_page+u' is added to bad edituin list!\03{default}')
        alarm_text=alarm_text[:-1]+u'}}'
        #-------------------------------------alarms------------
        if user in userdict:
            for item in alarmtup:
                userdict[user].append(item)
        else:
            userdict[user]=alarmtup
        #---------------------------------------articles------------------
        if user in user_article_dict:
            user_article_dict[user].append(workpage_page)
        else:
            user_article_dict[user]=[workpage_page]