Jean-Marc Lasgouttes wrote:
> Angus> * Copies any BibTeX databases to the temp directory, mangling
> Angus> their names in the process. This ensures that any "files with
> Angus> spaces" that cause BibTeX to fail can be processed
> Angus> successfully.

> I am OK with the principle, but the code looks a bit weird to me.

That's why I post it, so that some fresh eyes can tell me I'm making a mess
of things ;-)

> Why is this databases needed, whereas the entries could be generated on
> the fly?

What happens if there are no databases? Is "\bibliography{}" OK? Maybe it's
OK, but it's certainly lazy and ugly. Try 2:

    Separator const separator(",");
    Tokenizer const tokens(getContents(), separator); 
    Tokenizer::const_iterator const begin = tokens.begin();
    Tokenizer::const_iterator const end = tokens.end();

    ostringstream dbs;
    for (Tokenizer::const_iterator it = begin; it != end; ++it) {
        string database = ...
        if (it != begin)
            dbs << ',';
        dbs << database;
    }
    string const dbs_str = dbs.str();

    int nnewlines = 1;
    if (!dbs_str.empty()) {
        ++nnewlines;
        os << "\\bibliography{" << dbs_str << "}\n";
    }

    return nnewlines;
}

If you're happy with this, I'll make the change, commit it to the 1.3.x
tree and forward-port it to 1.4.x. AFAIK, that's all squashable bugs
squashed for 1.3.x. If you know different, please keep it to yourself ;-)

-- 
Angus

Reply via email to