Talk:List of XEPs

From JaWiki (Jabber/XMPP wiki)
Revision as of 06:05, 22 December 2015 by 178.73.219.213 (Talk) (Inside Painless air freight Solutions: new section)

Jump to: navigation, search

Скрипт для генерации и проверки списка

Требуется Python 3

#! /usr/bin/env python3
# -*- coding: utf-8 -*-


# input
XEPS_ORIG_URL = 'http://xmpp.org/extensions/xeps.xml'
XEPS_WIKI_URL_T = 'http://jawiki.ru/index.php?title={}&action=raw'
XEPS_WIKI_URL_PAGES = (
    'Список_расширений/0001—0049',
    'Список_расширений/0050—0099',
    'Список_расширений/0100—0149',
    'Список_расширений/0150—0199',
    'Список_расширений/0200—0249',
    'Список_расширений/0250—0299'
)


import itertools
import re
import sys
import urllib.request
import xml.etree.ElementTree as xml


def fetchUrl(url):
    return urllib.request.urlopen(url).read().decode('UTF-8')


def initXepList():
    print('... Получение оригинального списка расширений... ', end='', file=sys.stderr)
    sys.stderr.flush()
    xeps_orig_xml = xml.XML(fetchUrl(XEPS_ORIG_URL))
    print('Готово.', file=sys.stderr)
    
    xeps_orig = {}
    for xep in xeps_orig_xml:
        number = xep.find('number').text
        xeps_orig[number] = {
            'name': xep.find('name').text,
            'abstract': xep.find('abstract').text,
            'type': xep.find('type').text.replace(' ', '_'),
            'status': xep.find('status').text
        }
    
    for number in sorted(xeps_orig):
        print(
            '{{{{XepListItem|{number}|{name}|{abstract}|||{type}|{status}}}}}'
                .format(number=number, **xeps_orig[number])
        )


def main():
    print('... Получение списка расширений из ЯВики... ', end='')
    xeps_wiki = itertools.chain(*(
        fetchUrl(XEPS_WIKI_URL_T.format(urllib.parse.quote(page))).splitlines()
        for page in XEPS_WIKI_URL_PAGES
    ))
    print('Готово.')
    
    xeps = {}
    for line in xeps_wiki:
        line = line[2:-2] # убираем двойные фигурные скобки по краям, если есть
        line = re.sub(r'\{\{.*?\}\}', '', line) # вырезаем вызовы викишаблонов, в них могут быть палки
        line = re.sub(r'\[\[.*?\]\]', '', line) # вырезаем викиссылки, в них могут быть палки
        parts = line.split('|')
        if parts[0] == 'XepListItem':
            xeps[parts[1]] = {
                'name': parts[2],
                'type': parts[6].replace('_', ' '),
                'status': parts[7]
            }
    
    print('... Прочитано %d расширений.' % len(xeps))
    
    print('... Получение оригинального списка расширений... ', end='')
    xeps_orig_xml = xml.XML(fetchUrl(XEPS_ORIG_URL))
    print('Готово.')
    
    xeps_orig = {}
    for xep in xeps_orig_xml:
        number = xep.find('number').text
        xeps_orig[number] = {
            'name': xep.find('name').text,
            'type': xep.find('type').text,
            'status': xep.find('status').text
        }
    
    differ = False
    for number in sorted(xeps_orig):
        if number not in xeps:
            differ = True
            print('[*] Новое расширение: XEP-' + number)
            print('\tНазвание: ' + xeps_orig[number]['name'])
            print('\tТип: ' + xeps_orig[number]['type'])
            print('\tСтатус: ' + xeps_orig[number]['status'])
        elif xeps[number] != xeps_orig[number]:
            differ = True
            print('[*] Различается XEP-' + number)
            if xeps[number]['name'] != xeps_orig[number]['name']:
                print('\tНазвание изменено с "{0}" на "{1}"'.format(xeps[number]['name'], xeps_orig[number]['name']))
            if xeps[number]['type'] != xeps_orig[number]['type']:
                print('\tТип изменён с "{0}" на "{1}"'.format(xeps[number]['type'], xeps_orig[number]['type']))
            if xeps[number]['status'] != xeps_orig[number]['status']:
                print('\tСтатус изменён с "{0}" на "{1}"'.format(xeps[number]['status'], xeps_orig[number]['status']))
    
    if not differ:
        print('[=] Различия не найдены.')


if __name__ == '__main__':
    #initXepList()
    main()

== Critical Criteria Of air freight - Some Thoughts

==

This is a list of words, not an essay. you might be incompetent

<a href=https://en.gravatar.com/martinkathry>easy ways to make hair grow faster</a> <a href=http://www.eventbrite.com/o/mira-hair-oil-reviews-8945247462>best vitamin for hair growth</a> <a href=https://myspace.com/martinkathry>biotin for hair growth</a> <a href=https://qtrial2014.az1.qualtrics.com/jfe/form/SV_8uDlpT48yTmwqgt>best way to grow hair</a> <a href=https://developer.mozilla.org/en-US/profiles/martinkathry>best vitamins for hair growth</a>

== Uncomplicated air freight Advice - An Intro

==

Thank you for your operate. Post assisted me a good deal

<a href=https://modules.apache.org/profile.lua?uid=152018>best way to grow hair</a> <a href=http://doomcom.mit.edu/profile.php?mode=viewprofile&u=19302>best vitamins for hair growth</a> <a href=https://plus.google.com/109127607464978476932/about?hl=en-GB>best vitamins for hair growth</a> <a href=https://www.coursera.org/user/i/0bcde6a8d38b38a051ceee1e66d7b1b9>easy ways to make hair grow faster</a> <a href=https://www.scribd.com/user/302419166/martinkathry>can you make hair grow faster</a>

== Quick Programs For air freight - What's Required

==

Say “thanks” you for your mothers and fathers which they gave you the globe

<a href=https://profiles.wordpress.org/martinkathry/>best way to make hair grow</a> <a href=https://plus.google.com/109127607464978476932/about?hl=en-GB>biotin hair growth</a> <a href=https://developer.mozilla.org/en-US/profiles/martinkathry>best way to make hair grow</a> <a href=https://www.pinterest.com/martinkathry/>biotin hair growth</a> <a href=https://modules.apache.org/profile.lua?uid=152018>best vitamins for hair growth</a>

== The Latest On Speedy Solutions For air freight

==

I would prefer to uslysht just a little much more on this subject

<a href=https://developer.mozilla.org/en-US/profiles/martinkathry>best vitamin for hair growth</a> <a href=https://issuu.com/martinkathry>best vitamin for hair growth</a> <a href=https://profiles.wordpress.org/martinkathry/>can you make your hair grow faster</a> <a href=https://zohodiscussions.com/jquery/user/Kathry%20Martin>can you make your hair grow faster</a> <a href=http://h2obeta.law.harvard.edu/viewProfile.do?userId=1801827>can you make your hair grow faster</a>

== Exploring Immediate Secrets In air freight

==

I like what I see so i'm just subsequent you. Appear ahead to discovering your web webpage however again.

<a href=https://modules.apache.org/profile.lua?uid=152018>best vitamin for hair growth</a> <a href=https://www.coursera.org/user/i/0bcde6a8d38b38a051ceee1e66d7b1b9>best way to grow hair</a> <a href=https://www.blogger.com/profile/09119391595038825063>best vitamin for hair growth</a> <a href=http://doomcom.mit.edu/profile.php?mode=viewprofile&u=19302>best vitamins for hair growth</a> <a href=https://kdp.amazon.com/community/profile.jspa?userID=886195>best way to make hair grow</a>

== Inside Painless air freight Solutions

==

Read more @ bestblackhatforum.com : [GET] 96 spun comments for scrapebox http://bestblackhatforum.com/Thread-GET-96-spun-comments-for-scrapebox#ixzz2ItgwUf3l

[url=http://www.studyabroad.com/members/martinkathry/default.aspx]biotin for hair growth[/url] [url=http://doomcom.mit.edu/profile.php?mode=viewprofile&u=19302]best way to grow hair[/url] [url=https://modules.apache.org/profile.lua?uid=152018]best way to make hair grow[/url] [url=https://discussions.apple.com/people/martinkathry?view=profile]can i make my hair grow faster[/url] [url=https://developer.mozilla.org/en-US/profiles/martinkathry]can you make your hair grow faster[/url]