wikipedia_parser 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/wikiParserPage.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGUzZmZkYjgyMjg2M2I2ZmU2N2ExMjEwMzJlYmRhOWUwNzg0NzYxMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjIyOGY3ODExNmVkZTI1YTA0OTY1MGE4YjgyNzc2NjZjMDNkMjc4Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTZiM2ZiZTA5YTI1MTMxMGQ1MzA0YzcxNTc3ZjkyNjExZDBmMzBlMDg1YTUx
|
10
|
+
MWQ4YTk1OTFkNTc2MGVmMmI4YzYwODBiOWE1ZTUxNTYwZjUxOGI4OTY3YjI4
|
11
|
+
NjcxYmQ5NTdiZDQxMjVhY2QwYjE0YTM1YTdmZDNkMzAzMmE0NTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzIyNWExY2E3YjAyNmU3NTkzOTI2NjA5MTAwNTg4M2ViZGI1MTE4NmU1Nzcy
|
14
|
+
YjA3YmVlZGVjYjI0YzVkMzI2YmY0NGFiMDRlZGQ0NTY5YzMwZTRkNGZjNTg4
|
15
|
+
NmEyMTNiZTg0Mjc5YmZmZGYxMjk5MGFiMmQwMzllYTBkNzc0ZDE=
|
data/lib/wikiParserPage.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
#coding: utf-8
|
1
2
|
class WikiParser
|
2
3
|
|
3
4
|
# A Wikipedia article page object.
|
4
5
|
class Page
|
5
6
|
|
6
7
|
# The Wikipedia namespaces for all special pages {WikiParser::Page#special_page}, {#page_type}.
|
7
|
-
Namespaces = %w(WP Help Talk User Template Wikipedia File Book Portal TimedText Module MediaWiki Special Media Category)
|
8
|
+
Namespaces = %w(WP Aide Help Talk User Template Wikipedia File Book Portal Portail TimedText Module MediaWiki Special Spécial Media Category Catégorie [^:]+)
|
9
|
+
Disambiguation = ["disambiguation","homonymie", "значения", "disambigua", "peker", "ujednoznacznienie", "olika betydelser", "Begriffsklärung", "desambiguación"]
|
8
10
|
# Title of the Wikipedia article.
|
9
11
|
attr_reader :title
|
10
12
|
# The Wikipedia id of the article.
|
@@ -48,8 +50,9 @@ class WikiParser
|
|
48
50
|
@id = node.content
|
49
51
|
when 'title'
|
50
52
|
@title = node.content
|
51
|
-
|
52
|
-
if @title.match(
|
53
|
+
|
54
|
+
if @title.match(/(#{Namespaces.join("|")})|([^|+]):.+/i) then @special_page = true and @page_type = $1 end
|
55
|
+
if @title.match(/.+ \(#{Disambiguation.join("|")}\)/i) then @disambiguation_page = true end
|
53
56
|
when 'redirect'
|
54
57
|
@redirect = true
|
55
58
|
@redirect_title = node["title"]
|