Changeset 19302

Show
Ignore:
Timestamp:
01.05.2009 09:48:50 (10 years ago)
Author:
davidb
Message:

Introduction of [metadata-spanwrap] ... /metadata-spanwrap to mark zones where the addition of span tags is required.

Location:
gsdl/trunk/runtime-src/src/recpt
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/recpt/formattools.cpp

    r19298 r19302  
    3232#include <assert.h> 
    3333 
    34 bool spanwrap = false; 
     34static bool metadata_spanwrap = false; 
    3535 
    3636// a few function prototypes 
     
    583583    formatlistptr->command = comEndHighlight; 
    584584 
     585  else if (meta == "metadata-spanwrap") 
     586    formatlistptr->command = comMetadataSpanWrap; 
     587 
     588  else if (meta == "/metadata-spanwrap") 
     589    formatlistptr->command = comEndMetadataSpanWrap; 
     590 
    585591  else if (meta == "Summary") 
    586592    formatlistptr->command = comSummary; 
     
    903909      else fresh_metatext = metainfo.values[i]; 
    904910 
    905       if (spanwrap) { 
     911      if (metadata_spanwrap) { 
    906912    fresh_metatext = "<span metaname=\"" + meta.metaname + "\" metapos=\"" + i + "\">" + fresh_metatext + "</span>"; 
    907913      } 
     
    928934    else fresh_metatext = metainfo.values[position]; 
    929935 
    930     if (spanwrap) { 
     936    if (metadata_spanwrap) { 
    931937      fresh_metatext = "<span metaname=\"" + meta.metaname + "\" metapos=\"" + position + "\">" + fresh_metatext + "</span>"; 
    932938    } 
     
    11251131              ostream& logout) { 
    11261132 
    1127   text_t tmp; 
    11281133  while (orptr != NULL) { 
    11291134 
    1130     tmp = format_string (collection,collectproto,docinfo, disp, orptr,  
    1131              options, logout); 
    1132     if (!tmp.empty()) return tmp; 
     1135    if (metadata_spanwrap) { 
     1136      // need to be a bit more careful about this 
     1137      // => test for it *without* spanwrap, and if defined, then 
     1138      // got back and generate it again, this time with spanwrap on 
     1139 
     1140      metadata_spanwrap = false; 
     1141      text_t test_tmp = format_string (collection,collectproto,docinfo, disp, orptr,  
     1142                       options, logout); 
     1143      metadata_spanwrap = true; 
     1144      if (!test_tmp.empty()) { 
     1145 
     1146    return format_string (collection,collectproto,docinfo, disp, orptr,  
     1147                  options, logout); 
     1148      } 
     1149    } 
     1150    else { 
     1151      text_t tmp = format_string (collection,collectproto,docinfo, disp, orptr,  
     1152                  options, logout); 
     1153      if (!tmp.empty()) return tmp; 
     1154    } 
    11331155 
    11341156    orptr = orptr->nextptr; 
     
    13871409  if (decision.command == dMeta) { 
    13881410 
    1389     bool store_spanwrap = spanwrap; 
    1390     spanwrap = 0; 
    1391  
    1392     // temporarily suspend spanwrap (if on) so can test if metadata item really exits or not 
     1411    bool store_metadata_spanwrap = metadata_spanwrap; 
     1412    metadata_spanwrap = 0; 
     1413 
     1414    // temporarily suspend metadata-spanwrap (if on) so can test if metadata item really exits or not 
    13931415    bool metadata_exists  
    13941416      = (get_meta (collection,collectproto,docinfo,disp,decision.meta,options, 
    13951417           logout) != ""); 
    13961418 
    1397     spanwrap = store_spanwrap; 
     1419    metadata_spanwrap = store_metadata_spanwrap; 
    13981420 
    13991421    if (metadata_exists) { 
     
    15941616    if (options["highlight"] == "1") return "</b>"; 
    15951617    break; 
     1618     case comMetadataSpanWrap: 
     1619        metadata_spanwrap=true;  return ""; 
     1620    break; 
     1621     case comEndMetadataSpanWrap: 
     1622    metadata_spanwrap=false; return ""; 
     1623    break; 
    15961624     case comIf: 
    15971625    return get_if (collection, collectproto, docinfo, disp,  
  • gsdl/trunk/runtime-src/src/recpt/formattools.h

    r19046 r19302  
    3333 
    3434enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,  
    35         comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary, 
     35        comDoc, comHighlight, comEndHighlight,  
     36        comMetadataSpanWrap, comEndMetadataSpanWrap, 
     37        comRel, comHref, comSummary, 
    3638        comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight, 
    3739        comDocumentButtonExpandContents, comDocumentButtonExpandText, comOID, comTopOID, comRank,