private static SrcSpan getEvalInfo( SrcSpan e, List<SrcSpan> eil ){ int start = e.getStart(); int end = e.getEnd(); for( SrcSpan ei: eil ){ if( start==-1 ||( start > ei.getStart() && ei.getStart() != -1 ) ) start = ei.getStart(); if( end < ei.getEnd()) end = ei.getEnd(); } return new SrcSpan( start, end ); } }
} else if (l != lang.getLanguage()) { ParsedIll pill = new ParsedIll(); pill.location = new ParsedLocation(xml, -1, -1, ill.getSrcSpan().getStart()); pill.title = new Title(target, false, LanguageInfo.getByLanguage(l)); visitIll(pill);
private void parseCategory(RawPage xml, ParsedPage pp){ // handle categories for (Link cat : pp.getCategories()){ Title destTitle = new Title(cat.getTarget(), lang); // TODO: ensure title is a category ParsedCategory pc = new ParsedCategory(); pc.location = new ParsedLocation(xml, -1, -1, cat.getSrcSpan().getStart()); pc.category = destTitle; visitCategory(pc); } // handle ILLs parseIlls(xml, pp); }
ParsedLink.SubarticleType linkSubType; if (secSubType == null){ // don't look for inlines in "see also" linkSubType = subarticleParser.isInlineSubarticle(curLink.getSrcSpan().getStart(), xml); }else{ ParsedLocation location = new ParsedLocation(xml, secNum, paraNum, curLink.getSrcSpan().getStart()); visitLink(location, destTitle, curLink.getText(), linkSubType); } catch (WikiBrainException e) { String templateTextOrig; if (!errorWithSrcLocation){ templateTextOrig = xml.getBody().substring(t.getSrcSpan().getStart(), t.getSrcSpan().getEnd()); }else{ // this makes up for errors in JWPL (or bad script, but it mostly looks like erros) int estimatedLength = t.getPos().getEnd() - t.getPos().getStart(); templateTextOrig = xml.getBody().substring(t.getSrcSpan().getStart(), t.getSrcSpan().getStart() + estimatedLength + 1); NameSpace type = destTitle.getNamespace(); if (type == NameSpace.ARTICLE){ ParsedLocation location = new ParsedLocation(xml, secNum, paraNum, t.getSrcSpan().getStart()); visitLink(location, destTitle, templateLink.getText(), tempSubType); } else if (type == NameSpace.CATEGORY){ ParsedCategory pc = new ParsedCategory(); pc.location = new ParsedLocation(xml, secNum, paraNum, t.getSrcSpan().getStart()); pc.category = destTitle; visitCategory(pc); Title destTitle = new Title(dest, lang); try { ParsedLocation location = new ParsedLocation(xml, secNum, paraNum, t.getSrcSpan().getStart());