I created a sample environment.
1. Use the attached fixes_diffcolor.py as fixes.py, or copy the fix from it
to your fixes.py.
2. https://hu.wikipedia.org/wiki/F%C3%A1jl:Uncoloured_replace_2in1.png will
emphasize two colouring errors in their original enviromnent (one ó/ő and
one é/á). I copied the original text to my test subpage.
3. Use the command
*replace.py -lang:hu -page:user:BinBot/semmi -fix:1970-as*
The bot will want to make 3 corrections, the above given 2 of them
uncoloured. (You don't have to actually press y, the test page is good if
it is wrong. :-))


2016-01-15 9:28 GMT+01:00 <[email protected]>:

> Could you provide a test command line in order we could check it for core
> (and compat as well)
>
> Greetings
>
> xqt
>
> ----- Original Nachricht ----
> Von:     Bináris <[email protected]>
> An:      Pywikibot discussion list <[email protected]>
> Datum:   14.01.2016 21:05
> Betreff: Re: [pywikibot] Uncoloured diffs in textlib
>
> > None of these are the same letters. :-) (ó and ?)
> > The problem does not occur each time ó is changed to ?, so one test is
> not
> > enough to say OK, only if the problem was directly fixed.
> >
> > 2016-01-14 19:46 GMT+01:00 Mpaa <[email protected]>:
> >
> > > In core it should be OK:
> > >
> > > [image: Inline image 1]
> > >
> > > Mpaa
> > >
> > > On Thu, Jan 14, 2016 at 7:17 PM, Bináris <[email protected]> wrote:
> > >
> > >> Hi.
> > >>
> > >> I have an old problem. When I run replace.py, sometimes the diff is
> not
> > >> coloured with red and green (see the attachment). This makes replacing
> > very
> > >> uncomfortable and also dangerous (even if I see a coloured
> difference, I
> > >> can't be sure there are no more).
> > >> I use compat so tell me, if the problem is already fixed in core and I
> > am
> > >> just speaking for nothing... I couldn't identify the reason, but in
> the
> > >> last times I always see it vith ó and ?, as seen on image; as to my
> best
> > >> knowledge Hungarian is the only language in the discovered part of
> > Universe
> > >> to use ?, this issue may have not come up for others.
> > >>
> > >> --
> > >> Bináris
> > >>
> > >> _______________________________________________
> > >> pywikibot mailing list
> > >> [email protected]
> > >> https://lists.wikimedia.org/mailman/listinfo/pywikibot
> > >>
> > >>
> > >
> > > _______________________________________________
> > > pywikibot mailing list
> > > [email protected]
> > > https://lists.wikimedia.org/mailman/listinfo/pywikibot
> > >
> > >
> >
> >
> > --
> > Bináris
> >
> >
> > --------------------------------
> >
> > _______________________________________________
> > pywikibot mailing list
> > [email protected]
> > https://lists.wikimedia.org/mailman/listinfo/pywikibot
> >
>



-- 
Bináris
# -*- coding: utf-8  -*-
# This is a sample fixes.py for generating a diff colouring error.
# Try replace.py -lang:hu -page:user:BinBot/semmi -fix:1970-as

fixes = {
    '1970-as': {
        'regex': True,
        # 'recursive': True,
        'msg': {
               'hu':u'Évszámok és más számok toldalékának hangrendi egyeztetése kézi ellenőrzéssel',
              },
        'munka': {
            'activity': u'Nyelvtani javítás',
            # 'targetlink': u'/vegyes',
            'target': u'(Év)számok toldalékának hangrendje',
            #activitylink, comment
        },
        'replacements': [
            # Ez így egymilliónál kisebb számokra lesz jó, de nem találtam ebből adódó hibát.
            # Hibák: tizedestörtek, 2/3-os (negatív visszaolvasás), 5/13-os (negatív \d ÉS \d* az elején) cm3-es, m3-es (inside kivétel)
            (ur'(\d(\]\])?)-osz(?P<lop>(tály|lop))', ur'\1 osz\g<lop>'), # Előjavítás
            (ur'(\d(\]\])?)-betűs', ur'\1 betűs'), # Előjavítás
            (ur'\$ *((\d|\s|&nbsp;)+?)-os', ur'\1 dolláros'), # Nem a toldalék hibás, hanem a konstrukció.
            (ur'\£ *((\d|\s|&nbsp;)+?)-os', ur'\1 fontos'), # Nem a toldalék hibás, hanem a konstrukció.
            # De itt meg pont rossz: 68 millió US$ 2006-os árfolyamon.

            # A nullára végződőek mindig kétalakúak.
            # Tízes vagy kerek százas, nem kerek ezres (dátum csak ahol értelmes)
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)[eöo]s', ur'\1as'),
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)be(?!li)', ur'\1ba'), # -ba és -ban, nem -beli
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)nek', ur'\1nak'),
            (ur'(?<![/,\.\d])(([23]0)(\]\])?-)én', ur'\1án'), # dátum: -én, -ének
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)től', ur'\1tól'),
            (ur'(?<![/,\.\d])(([23]0)(\]\])?-)ét', ur'\1át'), # dátum: -ét, -étől
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)sz[eö]r(?!ű)', ur'\1szor'), # -szerű nem! (Van ilyen példa.)
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)[eö]n (?P<lak>lak|él|volt|van|utaz)', ur'\1an \g<lak>'), 
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)[eö]n', ur'\1on'),
            (ur'(?<![/,\.\d])(\d*([2368]0|[1-9]00)(\]\])?-)[eö]t', ur'\1at'),
            # Tízes, de nem százas vagy kerek ezres (dátum csak ahol értelmes)
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)[aöo]s', ur'\1es'),
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)ba', ur'\1be'), # -ba és -ban
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)nak', ur'\1nek'),
            (ur'(?<![/,\.\d])(10(\]\])?-)án', ur'\1én'), # dátum: -én, -ének
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)tól', ur'\1től'),
            (ur'(?<![/,\.\d])(10(\]\])?-)át', ur'\1ét'), # dátum: -ét, -étől
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)sz[oö]r', ur'\1szer'),
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)[oö]n', ur'\1en'),
            (ur'(?<![/,\.\d])((\d*[14579]0|\d+000)(\]\])?-)[aö]t', ur'\1et'),

            # Az egyeseknél a dátum nem lehet 0.
            # Négyalakú egyes
            (ur'(?<![/,\.\d])(\d*[12479](\]\])?-)[aöo]s', ur'\1es'),
            (ur'(?<![/,\.\d])(\d*[38](\]\])?-)[eöo]s', ur'\1as'),
            (ur'(?<![/,\.\d])(\d*6(\]\])?-)[eöa]s', ur'\1os'),
            (ur'(?<![/,\.\d])(\d*5(\]\])?-)[eoa]s', ur'\1ös'),
            # (ur'(?<![/,\.\d])(0(\]\])?-)ás\b', ur'\1s'),
            # Háromalakú egyes
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)sz[eö]r[eö]s', ur'\1szoros'),
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)sz[eö]r(?!ű)', ur'\1szor'), # -szerű nem! (Van ilyen példa.)
            (ur'(?<![/,\.\d])(\d*[12479](\]\])?-)sz[oö]r[oö]s', ur'\1szeres'),
            (ur'(?<![/,\.\d])(\d*[12479](\]\])?-)sz[oö]r', ur'\1szer'),
            (ur'(?<![/,\.\d])(\d*5(\]\])?-)sz[oe]r[oe]s', ur'\1szörös'),
            (ur'(?<![/,\.\d])(\d*5(\]\])?-)sz[oe]r(?!ű)', ur'\1ször'),
            (ur'(?<![/,\.\d])(0(\]\])?-)sz[eö]r[eö]s', ur'\1szoros'),
            (ur'(?<![/,\.\d])(0(\]\])?-)sz[eö]r(?!ű)', ur'\1szor'),
            # Három- és négyalakú, hiányos egyes (nullánál és kettőnél nincs kötőhang)
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)[eö]n (?P<lak>lak|él|volt|van|utaz)', ur'\1an \g<lak>'), 
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)[eö]n', ur'\1on'), # Sima -n nem jó, mert nem tudjuk, hogy -on vagy -án kell. -an vszleg jó.
            (ur'(?<![/,\.\d])(\d*[38](\]\])?-)[eöo]t', ur'\1at'),
            (ur'(?<![/,\.\d])(\d*6(\]\])?-)[aeö]t', ur'\1ot'),
            (ur'(?<![/,\.\d])(\d*[1479](\]\])?-)[oö]n', ur'\1en'),
            (ur'(?<![/,\.\d])(\d*[1479](\]\])?-)[oöa]t', ur'\1et'),
            (ur'(?<![/,\.\d])(\d*5(\]\])?-)[o]n', ur'\1ön'), # Öten megint jó lehet.
            (ur'(?<![/,\.\d])(\d*5(\]\])?-)[oe]t', ur'\1öt'), # Öten megint jó lehet.
            (ur'(?<![/,\.\d])((\d*2|0)(\]\])?-)[oö]n', ur'\1n'),
            (ur'(?<![/,\.\d])((\d*2|0)(\]\])?-)[oöe]t', ur'\1t'),
            # 0-át, -ás, 2-őt lejjebb a vegyesjav2a-ban!
            # Kétalakú egyes
            (ur'(?<![/,\.\d])(\d*[124579](\]\])?-)ba', ur'\1be'), # -ba és -ban is
            (ur'(?<![/,\.\d])(\d*[124579](\]\])?-)nak', ur'\1nek'),
            (ur'(?<![/,\.\d])([12]?[4579](\]\])?-)án', ur'\1én'), # dátum: -én, -ének
            (ur'(?<![/,\.\d])([123]?1(\]\])?-)án', ur'\1én'), # dátum: -én, -ének
            (ur'(?<![/,\.\d])([12]2(\]\])?-)án', ur'\1én'), # dátum: -én, -ének; nincs kérdőjel!
            (ur'((ár|us|er) [12]?[268](\]\])?-)tól', ur'\1ától'), # dátumok előjavítása, gyűjtés közben a 2-tólt láttam gyakorinak.
            (ur'(?<![/,\.\d])(\d*[124579](\]\])?-)tól', ur'\1től'),
            (ur'(?<![/,\.\d])([12]?[4579](\]\])?-)át', ur'\1ét'), # dátum: -ét, -étől
            (ur'(?<![/,\.\d])([123]?1(\]\])?-)át', ur'\1ét'), # dátum: -ét, -étől
            (ur'(?<![/,\.\d])([12]2(\]\])?-)át', ur'\1ét'), # dátum: -ét, -étől; nincs kérdőjel!
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)be(?!li)', ur'\1ba'), # -ba és -ban is, nem -beli
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)nek', ur'\1nak'),
            (ur'(?<![/,\.\d])([12]?[368](\]\])?-)én', ur'\1án'), # dátum: -én, -ének
            (ur'(?<![/,\.\d])(\d*[368](\]\])?-)től', ur'\1tól'),
            (ur'(?<![/,\.\d])([12]?[368](\]\])?-)ét', ur'\1át'), # dátum: -ét, -étől; hiba: "a [[Vosztok-3]]-ét" (mármint a startját)
            (ur'(?<![/,\.\d])(0(\]\])?-)be(?!li)', ur'\1ba'), # -ba és -ban, nem -beli
            (ur'(?<![/,\.\d])(0(\]\])?-)nek', ur'\1nak'),
            (ur'(?<![/,\.\d])(0(\]\])?-)től', ur'\1tól'),
        ],
        'exceptions': { #Inside-tags: a fixes elején
            'inside-tags': [
            ],
            'text-contains': [
            ],
            'inside': [
                ur'm\^?3-es', # Hibás m3, cm3 stb.
                ur'Okosabb vagy, mint egy 5-es', # 3 cikkben :-(
                ur'\d-összefüggő', # Az oktaédergráf 4-összefüggő, azaz legalább négy csúcsát kell eltávolítani ahhoz, hogy szétessen.
                ur'viktoria01-aschaffenburg', # webcím
                ur'(U2|R2-?(D2)?|Live 8|MI-\d|Channel \d)(\]\])?-\w+', # angolul olvassuk
                ur'(Billboard( Hot)|Top) \d+(\]\])?-\w+', # ezt meg a fene se tudja; van csak Hot 100 is
                # Még a BBC Radio ?\d, Channel ?\d is van
                ur'(?i)\| *(IUPAC_?N(év|ame)|MásNév|OtherNames?) *=.*', # kémiai képlet (jó sok angolból másolt sablon :-()
                ur'(?is)\{\{ *Grafikus idővonal.*?\}\}', # sablonparaméterek neve, pl. Ékírás, I. e. 14. század, Kurgán-kultúra
                ur'(?is)\{\{ *(Jura|Kréta|Triász|Kambrium|Perm|Ediakara|Szilur|Devon|Karbon|Kainozoikum|Ordovícium) idővonala.*?\}\}', # sablonparaméterek neve, pl. Ékírás, I. e. 14. század
                # A Kurgán-kultúra is ez a sablon, miért nem találja meg?
                ur'\d+-bajnok',
            ],
            'title': [
          ],
        }
    },
}
# *** CONTENTS *** #

# Load the user fixes file.
import config
try:
    execfile(config.datafilepath(config.base_dir, "user-fixes.py"))
except IOError:
    pass
_______________________________________________
pywikibot mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot

Reply via email to