public List<Content> toOSIS(Book book, Key key, String plain) { Element ele = OSISUtil.factory().createDiv(); LinkedList<Content> stack = new LinkedList<Content>(); stack.addFirst(ele); List<Tag> taglist = parseTags(book, key, plain.trim()); while (true) { if (taglist.isEmpty()) { break; } Tag tag = taglist.remove(0); tag.updateOsisStack(book, key, stack); } stack.removeFirst(); return ele.removeContent(); }
public static List<Content> rtfToOsis(String rtf) { Element div = factory().createDiv(); Stack<Content> stack = new Stack<Content>(); stack.push(div); Element centerDiv = OSISUtil.factory.createDiv(); centerDiv.setAttribute(OSIS_ATTR_TYPE, "x-center"); Element currentElement = (Element) stack.peek();
Element div = OSISUtil.factory().createDiv(); div.setAttribute(OSISUtil.OSIS_ATTR_OSISID, "dict://" + value);
Element div = OSISUtil.factory().createDiv(); div.setAttribute(OSISUtil.OSIS_ATTR_OSISID, key.getOsisID());
private Element getOsisContent(boolean allowGenTitles) throws BookException { Element div = OSISUtil.factory().createDiv();
/** * Convert a Difference list into a pretty HTML report. * * @param diffs * List of Difference objects * @return HTML representation */ public static List<Content> diffToOsis(List<Difference> diffs) { Element div = factory().createDiv(); for (int x = 0; x < diffs.size(); x++) { Difference diff = diffs.get(x); EditType editType = diff.getEditType(); // Mode (delete, equal, // insert) Text text = factory.createText(diff.getText()); // Text of change. if (EditType.DELETE.equals(editType)) { Element hi = factory().createHI(); hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_LINETHROUGH); hi.addContent(text); div.addContent(hi); } else if (EditType.INSERT.equals(editType)) { Element hi = factory().createHI(); hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.HI_UNDERLINE); hi.addContent(text); div.addContent(hi); } else { div.addContent(text); } } return div.cloneContent(); }
@Override public Element processTag(Book book, Key key, Element ele, Attributes attrs) { // See if there are variant readings e.g. WHNU Mat 1.9 String typeAttr = attrs.getValue("type"); if ("variant".equals(typeAttr)) { Element seg = OSISUtil.factory().createSeg(); seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.VARIANT_TYPE); String classAttr = attrs.getValue("class"); if (classAttr != null) { seg.setAttribute(OSISUtil.OSIS_ATTR_SUBTYPE, OSISUtil.VARIANT_CLASS + '-' + classAttr); } if (ele != null) { ele.addContent(seg); } return seg; } Element div = OSISUtil.factory().createDiv(); if (ele != null) { ele.addContent(div); } return div; }
public List<Content> toOSIS(Book book, Key key, String plain) { OSISUtil.OSISFactory factory = OSISUtil.factory(); Element ele = factory.createDiv(); String[] lines = StringUtil.splitAll(plain, '\n'); int lastIndex = lines.length - 1; for (int i = 0; i < lastIndex; i++) { // TODO(DMS): Preserve whitespace, in a smart manner. ele.addContent(lines[i]); ele.addContent(factory.createLB()); } // Don't add a line break after the last line. if (lastIndex >= 0) { ele.addContent(lines[lastIndex]); } return ele.removeContent(); }
/** * Creates a notice element. * * @param parent the parent to which the notice is added * @param notice the notice fragment to be applied to the sub-type * @return the new element */ private Element appendVersificationNotice(Element parent, final String notice) { Element note = OSISUtil.factory().createDiv(); note.setAttribute(OSISUtil.OSIS_ATTR_TYPE, OSISUtil.GENERATED_CONTENT); note.setAttribute(OSISUtil.OSIS_ATTR_SUBTYPE, OSISUtil.TYPE_X_PREFIX + notice); parent.addContent(note); return note; }
@Override public Element processTag(Book book, Key key, Element ele, Attributes attrs) { return OSISUtil.factory().createDiv(); } }