User:Gerritholl

From Wikipedia, the free encyclopedia.

en-3 This user is able to contribute with an advanced level of English.
nl-3 Deze gebruiker spreekt uitstekend Nederlands.
de-2 Dieser Benutzer hat fortgeschrittene Deutschkenntnisse.
fr-1 Cette personne peut contribuer avec un niveau élémentaire de français.
sv-1 Denna användare har baskunskaper i svenska.
nds-1 Disse Bruker hett einfache Plattdüütsch-Kenntnis.
 

I am Gerrit Holl. My name is pronounced (IPA): ɣɛʁɘt, unless I'm mistaken. I live at 52° 21′ 02″ N 4° 58′ 20.8″ E (http://kvaleberg.com/extensions/mapsources/index.php?params=52_21_02_N_4_58_20.8_E_), usually.


You can find a test page here as well. Feel free to edit that one. You can read about me on my homepage (http://topjaklont.student.utwente.nl/en/).

Contents

Contributions

I have created a number of articles. The list is in chronological order.

Articles created by me

Redirects not included.

  1. Quantum Explosion Dynamo
  2. Discharge (hydrology)
  3. List of rivers by length
  4. List of rivers by average discharge
  5. Swisstopo
  6. Guillaume Henri Dufour
  7. Walter Ritz
  8. West Antarctic Ice Sheet
  9. Template:Engadin villages
  10. Peter Pohl
  11. Magick Image File Format
  12. Zernez
  13. Swiss National Park
  14. Val Müstair
  15. San zimske noci
  16. Ben Ali Libi
  17. Willem Wilmink

Mathematicians

  1. Guido Castelnuovo
  2. David Crighton
  3. Ahmed ibn Yusuf
  4. Francesco Severi
  5. Valentina Borok

Codes

-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GE/S dpu s+:>+++:- a19 C+>++ UL++ P---- PY++>$ L+++ E---
W+++> N@ o? K>- w--->? !O !M !V PS+@ PE-->$ Y@ !PGP 5? X?
!R tv-@ b+>++++@ DI-@ D+ G(--) e(+++++) h+>++ !r--->(++>?) y?@
-----END GEEK CODE BLOCK-----


---------------------- OmniCode 0.1.6 -----------------------
sxy.- cm185&?  kg72&?  skFAEBD7&?  ha996633&?  sp0&?  Ag1985.Aug13
anE.caucasian.european.EUcitizen.Netherlands.Diemen hdd LoN52 21 02, E4 58 20 Zo?  rl!&<
LANL(9)&EN(8)^(9)&DE(7)^(9)&FR(5)^(9)&NDS(4)^(9)&LB(4)^(9)&SV(1)^(9)&RM(0)^(9)^*^(9)
Crs(5)^(9)&E(5)^(9)&L(7)^(9)&*^(9) Eds(5)^(9)&E(5)^(9)&L(6)^(9)&?(9)&*^(9)
HbPolitics&Science&News&Nature PlC&D&G&0.Socialist MV-.bike Rl!.looking
Kd^!&^grandchildren Pe!&^human MBIITP.Asperger FH!!  UF?  IN25.Campus_LAN AdI&?
PrXHTML(9)&Python(8)^(9)&CSS(7)^(9)&MATLAB(5)^(0)&OmniCode(5)^(9)&PHP(0)^(-inf)
----------- Omnicode http://www.gadgeteer.net/omnicode/ -----------

editarticle

I am fed up with editing long articles in a <textarea>box</textarea>. It is a very bad editor, sometimes the arrows don't even work, etc. I like to work with a true editor like Vim. From now on, this is possible: for here is editarticle 0.3! It requires Pywikipediabot (http://pywikipediabot.sf.net/), usually the latest CVS. The source code for editarticle is below. This is not necerarilly the latest version: the latest version is always found in Pywikipediabot CVS.

Yes, I am aware of Mozex, but it requires one to fire up a browser. As I am typing this, I have no browser running.

#!/usr/bin/python

# Edit a Wikipedia article with your favourite editor. Requires Python 2.3.
#
# (C) Gerrit Holl 2004
# Distribute under the terms of the PSF license.

# Version 0.3.
#
# Features:
#       - logging in
#
# TODO: - non existing pages
#       - correct encoding
#       - use cookies to remember login
#       - edit conflicts
#       - difflib
#       - minor edits
#       - watch/unwatch
#       - ...
#
# Removed features:
#       - editing anonymously

__metaclass__ = type
__version__ = "$Id: editarticle.py,v 1.18 2005/02/21 11:32:36 gerrit Exp $"
sig = u" (edited with editarticle.py 0.3)"

import sys
import os
import httplib
import urllib
import string
import getpass
import difflib
import optparse
import tempfile

import wikipedia
import login
import config

class EditArticle:
    joinchars = string.letters + '[]' + string.digits # join lines if line starts with this ones

    def __init__(self, args):
        """Takes one argument, usually this is sys.argv[1:]"""
        self.all_args = args
        self.set_options()

    def initialise_data(self):
        """Login, set editor, page and pagelink attributes"""
        self.login()#anonymous=self.options.anonymous)
        self.editor = self.options.editor or wikipedia.input(u"Editor to use: ", encode=True)
        self.setpage()

    def login(self):#, anonymous):
        """Initialises site and username data"""#, or anonymous"""
        if False:#anonymous:
            self.site = wikipedia.getSite(user=None)
        else:
            self.username = self.options.username or wikipedia.input(u"Username: ", encode=True)
            self.site = wikipedia.getSite(user=self.username)
            self.site._fill() # load cookies
            if not self.site._loggedin:
                password = getpass.getpass("Password: ")
                cookie = login.login(self.site, self.username, password)
                if not cookie:
                    sys.exit("Login failed")
                login.storecookiedata(cookie, self.site, self.username)
                wikipedia.output(u"Login succesful")

    def set_options(self):
        """Parse commandline and set options attribute"""
        my_args = []
        for arg in self.all_args:
            arg = wikipedia.argHandler(arg)
            if arg:
                my_args.append(arg)
        parser = optparse.OptionParser()
##        parser.add_option("-a", "--anonymous", action="store_true", default=False, help="Login anonymously")
        parser.add_option("-r", "--edit_redirect", action="store_true", default=False, help="Ignore/edit redirects")
        parser.add_option("-u", "--username", help="Username to login with (ignored with -a)")
        parser.add_option("-p", "--page", help="Page to edit")
        parser.add_option("-e", "--editor", help="Editor to use")
        parser.add_option("-j", "--join_lines", action="store_true", default=False, help="Join consecutive lines if possible")
        parser.add_option("-w", "--watch", action="store_true", default=False, help="Watch article after edit")
        parser.add_option("-n", "--new_data", default="", help="Automatically generated content")
        self.options = parser.parse_args(args=my_args)[0]

    def setpage(self):
        """Sets page and pagelink"""
        self.page = self.options.page or wikipedia.input(u"Page to edit: ", encode=True)
        self.pagelink = wikipedia.PageLink(self.site, self.page)
        if not self.options.edit_redirect and self.pagelink.isRedirectPage():
            self.pagelink = wikipedia.PageLink(site, self.pagelink.getRedirectTo())

    def repair(self, content):
        """Removes single newlines and prepare encoding for local wiki"""
        if self.options.join_lines:
            lines = content.splitlines()
            result = []
            for i, line in enumerate(lines):
                try:
                    nextline = lines[i+1]
                except IndexError:
                    nextline = "last"
                result.append(line)
                if line.strip() == "" or line[0] not in self.joinchars or \
                   nextline.strip() == "" or nextline[0] not in self.joinchars:
                    result.append('\n')
                else:
                    result.append(" ")
            s = "".join(result)
        else:
            s = content
        return wikipedia.unicode2html(s, self.site.encoding())

    def edit(self):
        """Edit the page using the editor.
        
        It returns two strings: the old version and the new version."""
        ofn = tempfile.mktemp()
        ofp = open(ofn, 'w')
        try:
            oldcontent = self.pagelink.get()
        except wikipedia.NoPage:
            oldcontent = ""
        except wikipedia.IsRedirectPage:
            if self.options.redirect:
                oldcontent = self.pagelink.get(force=True, get_redirect=redirect)
            else:
                raise
        if self.options.new_data == :
            ofp.write(oldcontent.encode(config.console_encoding)) # FIXME: encoding of wiki
        else:		
#            ofp.write(oldcontent.encode('utf-8')+'\n===========\n'+self.options.new_data) # FIXME: encoding of wiki
            ofp.write(oldcontent.encode(config.console_encoding)+'\n===========\n'+self.options.new_data) # FIXME: encoding of wiki
        ofp.close()
        os.system("%s %s" % (self.options.editor, ofn))
        newcontent = open(ofn).read().decode(config.console_encoding)
        os.unlink(ofn)
        return oldcontent, newcontent

    def getcomment(self):
        comment = wikipedia.input(u"What did you change? ") + sig
        comment = wikipedia.unicode2html(comment, self.site.encoding())
        return wikipedia.unicode2html(comment, self.site.encoding())

    def handle_edit_conflict(self):
        fn = os.path.join(tempfile.gettempdir(), self.page)
        fp = open(fn, 'w')
        fp.write(new)
        fp.close()
        wikipedia.output(u"An edit conflict has arisen. Your edit has been saved to %s. Please try again." % fn)
    
    def showdiff(self,old, new):
        diff = difflib.context_diff(old.splitlines(), new.splitlines())
        wikipedia.output(u"\n".join(diff))

    def run(self):
        self.initialise_data()
        try:
            old, new = self.edit()
        except wikipedia.LockedPage:
            sys.exit("You do not have permission to edit %s" % self.pagelink.hashfreeLinkname())

        if old != new:
            new = self.repair(new)
            self.showdiff(old, new)
            comment = self.getcomment()
            try:
                self.pagelink.put(new, comment=comment, minorEdit=False, watchArticle=self.options.watch)#, anon=self.options.anonymous)
            except wikipedia.EditConflict:
                self.handle_edit_conflict()
        else:
            wikipedia.output(u"Nothing changed")

def main():
    app = EditArticle(sys.argv[1:])
    app.run()

if __name__ == "__main__":
    try:
        main()
    except:
        wikipedia.stopme()
        raise
    wikipedia.stopme()

Commons:User:Gerrit nl:User:Gerritholl meta:User:Gerritholl de:User:Gerritholl fr:User:Gerritholl [news:User:Gerrit] sv:User:Gerrit

Personal tools