Switch to unified view

a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.30 2007-05-23 08:29:04 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.31 2007-06-19 08:36:24 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
268
268
269
static const string keyab("abstract");
269
static const string keyab("abstract");
270
static const string keyau("author");
270
static const string keyau("author");
271
static const string keycs("charset");
271
static const string keycs("charset");
272
static const string keyct("content");
272
static const string keyct("content");
273
static const string keyds("description");
273
static const string keyfn("filename");
274
static const string keyfn("filename");
274
static const string keykw("keywords");
275
static const string keykw("keywords");
275
static const string keymd("modificationdate");
276
static const string keymd("modificationdate");
276
static const string keymt("mimetype");
277
static const string keymt("mimetype");
277
static const string keyoc("origcharset");
278
static const string keyoc("origcharset");
278
static const string keysm("sample");
279
static const string keytt("title");
279
static const string keytt("title");
280
280
281
bool FileInterner::dijontorcl(Rcl::Doc& doc)
281
bool FileInterner::dijontorcl(Rcl::Doc& doc)
282
{
282
{
283
    Dijon::Filter *df = m_handlers.back();
283
    Dijon::Filter *df = m_handlers.back();
284
    const std::map<std::string, std::string>& docdata = df->get_meta_data();
284
    const std::map<std::string, std::string>& docdata = df->get_meta_data();
285
285
286
    getKeyValue(docdata, keyau, doc.author);
286
    for (map<string,string>::const_iterator it = docdata.begin(); 
287
    getKeyValue(docdata, keyoc, doc.origcharset);
287
   it != docdata.end(); it++) {
288
    getKeyValue(docdata, keyct, doc.text);    
288
  if (it->first == keyct) {
289
    getKeyValue(docdata, keytt, doc.title);
289
      doc.text = it->second;
290
    getKeyValue(docdata, keykw, doc.keywords);
290
  } else if (it->first == keymd) {
291
    getKeyValue(docdata, keymd, doc.dmtime);
291
      doc.dmtime = it->second;
292
    if (!getKeyValue(docdata, keyab, doc.abstract))
292
  } else if (it->first == keyoc) {
293
  getKeyValue(docdata, keysm, doc.abstract);
293
      doc.origcharset = it->second;
294
    LOGDEB1(("FILENAME: %s\n", doc.utf8fn.c_str()));
294
  } else if (it->first == keymt || it->first == keycs) {
295
      // don't need these.
296
  } else {
297
      doc.meta[it->first] = it->second;
298
  }
299
    }
300
    if (doc.meta[keyab].empty() && !doc.meta[keyds].empty()) {
301
  doc.meta[keyab] = doc.meta[keyds];
302
  doc.meta.erase(keyds);
303
    }
295
    return true;
304
    return true;
296
}
305
}
297
306
298
// Collect the ipath stack. 
307
// Collect the ipath stack. 
299
// While we're at it, we also set the mimetype and filename, which are special 
308
// While we're at it, we also set the mimetype and filename, which are special 
...
...
322
        }
331
        }
323
        ipath += ipathel + isep;
332
        ipath += ipathel + isep;
324
    } else {
333
    } else {
325
        ipath += isep;
334
        ipath += isep;
326
    }
335
    }
327
    getKeyValue(docdata, keyau, doc.author);
336
    getKeyValue(docdata, keyau, doc.meta["author"]);
328
    getKeyValue(docdata, keymd, doc.dmtime);
337
    getKeyValue(docdata, keymd, doc.dmtime);
329
    }
338
    }
330
339
331
    // Trim empty tail elements in ipath.
340
    // Trim empty tail elements in ipath.
332
    if (hasipath) {
341
    if (hasipath) {
...
...
670
    "]]]]\n-----------------------------------------------------\n" <<
679
    "]]]]\n-----------------------------------------------------\n" <<
671
    "doc.title [[[[" << doc.title <<
680
    "doc.title [[[[" << doc.title <<
672
    "]]]]\n-----------------------------------------------------\n" <<
681
    "]]]]\n-----------------------------------------------------\n" <<
673
    "doc.keywords [[[[" << doc.keywords <<
682
    "doc.keywords [[[[" << doc.keywords <<
674
    "]]]]\n-----------------------------------------------------\n" <<
683
    "]]]]\n-----------------------------------------------------\n" <<
675
    "doc.abstract [[[[" << doc.abstract <<
684
    "doc.meta["abstract"] [[[[" << doc.meta["abstract"] <<
676
    "]]]]\n-----------------------------------------------------\n" <<
685
    "]]]]\n-----------------------------------------------------\n" <<
677
    "doc.text [[[[" << doc.text << "]]]]\n";
686
    "doc.text [[[[" << doc.text << "]]]]\n";
678
}
687
}
679
688
680
#endif // TEST_INTERNFILE
689
#endif // TEST_INTERNFILE