from share.normalize import links
from share.normalize import parsers
from share.normalize.normalizer import Normalizer

#
# # NOTE: Context is a thread local singleton
# # It is asigned to ctx here just to keep a family interface
# ctx = links.Context()
#
#
# class OAIPerson(parsers.AbstractPerson):
#     given_name = links.ParseName(ctx.text()).first
#     family_name = links.ParseName(ctx.text()).last
#
#
# class OAIContributor(parsers.AbstractContributor):
#     person = ctx
#     Person = OAIPerson
#
#
# class OAIManuscript(parsers.AbstractManuscript):
#     Contributor = OAIContributor
#
#     title = links.Trim(ctx.metadata[0].dc[0].title[0].text())
#     contributors = ctx.metadata[0].dc[0].creator['*']
#     description = links.Trim(links.Concat(ctx.metadata[0].dc[0].description['*'].text()))
#
#
# # TODO Fix me
# OAIContributor.Manuscript = OAIManuscript
#

class OAINormalizer(Normalizer):
    # root_parser = OAIManuscript
    pass

@@ -114,20 +114,17 @@
 alizer%0A%0A
-#%0A# 
+%0A
 # NOTE: 
@@ -160,18 +160,16 @@
 gleton%0A#
- #
  It is a
@@ -219,18 +219,16 @@
 terface%0A
-# 
 ctx = li
@@ -241,22 +241,18 @@
 ntext()%0A
-#%0A#%0A# 
+%0A%0A
 class OA
@@ -271,27 +271,40 @@
 ers.
-Abstract
+Parser):%0A    schema = '
 Person
-):%0A# 
+'%0A%0A
     
@@ -350,22 +350,20 @@
 ).first%0A
-#
     
- 
 family_n
@@ -401,22 +401,18 @@
 )).last%0A
-#%0A#%0A# 
+%0A%0A
 class OA
@@ -432,24 +432,39 @@
 parsers.
-Abstract
+Parser):%0A    schema = '
 Contribu
@@ -470,26 +470,23 @@
 utor
-):%0A# 
+'%0A
     
-p
+P
 erson = 
 ctx%0A
@@ -485,43 +485,38 @@
 n = 
-ctx%0A#     Person = OAIPerson%0A#%0A#%0A# 
+OAIPerson%0A%0A    person = ctx%0A%0A%0A
 clas
@@ -543,16 +543,31 @@
 ers.
-Abstract
+Parser):%0A    schema = '
 Manu
@@ -576,17 +576,14 @@
 ript
-):%0A#
+'%0A
     
- 
 Cont
@@ -607,20 +607,17 @@
 ributor%0A
-#%0A# 
+%0A
     titl
@@ -670,18 +670,16 @@
 text())%0A
-# 
     cont
@@ -728,14 +728,12 @@
 *'%5D%0A
-#
     
- 
 desc
@@ -818,73 +818,8 @@
 )))%0A
-#%0A#%0A# # TODO Fix me%0A# OAIContributor.Manuscript = OAIManuscript%0A#
 %0A%0Acl
@@ -856,10 +856,8 @@
 %0A   
- #
  roo
@@ -885,13 +885,4 @@
 ipt%0A
-    pass%0A

Update OAI normalizers