+ for (; it < end; ++it) {
+ if (prefixIs(s, (*it)->temppath())) {
+ // check whether the filename matches the master
+ string const master_name = (*it)->latexName();
+ if (suffixIs(s, master_name))
+ return *it;
+ // if not, try with the children
+ ListOfBuffers clist = (*it)->getDescendents();
+ ListOfBuffers::const_iterator cit = clist.begin();
+ ListOfBuffers::const_iterator cend = clist.end();
+ for (; cit != cend; ++cit) {
+ string const mangled_child_name = DocFileName(
+ changeExtension((*cit)->absFileName(),
+ ".tex")).mangledFileName();
+ if (suffixIs(s, mangled_child_name))
+ return *cit;
+ }
+ }
+ }