case TextFragment.MARKER_OPENING: index = TextFragment.toIndex(codedText.charAt(++i)); if ( normalText ) tmp.append(codes.get(index).toString()); else tmp.append(String.format("<%d>", codes.get(index).getId())); break; case TextFragment.MARKER_CLOSING: index = TextFragment.toIndex(codedText.charAt(++i)); if ( normalText ) tmp.append(codes.get(index).toString()); else tmp.append(String.format("</%d>", codes.get(index).getId())); break; case TextFragment.MARKER_ISOLATED: index = TextFragment.toIndex(codedText.charAt(++i)); if ( normalText ) tmp.append(codes.get(index).toString()); else { if ( codes.get(index).getTagType() == TagType.OPENING ) {
code = codes.get(index); if ( codeOnlyMode ) { tmp.append(code.toString()); tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, chsEnc)); tmp.append("</bpt>"); code = codes.get(index); if ( codeOnlyMode ) { tmp.append(code.toString()); tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, chsEnc)); tmp.append("</ept>"); code = codes.get(index); if ( codeOnlyMode ) { tmp.append(code.toString()); tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, chsEnc)); tmp.append("</it>"); tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, chsEnc)); tmp.append("</it>"); tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, chsEnc)); tmp.append("</ph>");
tmp.append(Util.escapeToXML(codes.get(index).toString(), quoteMode, escapeGT, null)); break; tmp.append(Util.escapeToXML(codes.get(index).toString(), quoteMode, escapeGT, null)); break; tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, null)); tmp.append("<ut>}</ut>"); tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, null)); break; tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, null)); break; tmp.append(Util.escapeToXML(code.toString(), quoteMode, escapeGT, null)); break;
skel.append(tmp.toString());
/** * Add a {@link Code} to the current {@link TextUnit}. The Code contains actionable (i.e., translatable, * localizable) attributes. * * @param code * the code * @param endCodeNow * do we end the code now or delay? * @param locale * the language of the text * @param propertyTextUnitPlaceholders * the list of actionable {@link TextUnit} or {@link Properties} with offset information into the tag. * @throws OkapiIllegalFilterOperationException if we try to perform an invalid operation. */ public void addToTextUnit(Code code, boolean endCodeNow, LocaleId locale, List<PropertyTextUnitPlaceholder> propertyTextUnitPlaceholders) { if (!isCurrentTextUnit()) { throw new OkapiIllegalFilterOperationException("Trying to add Codes to a TextUnit that does not exist."); } currentSkeleton = new GenericSkeleton(); ITextUnit tu = peekMostRecentTextUnit(); if (tu != null) { startCode(code); processAllEmbedded(code.toString(), locale, propertyTextUnitPlaceholders, true, tu); if (endCodeNow) { endCode(); } } currentSkeleton = null; }
eventBuilder.addToDocumentPart(sf.createRefCode().toString());
addToDocumentPart(cdataSubfilter.createRefCode().toString()); addToDocumentPart("]]>");
@SuppressWarnings("resource") private void callSubfilter(String value, JsonValueTypes valueType, String parentName) { String parentId = eventBuilder.findMostRecentParentId(); if (parentId == null) { parentId = getDocumentId().getLastId(); } // force creation of the parent encoder JSONEncoder subEncoder = new JSONEncoder(); subEncoder.setOptions(params, this.getEncoding(), this.getNewlineType()); SubFilter sf = new SubFilter(subFilter, subEncoder, ++subfilterIndex, parentId, parentName); // RawDocument closed inside the subfilter call eventBuilder.addFilterEvents(sf.getEvents( new RawDocument(eventBuilder.decode(value), getSrcLoc(), getTrgLoc()))); // Now write out the json skeleton eventBuilder.addToDocumentPart(valueType.getQuoteChar()); eventBuilder.addToDocumentPart(sf.createRefCode().toString()); eventBuilder.addToDocumentPart(valueType.getQuoteChar()); }
addToDocumentPart(pcdataSubfilter.createRefCode().toString()); addToDocumentPart(endTag.toString());