Changeset 8643
- Timestamp:
- 2004-11-23T16:51:01+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GS2MacroResolver.java
r8616 r8643 61 61 62 62 public String resolve(String text, String lang, String scope, String doc_oid, DBInfo info) { 63 System.err.println("resolving macros for "+text);63 //System.err.println("resolving macros for "+text); 64 64 if (scope.equals(SCOPE_TEXT) && text_macros.size()==0) return text; 65 65 if (scope.equals(SCOPE_META) && metadata_macros.size() ==0) return text; 66 66 67 DBInfo root_info = null; 67 68 boolean new_lang = false; 68 69 if (this.lang == null || !this.lang.equals(lang) ) { … … 91 92 break; 92 93 case TYPE_META: 93 if (text.matches(m.macro)) { 94 // for some reason, this matches() never matches 95 //if (text.matches(".*"+m.macro+".*")) { 96 if (info == null) { 97 info = gdbm_src.getInfo(doc_oid); 94 98 if (info == null) { 95 info = gdbm_src.getInfo(doc_oid); 96 if (info == null) { 97 break; 98 } 99 String value = info.getInfo(m.text); 100 if (value != null) { 101 text = text.replaceAll(m.macro, value); 102 } 99 break; 103 100 } 104 101 } 105 102 String value = info.getInfo(m.text); 103 if (value != null) { 104 text = text.replaceAll(m.macro, value); 105 } else { 106 // try the root node 107 if (root_info == null && !OID.isTop(doc_oid)) { 108 System.err.println("top="+OID.getTop(doc_oid)); 109 root_info = gdbm_src.getInfo(OID.getTop(doc_oid)); 110 } 111 if (root_info == null) break; 112 value = root_info.getInfo(m.text); 113 if (value != null) { 114 text = text.replaceAll(m.macro, value); 115 } 116 } 117 //} // if 106 118 break; 107 } 119 } // switch 120 108 121 } 109 122
Note:
See TracChangeset
for help on using the changeset viewer.