diff --git a/sourcing/edl.py b/sourcing/edl.py
index a3a8b7f..f5949c3 100644
--- a/sourcing/edl.py
+++ b/sourcing/edl.py
@@ -112,7 +112,34 @@ def fulfil_edl_with_links(edl, doc_num='', links=None, hide_all_transclusions=Fa
doc = ''.join(doc_spans)
+ for s in source:
+ text = protect_start_spaces(s.pop('text'))
+ if s['length'] > max_sourcedoc_size:
+ # print('{} > {}'.format(s['length'], max_sourcedoc_size))
+ continue
+ if s['url'] in hide_transclusions:
+ continue
+ source_spans = [(start, length, num, 'transclusion') for num, (url, start, length) in spans if url == s['url']]
+ source_spans += source_doc_links[s['url']]
+ source_spans.sort()
+
+ new_text = ''
+ pos = 0
+
+ for start, length, num, span_type in source_spans:
+ end = start + length
+ new_text += (escape(text[pos:start]) +
+ span_html(span_type, num) +
+ escape(text[start:end]) +
+ '')
+ pos = end
+ new_text += escape(text[pos:])
+ new_text = new_text.replace('\n', '
\n')
+
+ s['text'] = new_text
+
return {
+ 'source': source,
'doc': doc.replace('\n', '
\n'),
'span_count': len(spans),
'link_count': len(two_facet_links),