# 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
            return data, xml

    class RefIdPipe(plumber.Pipe):
        def transform(self, data):
            raw, xml = data

            ref = xml.find('.')

            ref.set('id', 'B{0}'.format(str(raw.index_number)))

            return data

    class MixedCitationPipe(plumber.Pipe):
        def precond(data):
            raw, xml = data

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

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

            parser = ET.HTMLParser()

            mc = ET.parse(StringIO(raw.mixed_citation), parser)
            mixed_citation = mc.find('body/p/.') if mc.find('body/p/.') is not None else mc.find('body/.')

            mixed_citation.tag = 'mixed-citation'


# 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

            return data, xml

    class RefIdPipe(plumber.Pipe):
        def transform(self, data):
            raw, xml = data

            ref = xml.find('.')

            ref.set('id', 'B{0}'.format(str(raw.index_number)))

            return data

    class MixedCitationPipe(plumber.Pipe):
        def precond(data):
            raw, xml = data

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

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

            parser = ET.HTMLParser()

            mc = ET.parse(StringIO(raw.mixed_citation), parser)
            mixed_citation = mc.find('body/p/.') if mc.find('body/p/.') is not None else mc.find('body/.')

            mixed_citation.tag = 'mixed-citation'


            xml.append(utils.convert_all_html_tags_to_jats(mixed_citation))