Switch to unified view

a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp
...
...
636
    }
636
    }
637
    LOGDEB2(("getKeyValue: no value for [%s]\n", key.c_str()));
637
    LOGDEB2(("getKeyValue: no value for [%s]\n", key.c_str()));
638
    return false;
638
    return false;
639
}
639
}
640
640
641
// These defs are for the Dijon meta array. Rcl::Doc predefined field
642
// names are used where appropriate. In some cases, Rcl::Doc names are
643
// used inside the Dijon metadata (ex: origcharset)
644
static const string cstr_keyds("description");
645
static const string cstr_keyfn("filename");
646
static const string cstr_keymd("modificationdate");
647
static const string cstr_keytt("title");
648
649
bool FileInterner::dijontorcl(Rcl::Doc& doc)
641
bool FileInterner::dijontorcl(Rcl::Doc& doc)
650
{
642
{
651
    Dijon::Filter *df = m_handlers.back();
643
    Dijon::Filter *df = m_handlers.back();
652
    if (df == 0) {
644
    if (df == 0) {
653
    //??
645
    //??
...
...
656
    }
648
    }
657
    const map<string, string>& docdata = df->get_meta_data();
649
    const map<string, string>& docdata = df->get_meta_data();
658
650
659
    for (map<string,string>::const_iterator it = docdata.begin(); 
651
    for (map<string,string>::const_iterator it = docdata.begin(); 
660
     it != docdata.end(); it++) {
652
     it != docdata.end(); it++) {
661
    if (it->first == cstr_content) {
653
    if (it->first == cstr_dj_keycontent) {
662
        doc.text = it->second;
654
        doc.text = it->second;
663
    } else if (it->first == cstr_keymd) {
655
    } else if (it->first == cstr_dj_keymd) {
664
        doc.dmtime = it->second;
656
        doc.dmtime = it->second;
665
  } else if (it->first == Rcl::Doc::keyoc) {
657
  } else if (it->first == cstr_dj_keyorigcharset) {
666
        doc.origcharset = it->second;
658
        doc.origcharset = it->second;
667
    } else if (it->first == cstr_mimetype || it->first == cstr_charset) {
659
    } else if (it->first == cstr_dj_keymt || it->first == cstr_dj_keycharset) {
668
        // don't need/want these.
660
        // don't need/want these.
669
    } else {
661
    } else {
670
        doc.meta[it->first] = it->second;
662
        doc.meta[it->first] = it->second;
671
    }
663
    }
672
    }
664
    }
673
    if (doc.meta[Rcl::Doc::keyabs].empty() && !doc.meta[cstr_keyds].empty()) {
665
    if (doc.meta[Rcl::Doc::keyabs].empty() && !doc.meta[cstr_dj_keyds].empty()) {
674
    doc.meta[Rcl::Doc::keyabs] = doc.meta[cstr_keyds];
666
    doc.meta[Rcl::Doc::keyabs] = doc.meta[cstr_dj_keyds];
675
    doc.meta.erase(cstr_keyds);
667
    doc.meta.erase(cstr_dj_keyds);
676
    }
668
    }
677
    return true;
669
    return true;
678
}
670
}
679
671
680
// Collect the ipath from the current path in the document tree.
672
// Collect the ipath from the current path in the document tree.
...
...
702
694
703
    string ipathel;
695
    string ipathel;
704
    for (vector<Dijon::Filter*>::const_iterator hit = m_handlers.begin();
696
    for (vector<Dijon::Filter*>::const_iterator hit = m_handlers.begin();
705
     hit != m_handlers.end(); hit++) {
697
     hit != m_handlers.end(); hit++) {
706
    const map<string, string>& docdata = (*hit)->get_meta_data();
698
    const map<string, string>& docdata = (*hit)->get_meta_data();
707
    if (getKeyValue(docdata, cstr_ipath, ipathel)) {
699
    if (getKeyValue(docdata, cstr_dj_keyipath, ipathel)) {
708
        if (!ipathel.empty()) {
700
        if (!ipathel.empty()) {
709
        // We have a non-empty ipath
701
        // We have a non-empty ipath
710
        hasipath = true;
702
        hasipath = true;
711
        getKeyValue(docdata, cstr_mimetype, doc.mimetype);
703
        getKeyValue(docdata, cstr_dj_keymt, doc.mimetype);
712
        getKeyValue(docdata, cstr_keyfn, doc.utf8fn);
704
        getKeyValue(docdata, cstr_dj_keyfn, doc.utf8fn);
713
        }
705
        }
714
        doc.ipath += colon_hide(ipathel) + cstr_isep;
706
        doc.ipath += colon_hide(ipathel) + cstr_isep;
715
    } else {
707
    } else {
716
        doc.ipath += cstr_isep;
708
        doc.ipath += cstr_isep;
717
    }
709
    }
718
    getKeyValue(docdata, cstr_author, doc.meta[Rcl::Doc::keyau]);
710
    getKeyValue(docdata, cstr_dj_keyauthor, doc.meta[Rcl::Doc::keyau]);
719
    getKeyValue(docdata, cstr_keymd, doc.dmtime);
711
    getKeyValue(docdata, cstr_dj_keymd, doc.dmtime);
720
    }
712
    }
721
713
722
    // Trim empty tail elements in ipath.
714
    // Trim empty tail elements in ipath.
723
    if (hasipath) {
715
    if (hasipath) {
724
    LOGDEB2(("IPATH [%s]\n", doc.ipath.c_str()));
716
    LOGDEB2(("IPATH [%s]\n", doc.ipath.c_str()));
...
...
752
// and possibly add a filter/handler to the stack
744
// and possibly add a filter/handler to the stack
753
int FileInterner::addHandler()
745
int FileInterner::addHandler()
754
{
746
{
755
    const map<string, string>& docdata = m_handlers.back()->get_meta_data();
747
    const map<string, string>& docdata = m_handlers.back()->get_meta_data();
756
    string charset, mimetype;
748
    string charset, mimetype;
757
    getKeyValue(docdata, cstr_charset, charset);
749
    getKeyValue(docdata, cstr_dj_keycharset, charset);
758
    getKeyValue(docdata, cstr_mimetype, mimetype);
750
    getKeyValue(docdata, cstr_dj_keymt, mimetype);
759
751
760
    LOGDEB(("FileInterner::addHandler: next_doc is %s\n", mimetype.c_str()));
752
    LOGDEB(("FileInterner::addHandler: next_doc is %s\n", mimetype.c_str()));
761
753
762
    // If we find a document of the target type (text/plain in
754
    // If we find a document of the target type (text/plain in
763
    // general), we're done decoding. If we hit text/plain, we're done
755
    // general), we're done decoding. If we hit text/plain, we're done
...
...
794
    // copying the text, which may be big.
786
    // copying the text, which may be big.
795
    string ns;
787
    string ns;
796
    const string *txt = &ns;
788
    const string *txt = &ns;
797
    {
789
    {
798
    map<string,string>::const_iterator it;
790
    map<string,string>::const_iterator it;
799
    it = docdata.find(cstr_content);
791
    it = docdata.find(cstr_dj_keycontent);
800
    if (it != docdata.end())
792
    if (it != docdata.end())
801
        txt = &it->second;
793
        txt = &it->second;
802
    }
794
    }
803
    bool setres = false;
795
    bool setres = false;
804
    if (newflt->is_data_input_ok(Dijon::Filter::DOCUMENT_STRING)) {
796
    if (newflt->is_data_input_ok(Dijon::Filter::DOCUMENT_STRING)) {