public List<Object> splitByTextualElems(String text,Map<String,Map<String,Object>> entryMap,Map<String,Map<String,Object>> libMap,Map<String,Object> libInfo){
  List<Object> res;
  Map<String,Object> modelMap;
  List<Object> prevSplit;
  msgHandler.logDebug("====================================\n" + "splitByTextualElems: " + (text.length() > 400 ? text.substring(0,399) : text) + "\n"+ "====================================");
  modelMap=FtlDocFileParser.makeObjectMap();
  modelMap.put("type","text-raw");
  res=splitByPat(text,rawTextPat,modelMap,"origText","value");
  prevSplit=res;
  res=new ArrayList<>();
  modelMap=FtlDocFileParser.makeObjectMap();
  modelMap.put("type","text-plain");
  for (  Object part : prevSplit) {
    if (part instanceof String) {
      List<Object> listSplit=splitByPat((String)part,plainTextPat,modelMap,"origText","value");
      res.addAll(listSplit);
    }
 else {
      res.add(part);
    }
  }
  prevSplit=res;
  res=new ArrayList<>();
  modelMap=FtlDocFileParser.makeObjectMap();
  modelMap.put("type","text-code");
  for (  Object part : prevSplit) {
    if (part instanceof String) {
      List<Object> listSplit=splitByPat((String)part,codeTextPat,modelMap,"origText","value");
      res.addAll(listSplit);
    }
 else {
      res.add(part);
    }
  }
  prevSplit=res;
  res=new ArrayList<>();
  for (  Object part : prevSplit) {
    if (part instanceof String) {
      List<Object> listSplit=splitByLibEntryRefs((String)part,entryMap,libMap);
      res.addAll(listSplit);
    }
 else {
      res.add(part);
    }
  }
  prevSplit=res;
  res=new ArrayList<>();
  modelMap=FtlDocFileParser.makeObjectMap();
  modelMap.put("type","link");
  for (  Object part : prevSplit) {
    if (part instanceof String) {
      List<Object> listSplit=splitByPat((String)part,linkManualPat,modelMap,"origText","value");
      List<Object> fixupListSplit=new ArrayList<Object>();
      for (      Object listObj : listSplit) {
        fixupListSplit.add(fixupLink(listObj,entryMap,libMap,libInfo));
      }
      res.addAll(fixupListSplit);
    }
 else {
      res.add(part);
    }
  }
  prevSplit=res;
  res=new ArrayList<>();
  modelMap=FtlDocFileParser.makeObjectMap();
  modelMap.put("type","link");
  for (  Object part : prevSplit) {
    if (part instanceof String) {
      List<Object> listSplit=splitByPat((String)part,linkAutoPat,modelMap,"origText",null,"value");
      List<Object> fixupListSplit=new ArrayList<Object>();
      for (      Object listObj : listSplit) {
        fixupListSplit.add(fixupLink(listObj,entryMap,libMap,libInfo));
      }
      res.addAll(fixupListSplit);
    }
 else {
      res.add(part);
    }
  }
  return res;
}

public List < Object > splitByTextualElems ( String text , Map < String , Map < String , Object > > entryMap , Map < String , Map < String , Object > > libMap , Map < String , Object > libInfo ) { List < Object > res ; Map < String , Object > modelMap ; List < Object > prevSplit ; msgHandler . logDebug ( "====================================\n" + "splitByTextualElems: " + ( text . length ( ) > 400 ? text . substring ( 0 , 399 ) : text ) + "\n" + "====================================" ) ; modelMap = FtlDocFileParser . makeObjectMap ( ) ; modelMap . put ( "type" , "text-raw" ) ; res = splitByPat ( text , rawTextPat , modelMap , "origText" , "value" ) ; prevSplit = res ; res = new ArrayList < > ( ) ; modelMap = FtlDocFileParser . makeObjectMap ( ) ; modelMap . put ( "type" , "text-plain" ) ; for ( Object part : prevSplit ) { if ( part instanceof String ) { List < Object > listSplit = splitByPat ( ( String ) part , plainTextPat , modelMap , "origText" , "value" ) ; res . addAll ( listSplit ) ; } else { res . add ( part ) ; } } prevSplit = res ; res = new ArrayList < > ( ) ; modelMap = FtlDocFileParser . makeObjectMap ( ) ; modelMap . put ( "type" , "text-code" ) ; for ( Object part : prevSplit ) { if ( part instanceof String ) { List < Object > listSplit = splitByPat ( ( String ) part , codeTextPat , modelMap , "origText" , "value" ) ; res . addAll ( listSplit ) ; } else { res . add ( part ) ; } } prevSplit = res ; res = new ArrayList < > ( ) ; for ( Object part : prevSplit ) { if ( part instanceof String ) { List < Object > listSplit = splitByLibEntryRefs ( ( String ) part , entryMap , libMap ) ; res . addAll ( listSplit ) ; } else { res . add ( part ) ; } } prevSplit = res ; res = new ArrayList < > ( ) ; modelMap = FtlDocFileParser . makeObjectMap ( ) ; modelMap . put ( "type" , "link" ) ; for ( Object part : prevSplit ) { if ( part instanceof String ) { List < Object > listSplit = splitByPat ( ( String ) part , linkManualPat , modelMap , "origText" , "value" ) ; List < Object > fixupListSplit = new ArrayList < Object > ( ) ; for ( Object listObj : listSplit ) { fixupListSplit . add ( fixupLink ( listObj , entryMap , libMap , libInfo ) ) ; } res . addAll ( fixupListSplit ) ; } else { res . add ( part ) ; } } prevSplit = res ; res = new ArrayList < > ( ) ; modelMap = FtlDocFileParser . makeObjectMap ( ) ; modelMap . put ( "type" , "link" ) ; for ( Object part : prevSplit ) { if ( part instanceof String ) { List < Object > listSplit = splitByPat ( ( String ) part , linkAutoPat , modelMap , "origText" , null , "value" ) ; List < Object > fixupListSplit = new ArrayList < Object > ( ) ; for ( Object listObj : listSplit ) { fixupListSplit . add ( fixupLink ( listObj , entryMap , libMap , libInfo ) ) ; } res . addAll ( fixupListSplit ) ; } else { res . add ( part ) ; } } return res ; }
splits by [ [ [ , ] ] ] , ( ( ( , ) ) ) , { { { , } } } , and potential entry refs .
