<mark> elements are used to group tokens (continuous or discontinuos
        spans) for further annotation.
        A span markable file (*_seg.xml) contains a list of spans and the type
        of annotation that is applied to them
        (stored in <markList type="annotation type..."). As a consequence,
        each span markable file contains only spans of a single type
        (in discoursegraph: spans from a single namespace, e.g. syntax
        categories or entity mentions).

        Note: The annotations themselves are stored in other files, using
        <feat> or <multiFeat> elements.

def __gen_span_markables_file(self, layer, saltnpepper_compatible=True):
        """
        <mark> elements are used to group tokens (continuous or discontinuos
        spans) for further annotation.
        A span markable file (*_seg.xml) contains a list of spans and the type
        of annotation that is applied to them
        (stored in <markList type="annotation type..."). As a consequence,
        each span markable file contains only spans of a single type
        (in discoursegraph: spans from a single namespace, e.g. syntax
        categories or entity mentions).

        Note: The annotations themselves are stored in other files, using
        <feat> or <multiFeat> elements.
        """
        paula_id = '{0}.{1}.{2}_{3}_seg'.format(layer, self.corpus_name,
                                            self.name, layer)
        E, tree = gen_paula_etree(paula_id)
        base_paula_id = '{0}.{1}.tok'.format(self.corpus_name, self.name)
        mlist = E('markList',
                  {'type': layer,
                   XMLBASE: base_paula_id+'.xml'})

        span_dict = defaultdict(lambda: defaultdict(str))
        edges = select_edges_by(self.dg, layer=layer,
                                edge_type=EdgeTypes.spanning_relation,
                                data=True)
        for source_id, target_id, edge_attrs in edges:
            span_dict[source_id][target_id] = edge_attrs

        target_dict = defaultdict(list)
        for source_id in span_dict:
            targets = sorted(span_dict[source_id], key=natural_sort_key)
            if saltnpepper_compatible:  # SNP doesn't like xpointer ranges
                xp = ' '.join('#{0}'.format(target_id)
                              for target_id in targets)
            else:  # PAULA XML 1.1 specification
                xp = '#xpointer(id({0})/range-to(id({1})))'.format(targets[0],
                                                                 targets[-1])
            mark = E('mark', {XLINKHREF: xp})
            if self.human_readable:
                # add <!-- comments --> containing the token strings
                mark.append(Comment(tokens2text(self.dg, targets)))
                target_dict[targets[0]].append(mark)
            else:
                mlist.append(mark)

        if self.human_readable:  # order <mark> elements by token ordering
            for target in sorted(target_dict, key=natural_sort_key):
                for mark in target_dict[target]:
                    mlist.append(mark)

        tree.append(mlist)
        self.files[paula_id] = tree
        self.file2dtd[paula_id] = PaulaDTDs.mark
        return paula_id