Difference between pages "User:Mathieu/bot" and "Template:L event"

From Event-B
< User:Mathieu(Difference between pages)
Jump to navigationJump to search
imported>Mathieu
m (→‎Add a category to the last uploaded images: Replace text matching regular expressions)
 
imported>Mathieu
m (New page: <noinclude> ==Usage== Template use to typeset an event name in an event-b listing. ==Example== {{l_machine|AntiCollide}} {{l_refines|Safety}} {{l_sees|Network}} {{l_component|Acyclic}} {{...)
 
Line 1: Line 1:
A bot may be a useful tool to help a wiki maintenance.
+
<noinclude>
 +
==Usage==
 +
Template use to typeset an event name in an event-b listing.
 +
==Example==
  
I tried to use the python framework provided by http://pywikipediabot.sourceforge.net/. Hereafter are some guidelines to make it work on this wiki.
+
{{l_machine|AntiCollide}}
 +
{{l_refines|Safety}}
 +
{{l_sees|Network}}
 +
{{l_component|Acyclic}}
 +
{{l_variables|v1}}
 +
{{l_variable|v2}}
 +
{{l_invariants}}
 +
{{l_invariant|inv1|v2 ∈ BOOL}}
 +
{{l_theorems}}
 +
{{l_theorem|inv1|v2 ∈ BOOL}}
 +
{{l_events}}
 +
{{l_event|control|extended|ordinary}}
 +
{{l_parameters}}
 +
{{l_param|a}}
 +
{{l_param|x|y|z}}
 +
{{l_guards}}
 +
{{l_guard|grd1|x ⊆ next}}
 +
{{l_witnesses}}
 +
{{l_witness|y|y=v}}
 +
{{l_actions}}
 +
{{l_action|act1|pro :∈ BOOL}}
 +
{{l_end_event}}
 +
{{l_end}}
  
== Requirements ==
+
[[Category:Listing templates]]
* Python >2.5
+
==Template==
 
+
</noinclude><!--
== Getting pywikipedia framewok ==
+
--><div class="typeset-l_event" >{{{1}}}&nbsp;≙</div>{{comment|{{{2|not extended}}} and {{3|no convergence}}}}
Get the source code from subversion:
 
<pre><nowiki>
 
(prompt) svn co http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia pywikipedia
 
</nowiki></pre>
 
== Configuring the framework for this wiki ==
 
Add the following <tt>families/eventb_family.py</tt> file (be careful with the indentation):
 
<pre><nowiki>
 
# -*- coding: utf-8  -*-
 
 
 
import family
 
# The event-b family
 
# user-config.py: usernames['event-b']['event-b'] = 'User name'
 
class Family(family.Family):
 
    def __init__(self):
 
        family.Family.__init__(self)
 
        self.name = 'eventb'
 
        self.langs = {
 
            'eventb': 'wiki.event-b.org',
 
        }
 
 
 
        self.namespaces[4] = {
 
            '_default': [u'Event-B', self.namespaces[4]['_default']],
 
        }
 
 
 
        self.namespaces[5] = {
 
          '_default': [u'Event-B talk', self.namespaces[5]['_default']],
 
        }
 
 
 
    def version(self, code):
 
        return '1.11'
 
 
 
    def path(self, code):
 
        return '/index.php' #The path of index.php, look at your wiki address.
 
 
 
    def scriptpath(self,code):
 
        return ''
 
   
 
#    def shared_image_repository(self, code):
 
#        return ('commons', 'commons')
 
 
 
</nowiki></pre>
 
 
 
Then add the following <tt>user-config.py</tt> file:
 
<pre><nowiki>
 
family='eventb'
 
mylang='eventb'
 
usernames['eventb']['eventb'] = 'your_bot_user_name'
 
</nowiki></pre>
 
 
 
== Usage ==
 
=== Login ===
 
First you should log in:
 
<pre><nowiki>
 
(prompt) python login.py
 
</nowiki></pre>
 
=== Upload Images ===
 
<pre><nowiki>
 
(prompt) python upload.py -noverify -keep file.png "Image description"
 
</nowiki></pre>
 
 
 
For uploading several images from a directory, I use the following ''sh'' command:
 
<pre><nowiki>
 
for i in /tmp/imagedir/* ; do (yes | python upload.py -v -noverify -keep $i "Import of image $i"); done
 
</nowiki></pre>
 
 
 
 
 
=== Add a category to the last uploaded images ===
 
For the last 20 images, do :
 
<pre><nowiki>
 
python category.py -v add -newimages:20
 
</nowiki></pre>
 
 
 
=== Replace text matching regular expressions ===
 
<pre><nowiki>
 
python replace.py -cat -regex '{\\tt ([^}]*)}' '\texttt{\1}'
 
</nowiki></pre>
 

Revision as of 13:42, 26 February 2009

Usage

Template use to typeset an event name in an event-b listing.

Example

MACHINE

AntiCollide

REFINES

Safety

SEES

Network

Acyclic

VARIABLES

v1

v2

INVARIANTS

inv1 :
v2 ∈ BOOL

THEOREMS

inv1 :
v2 ∈ BOOL

EVENTS

control ≙
Template:Comment

ANY

a

x

WHERE

grd1 :
x ⊆ next

WITH

y :
{{{2}}}

THEN

act1 :
pro :∈ BOOL

END

END

Template

{{{1}}} ≙

Template:Comment