def InterleaveWithTags(text, eType, tagIDs, placeholder):
    """Splits the text at the placeholder string and inserts html-elements of the given type with the given tagIDs as 'HGID's. Most of the time span and div are use, depending on whether the element is supposed to be inline or separated. May fail if number of tagIDs and placeholders in the text not the same."""
    taskParts = text.split(placeholder)
    pos = 0
    text = ''
    while pos < len(tagIDs):
        text += taskParts[pos]
        text += '<' + eType + ' HGID="' + str(tagIDs[pos]
            ) + '"></' + eType + '>'
        pos = pos + 1
    text += taskParts[-1]
    return text
