On 9/19/10 11:19 AM, Ronen Abravanel wrote:
+def revert_diagram(document):
+ i = 0
+ re_diagram = re.compile(r'\\begin_inset Formula .*\\Diagram', re.DOTALL)
+ while True:
+ i = find_token(document.body, '\\begin_inset Formula', i)
+ if i == -1:
+ return
+ j = find_end_of_inset(document.body, i)
+ if j == -1:
+ document.warning("Malformed LyX document: Can't find end of line
inset.")
+ return
+ m = re_diagram.search("\n".join(document.body[i:j]))
+ if not m:
+ i += 1
+ continue
+ add_to_preamble(document, "\\use_package{feyn}")
+ # only need to do it once!
+ return
+
+
Like Pavel, I'm a bit puzzled by this. I see the newline in
InsetXYMatrix::write() and now in your code, but I hadn't realized we
put newlines into the math stuff. Anyway, better not to assume they're
not there.
+int const LYX_FORMAT = 401; // uwestoehr: support for \rule \\Ronen: support
for \Diagrasr
You can take Uwe's comment out, which applied to format 400, and just
have yours. The main thing is just to have a comment there.
Otherwise looks fine to me, though I'm not expert on the math stuff.
rh