Restore xanaviewer source doc transclusions.
This commit is contained in:
parent
994fccf764
commit
5cf27a876f
|
@ -112,7 +112,34 @@ def fulfil_edl_with_links(edl, doc_num='', links=None, hide_all_transclusions=Fa
|
||||||
|
|
||||||
doc = ''.join(doc_spans)
|
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]) +
|
||||||
|
'</span>')
|
||||||
|
pos = end
|
||||||
|
new_text += escape(text[pos:])
|
||||||
|
new_text = new_text.replace('\n', '<br/>\n')
|
||||||
|
|
||||||
|
s['text'] = new_text
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'source': source,
|
||||||
'doc': doc.replace('\n', '<br/>\n'),
|
'doc': doc.replace('\n', '<br/>\n'),
|
||||||
'span_count': len(spans),
|
'span_count': len(spans),
|
||||||
'link_count': len(two_facet_links),
|
'link_count': len(two_facet_links),
|
||||||
|
|
Loading…
Reference in a new issue