+'''
+This modules offer several free functions to help with lyx2lyx'ing.
+More documentaton is below, but here is a quick guide to what
+they do. Optional arguments are marked by brackets.
+
+add_to_preamble(document, text):
+ Here, text can be either a single line or a list of lines. It
+ is bad practice to pass something with embedded newlines, but
+ we will handle that properly.
+ The routine checks to see whether the provided material is
+ already in the preamble. If not, it adds it.
+ Prepends a comment "% Added by lyx2lyx" to text.
+
+insert_to_preamble(document, text[, index]):
+ Here, text can be either a single line or a list of lines. It
+ is bad practice to pass something with embedded newlines, but
+ we will handle that properly.
+ The routine inserts text at document.preamble[index], where by
+ default index is 0, so the material is inserted at the beginning.
+ Prepends a comment "% Added by lyx2lyx" to text.
+
+put_cmd_in_ert(arg):
+ Here arg should be a list of strings (lines), which we want to
+ wrap in ERT. Returns a list of strings so wrapped.
+ A call to this routine will often go something like this:
+ i = find_token('\\begin_inset FunkyInset', ...)
+ j = find_end_of_inset(document.body, i)
+ content = lyx2latex(document[i:j + 1])
+ ert = put_cmd_in_ert(content)
+ document.body[i:j+1] = ert
+
+lyx2latex(document, lines):
+ Here, lines is a list of lines of LyX material we want to convert
+ to LaTeX. We do the best we can and return a string containing
+ the translated material.
+
+latex_length(slen):
+ Convert lengths (in LyX form) to their LaTeX representation. Returns
+ (bool, length), where the bool tells us if it was a percentage, and
+ the length is the LaTeX representation.
+
+'''