User:ArielGlenn/Sandbox1

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Secondary sandbox. Hey I needed another one. Ya gotta a problem with that? add as round 4

Edit conflict tests[edit]

I'm running these tests to see

  1. whether the documentation is correct about merging simultaneous section edits as long as each user edits different lines
  2. what happens when both edit the same few lines (looking to see how the diff appears because apparently it's supposed to
  3. show *all* of the extra sections for some reason.)

This is a section. (1)[edit]

Here is a bit of garbage text. (part one) let's add something here, this was added round one. removed a some from below too.

Some people say that sleep is overrated.


This is another section. (2)[edit]

And here we have some more wonderful text written by the most fantastic Leftmost. (part two) most fantastic what, I want to know!

Some people say that food is overrated but I think they must be working for the dietary industry. But maybe they are working in the back of McD's and they know how bad the food is.

This is still another section. (3)[edit]

Here is yet a bit more garbage text. (part three)

Clearly those people are nuts.

test script (temporary)[edit]

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, re

fin = sys.stdin

page_tag = re.compile('<page>')
title_content = re.compile('<title>([^:]+):(.+)<\/title>')
title_tag = re.compile('<title>')
title_capture = re.compile('<title>(.*)<\/title>')
page_tag_end = re.compile('<\/page>')
pagnm=re.compile('\'\'\'\{\{PAGENAME\}\}\'\'\'')
pagnm2=re.compile('\{\{ξεν\|zh\|\{\{PAGENAME\}\}\}\}')

eof=0
check_blanks=0
trans_found=0
while not eof:
    line = fin.readline()
    if line == "":
       eof = 1
    elif page_tag.search(line):
        namespace=""
        title=""
        transl=""
        check_blanks=0
        trans_found=0
    elif title_tag.search(line):
           result = title_content.search(line)
           if result:
                      namespace=result.group(1)
                      title=result.group(2)
           else:
               result = title_capture.search(line)
               if result:
                            namespace="main"
                            title=result.group(1)
    elif pagnm.search(line) or pagnm2.search(line):
        check_blanks=1
    elif check_blanks==1:
        if line == '\n':
            continue
        else:
            transl=line
            check_blanks=0
            trans_found=1
    elif page_tag_end.search(line):
        if trans_found:
            print "[[%s]]: %s" % (title, transl)
        check_blanks=0
        trans_found=0
fin.close()