# Path: articlemeta/utils.py
# def convert_ahref_to_extlink(xml_etree):
# def convert_html_tags_to_jats(xml_etree):
# def convert_all_html_tags_to_jats(xml_etree):
#     def __call__(cls, *args, **kwargs):
#     def __init__(self, fp, parser_dep=ConfigParser):
#     def from_env(cls):
#     def from_file(cls, filepath):
#     def __getattr__(self, attr):
#     def items(self):
# class SingletonMixin(object):
# class Configuration(SingletonMixin):


import re
import plumber
from lxml import etree as ET
from io import StringIO
from xylose.scielodocument import UnavailableMetadataException
from articlemeta import utils
                email = ET.Element('email')
                email.text = affiliation.get('email_html_removed', affiliation['email'])
                aff.append(email)


            xml.find('./front/article-meta').append(aff)

        return data


class XMLArticleMetaDatesInfoPipe(plumber.Pipe):

    def precond(data):

        raw, xml = data

        if not raw.publication_date:
            raise plumber.UnmetPrecondition()

    @plumber.precondition(precond)
    def transform(self, data):
        raw, xml = data

        pubdate = ET.Element('pub-date')
        pubdate.set('pub-type', 'epub-ppub')

        year = ET.Element('year')
        year.text = raw.publication_date[0:4]

        if raw.publication_date[5:7]:

# Path: articlemeta/utils.py
# def convert_ahref_to_extlink(xml_etree):
# def convert_html_tags_to_jats(xml_etree):
# def convert_all_html_tags_to_jats(xml_etree):
#     def __call__(cls, *args, **kwargs):
#     def __init__(self, fp, parser_dep=ConfigParser):
#     def from_env(cls):
#     def from_file(cls, filepath):
#     def __getattr__(self, attr):
#     def items(self):
# class SingletonMixin(object):
# class Configuration(SingletonMixin):


# Path: articlemeta/export_rsps.py
import re
import plumber
from lxml import etree as ET
from io import StringIO
from xylose.scielodocument import UnavailableMetadataException
from articlemeta import utils

                email = ET.Element('email')
                email.text = affiliation.get('email_html_removed', affiliation['email'])
                aff.append(email)


            xml.find('./front/article-meta').append(aff)

        return data


class XMLArticleMetaDatesInfoPipe(plumber.Pipe):

    def precond(data):

        raw, xml = data

        if not raw.publication_date:
            raise plumber.UnmetPrecondition()

    @plumber.precondition(precond)
    def transform(self, data):
        raw, xml = data

        pubdate = ET.Element('pub-date')
        pubdate.set('pub-type', 'epub-ppub')

        year = ET.Element('year')
        year.text = raw.publication_date[0:4]

        if raw.publication_date[5:7]:

            month = ET.Element('month')