wikiavro 0.0.1 → 0.0.2
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 +4 -4
- data/lib/wikiavro.rb +1 -1
- data/lib/wikiavro/avro.rb +20 -7
- data/lib/wikiavro/mediawiki.rb +32 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e56d6fb651af9c0df1f835aab0f48a0a57f4ebed
|
4
|
+
data.tar.gz: 267e2c2e40288b7f2beddbf398821974291ee86f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55e5f44171be03a61cb354a965667ec0b47c31f5abe1cde35dc916cc61ca8f826f0ff1a457b53906db3dd16b280237838016c9375fff86fa0601852a2c0fbe9
|
7
|
+
data.tar.gz: b223451fe16a6d0c53e4b7651e72e8fc181152a433085403e2e584c08f481de254e659336424ae8109a5bbc4f1deab3072e60269e7c9157ce2b227b234329a42
|
data/lib/wikiavro.rb
CHANGED
data/lib/wikiavro/avro.rb
CHANGED
@@ -50,7 +50,14 @@ EOS
|
|
50
50
|
]
|
51
51
|
}]},
|
52
52
|
{"name": "minor", "type": "boolean"},
|
53
|
-
{"name": "comment", "type": ["null",
|
53
|
+
{"name": "comment", "type": ["null", {
|
54
|
+
"namespace": "org.rationalwiki",
|
55
|
+
"name": "Comment",
|
56
|
+
"type": "record",
|
57
|
+
"fields": [
|
58
|
+
{"name": "comment", "type": ["null", "string"]}
|
59
|
+
]
|
60
|
+
}]},
|
54
61
|
{"name": "bytes", "type": "long"},
|
55
62
|
{"name": "textid", "type": ["null", "string"]},
|
56
63
|
{"name": "text", "type": ["null", "string"]}
|
@@ -152,11 +159,17 @@ EOS
|
|
152
159
|
contributor = nil
|
153
160
|
end
|
154
161
|
|
155
|
-
if comment
|
156
|
-
comment
|
157
|
-
|
158
|
-
|
159
|
-
|
162
|
+
if !comment.nil?
|
163
|
+
if !(comment[:deleted].nil? ^ comment[:comment].nil?)
|
164
|
+
raise 'comment[:deleted] and comment[:comment] should alternate'
|
165
|
+
end
|
166
|
+
|
167
|
+
if comment[:deleted].nil?
|
168
|
+
comment[:comment]
|
169
|
+
else
|
170
|
+
comment.delete :deleted
|
171
|
+
comment[:comment] = nil
|
172
|
+
end
|
160
173
|
end
|
161
174
|
|
162
175
|
text = nil if !text_deleted.nil?
|
@@ -166,7 +179,7 @@ EOS
|
|
166
179
|
'n' => n.to_i,
|
167
180
|
'timestamp' => timestamp,
|
168
181
|
'contributor' => contributor,
|
169
|
-
'minor' => minor
|
182
|
+
'minor' => !!minor,
|
170
183
|
'comment' => comment,
|
171
184
|
'bytes' => bytes.to_i,
|
172
185
|
'textid' => textid,
|
data/lib/wikiavro/mediawiki.rb
CHANGED
@@ -396,9 +396,13 @@ module WikiAvro::MediaWiki
|
|
396
396
|
end
|
397
397
|
end
|
398
398
|
|
399
|
-
class Minor < WikiAvro::XML::
|
400
|
-
def
|
401
|
-
|
399
|
+
class Minor < WikiAvro::XML::Leaf
|
400
|
+
def name
|
401
|
+
'minor'
|
402
|
+
end
|
403
|
+
|
404
|
+
def parse_attributes(w, p, r)
|
405
|
+
p.minor = true
|
402
406
|
end
|
403
407
|
end
|
404
408
|
|
@@ -450,15 +454,15 @@ module WikiAvro::MediaWiki
|
|
450
454
|
end
|
451
455
|
|
452
456
|
def reset
|
453
|
-
id = nil
|
454
|
-
timestamp = nil
|
455
|
-
contributor = nil
|
456
|
-
minor = nil
|
457
|
-
comment = nil
|
458
|
-
text_deleted = nil
|
459
|
-
bytes = nil
|
460
|
-
textid = nil
|
461
|
-
text = nil
|
457
|
+
@id = nil
|
458
|
+
@timestamp = nil
|
459
|
+
@contributor = nil
|
460
|
+
@minor = nil
|
461
|
+
@comment = nil
|
462
|
+
@text_deleted = nil
|
463
|
+
@bytes = nil
|
464
|
+
@textid = nil
|
465
|
+
@text = nil
|
462
466
|
end
|
463
467
|
|
464
468
|
def handle_content(w, p, r)
|
@@ -571,16 +575,16 @@ module WikiAvro::MediaWiki
|
|
571
575
|
end
|
572
576
|
|
573
577
|
def reset
|
574
|
-
threadSubject = nil
|
575
|
-
threadParent = nil
|
576
|
-
threadAncestor = nil
|
577
|
-
threadPage = nil
|
578
|
-
threadID = nil
|
579
|
-
threadSummaryPage = nil
|
580
|
-
threadAuthor = nil
|
581
|
-
threadEditStatus = nil
|
582
|
-
threadType = nil
|
583
|
-
threadSignature = nil
|
578
|
+
@threadSubject = nil
|
579
|
+
@threadParent = nil
|
580
|
+
@threadAncestor = nil
|
581
|
+
@threadPage = nil
|
582
|
+
@threadID = nil
|
583
|
+
@threadSummaryPage = nil
|
584
|
+
@threadAuthor = nil
|
585
|
+
@threadEditStatus = nil
|
586
|
+
@threadType = nil
|
587
|
+
@threadSignature = nil
|
584
588
|
end
|
585
589
|
|
586
590
|
def handle_content(w, p, r)
|
@@ -620,12 +624,12 @@ module WikiAvro::MediaWiki
|
|
620
624
|
end
|
621
625
|
|
622
626
|
def reset
|
623
|
-
title = nil
|
624
|
-
ns = nil
|
625
|
-
id = nil
|
626
|
-
redirect = nil
|
627
|
-
sha1 = nil
|
628
|
-
revision_count = nil
|
627
|
+
@title = nil
|
628
|
+
@ns = nil
|
629
|
+
@id = nil
|
630
|
+
@redirect = nil
|
631
|
+
@sha1 = nil
|
632
|
+
@revision_count = nil
|
629
633
|
@revision_count = 0
|
630
634
|
end
|
631
635
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikiavro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Someon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libxml-ruby
|