On Sun, Oct 17, 2004 at 12:26:40AM +0200, Andreas Vox wrote: > Groan -- again!
| Index: src/mathed//ChangeLog | =================================================================== | RCS file: /cvs/lyx/lyx-devel/src/mathed/ChangeLog,v | retrieving revision 1.443 | diff -u -p -r1.443 ChangeLog | --- src/mathed//ChangeLog 2004/10/05 15:48:36 1.443 | +++ src/mathed//ChangeLog 2004/10/16 21:08:37 | @@ -1,5 +1,10 @@ | 2004-10-05 Andreas Vox <[EMAIL PROTECTED]> | | + * math_hullinset.C (docbook) write <graphic filref=".." > for Docbook + * math_hullinset.C (docbook): write <graphic filref=".." > for Docbook | + where ".." is either the first label or a generated name. | + | +2004-10-05 Andreas Vox <[EMAIL PROTECTED]> | + | * math_hullinset.C (docbook): write additional <alt role="tex" > tag for Docbook XML | | 2004-09-21 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> | Index: src/mathed//math_hullinset.C | =================================================================== | RCS file: /cvs/lyx/lyx-devel/src/mathed/math_hullinset.C,v | retrieving revision 1.152 | diff -u -p -r1.152 math_hullinset.C | --- src/mathed//math_hullinset.C 2004/10/05 15:48:36 1.152 | +++ src/mathed//math_hullinset.C 2004/10/16 21:08:38 | @@ -1326,9 +1326,22 @@ int MathHullInset::linuxdoc(Buffer const | } | | | +string const asString(unsigned long i) { '{' at new line | + string result; | + unsigned long digit = 1; | + while ( digit < i ) { LyX style is 'while (digit < i)'. | + digit *= 10; | + } | + for (digit /= 10; digit > 0; digit /= 10) { | + result += "0123456789" [ (i / digit) % 10 ]; Why not result += '0' + (i / digit) % 10 ? Apart from that, 'digit' is a misnomer if the thing can be 1000. | + } | + return result; | +} The whole function can be replaced by 'toStr' from src/support/tostr.h. | int MathHullInset::docbook(Buffer const & buf, ostream & os, | OutputParams const & runparams) const | { | + | MathMLStream ms(os); Why the extra empty line? | int res = 0; | string name; | @@ -1356,7 +1369,22 @@ int MathHullInset::docbook(Buffer const | res = latex(buf, ms.os(), runparams); | ms << ETag("alt"); Why three spaces? | } | - | + | + ms << "<graphic fileref=\"eqn/"; | + if (! label(0).empty()) LyX style is not to put a space after ! | + ms << label(0); | + else { | + // Some arbitrary unique number for this os. | + // Note that each call of math_hullinset::docbook() | + // will increase the os position by at least 60 chars or more | + ms << "anon"; | + ms << asString( os.tellp() / 40); Space. Apart from that an interestng idea to generate semi-stable unique ideas... | + } | + if (runparams.flavor == OutputParams::XML) | + ms << "\" />"; | + else | + ms << "\" >"; | + | ms << ETag(name.c_str()); | return ms.line() + res; | } Andre'