paste-from-office/filters/replacemsfootnotes
module
Functions
replaceMSFootnotes( documentFragment, writer ) → voidinternalmodule:paste-from-office/filters/replacemsfootnotes~replaceMSFootnotesReplaces MS Word specific footnotes references and definitions with proper elements.
Things to know about MS Word footnotes:
- Footnote references in Word are marked with
mso-footnote-idstyle. - Word does not support nested footnotes, so references within definitions are ignored.
- Word appends extra spaces after footnote references within definitions, which are trimmed.
- Footnote definitions list is marked with
mso-element: footnote-liststyle it containmso-element: footnoteelements. - Footnote definition might contain tables, lists and other elements, not only text. They are placed directly within
lielement, without any wrapper (in opposition to text content of the definition, which is placed withinMsoFootnoteTextelement).
Example pseudo document showing MS Word footnote structure:
<p>Text with footnote<a style='mso-footnote-id:ftn1'>[1]</a> reference.</p> <div style='mso-element:footnote-list'> <div style='mso-element:footnote' id=ftn1> <p class=MsoFootnoteText><a style='mso-footnote-id:ftn1'>[1]</a> Footnote content</p> <table class="MsoTableGrid">...</table> </div> </div>Copy codeWill be transformed into:
<p>Text with footnote<sup class="footnote"><a id="ref-footnote-ftn1" href="#footnote-ftn1">1</a></sup> reference.</p> <ol class="footnotes"> <li class="footnote-definition" id="footnote-ftn1"> <a href="#ref-footnote-ftn1" class="footnote-backlink">^</a> <div class="footnote-content"> <p>Footnote content</p> <table>...</table> </div> </li> </ol>Copy codeParameters
documentFragment : ViewDocumentFragmentdata.contentobtained from clipboard.writer : ViewUpcastWriterThe view writer instance.
Returns
void
- Footnote references in Word are marked with