# -*- coding: utf-8 -*-

################################################################
# zopyx.plone.smashdocs
# (C) 2016,  Andreas Jung, www.zopyx.com, Tuebingen, Germany
################################################################


from pp.core2.transformation import registerTransformation


@registerTransformation
def fixImagePaths(root, **params):
    """ add local storage path 'xml' to image URLs"""

    for img in root.xpath('//img'):
        src = img.attrib['src']
        img.attrib['src'] = 'sdxml/' + src
