14 Commits
v1.0 ... v1.3.2

Author SHA1 Message Date
dfca5f1f33 countrylist: support dates without day 2022-05-29 16:54:48 +02:00
0d62c249cd Hotfix 1.3.1 - Fix incompatibility with latest pwb 2021-08-08 14:31:27 +02:00
6a6c6ea634 Merge branch 'release-1.3' 2018-10-05 12:27:03 +02:00
7bc4f546f8 Prepare release v1.3 2018-10-05 12:26:38 +02:00
3fb86abac5 Merge branch 'remove-jogobot-submodule' into develop 2018-10-05 11:52:03 +02:00
871cbccc72 Define requirements 2018-10-05 11:50:58 +02:00
e61408f877 Remove jogobot submodule 2018-10-05 11:46:44 +02:00
e6ef20f0a4 Merge branch 'release-1.2' back into develop 2017-11-05 15:53:18 +01:00
f9e4207651 Merge branch 'release-1.2' 2017-11-05 15:52:46 +01:00
5267966fa8 Update version info and copyright notices 2017-11-05 15:52:08 +01:00
0b17998484 Update jogobot-module to v0.1 2017-11-05 15:45:17 +01:00
82662fc882 Merge branch 'release-1.1' 2017-11-05 15:41:45 +01:00
cb11097664 Merge branch 'fs#118-remove-linebreaks' into develop 2017-11-05 15:37:43 +01:00
af44323930 Cut Titel and Interpret on first linebreak
For some asian countries there is the original name following after a
linebreak. This is not needed in overview, so cat it of.

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=118 FS#118]
2017-04-10 20:40:39 +02:00
7 changed files with 72 additions and 16 deletions

4
.gitmodules vendored
View File

@@ -1,4 +0,0 @@
[submodule "jogobot"]
path = jogobot
url = git@github.com:golderweb/wiki-jogobot-core.git
branch = test-v1

View File

@@ -6,16 +6,41 @@ of [User:JogoBot](https://de.wikipedia.org/wiki/Benutzer:JogoBot) on the
On [JogoBots wikipedia user page](https://de.wikipedia.org/wiki/Benutzer:JogoBot/Charts) a more detailed description can be found.
## Requirements
* Python 3.4+ (at least it is only tested with those)
* pywikibot-core 2.0
* [jogobot-core module](https://github.com/golderweb/wiki-jogobot-core) used as submodule
* [Isoweek module](https://pypi.python.org/pypi/isoweek)
* python3.4+
* pywikibot-core
The libraries above need to be installed and configured manualy considering [documentation of pywikibot-core](https://www.mediawiki.org/wiki/Manual:Pywikibot).
* mwparserfromhell
* isoweek
* [jogobot-core module](https://git.golderweb.de/wiki/jogobot)
Those can be installed using pip and the _requirements.txt_ file provided with this packet
pip install -r requirements.txt
## Versions
* v1.3.1
- support dates without day (YYYY-mm)
* v1.3
- jogobot module not longer included
* v1.2
- improved repo structure
* v1.1
- Cut Titel and Interpret on first linebreak
* v1.0
- first stable release
## Bugs
[wiki-jogobot-charts on fs.golderweb.de (de)](https://fs.golderweb.de/proj20)
[jogobot-charts Issues](https://git.golderweb.de/wiki/jogobot-charts/issues)
## License
GPLv3+
## Author Information
Copyright 2016 Jonathan Golder <jonathan@golderweb.de>
Copyright 2021 Jonathan Golder <jonathan@golderweb.de>

View File

@@ -11,7 +11,7 @@
#
# modified by:
#
# Copyright 2016 Jonathan Golder <jonathan@golderweb.de>
# Copyright 2021 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -256,7 +256,7 @@ def main(*args):
force_reload = True
else:
pass
genFactory.handleArg(arg)
genFactory.handle_arg(arg)
if not gen:
gen = genFactory.getCombinedGenerator()

View File

@@ -3,7 +3,7 @@
#
# countrylist.py
#
# Copyright 2016 Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -239,8 +239,11 @@ class CountryList():
int( self._chartein_raw ) ).monday() )
# Complete date string present
else:
try:
self.chartein = datetime.strptime( self._chartein_raw,
"%Y-%m-%d" )
except ValueError:
self.chartein = datetime.strptime( self._chartein_raw, "%Y-%m" )
def get_chartein_value( self ):
"""
@@ -284,6 +287,9 @@ missing!" )
if self.entry.has( "Titel" ):
self._titel_raw = self.entry.get("Titel").value
# Only use part before possible "<br"
self.remove_lines(self._titel_raw)
# Remove possible ref-tags
for ref in self._titel_raw.ifilter_tags(matches="ref"):
self._titel_raw.remove( ref )
@@ -356,6 +362,9 @@ missing!" )
if self.entry.has( "Interpret" ):
self._interpret_raw = self.entry.get("Interpret").value
# Only use part before possible "<br"
self.remove_lines(self._interpret_raw)
# Remove possible ref-tags
for ref in self._interpret_raw.ifilter_tags(matches="ref"):
self._interpret_raw.remove( ref )
@@ -458,6 +467,25 @@ missing!" )
else:
return str(keywords[0])
def remove_lines(self, wikicode):
"""
Removes linebreaks (<br>) and everything after them in given wikicode
"""
# Catch wrong typed param
if not isinstance(wikicode, mwparser.wikicode.Wikicode):
raise TypeError(str(type(self)) + "._remove_lines() expects " +
"parameter 'wikicode' of type " +
"'mwparserfromhell.wikicode.Wikicode', " +
str(type(wikicode)) + " was given!")
# Find first linebreak
br = next(wikicode.ifilter_tags(matches="br"), None)
# If there is one, get its position and slice nodes-list
if br:
brpos = wikicode.nodes.index(br)
wikicode.nodes = wikicode.nodes[0:brpos]
def __str__( self ):
"""
Returns str repression for Object

Submodule jogobot deleted from 9131235b7b

8
requirements.txt Normal file
View File

@@ -0,0 +1,8 @@
# mwparserfromhell
mwparserfromhell
# isoweek
isoweek
# jogobot
git+https://git.golderweb.de/wiki/jogobot.git#egg=jogobot

View File

@@ -3,7 +3,7 @@
#
# summarypage.py
#
# Copyright 2016 Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by