Пример #1
0
  public void render(Title title, Section section, int lvl, LatexPreamble latexPreamble) {
    logger.trace("Render title");
    if (title.isSetNumbering()) {
      logger.warn("Ignoring numbring");
    }

    txt.add("");

    StringBuffer sb = new StringBuffer();
    sb.append("\\").append(latexPreamble.getSectionHeaderName(lvl));
    sb.append("{").append(TxtTitleFactory.build(title)).append("}");
    txt.add(sb.toString());

    if (section.isSetId()) {
      txt.add("\\label{" + section.getId() + "}");
    }
  }
Пример #2
0
 public static synchronized Title getTitle(Section section) throws ExlpXpathNotFoundException {
   for (Object o : section.getContent()) {
     if (o instanceof Title) {
       return (Title) o;
     }
   }
   throw new ExlpXpathNotFoundException("No " + Title.class.getSimpleName() + " in this section");
 }
Пример #3
0
 public static synchronized Section getRenderer(Section section, String id)
     throws ExlpXpathNotFoundException, ExlpXpathNotUniqueException {
   Section result = null;
   for (Object o : section.getContent()) {
     if (o instanceof Section) {
       Section child = (Section) o;
       if (child.getId().equals(id)) {
         if (result != null) {
           throw new ExlpXpathNotUniqueException(
               "No unique " + Section.class.getSimpleName() + " for id=" + id);
         }
         result = child;
       }
     }
   }
   if (result == null) {
     throw new ExlpXpathNotFoundException(
         "No " + Section.class.getSimpleName() + " found for id=" + id);
   }
   return result;
 }
Пример #4
0
  public void render(Section section) throws OfxAuthoringException {

    // Rekursiver Aufruf des Sectionrenderers, um verschiedene Ebenen (z.B. Untertitel) anzuzeigen
    for (Object o : section.getContent()) {
      if (o instanceof Title) {
        renderTitle((Title) o, lvl);
      }
    }

    // Prüfung auf Inhalt
    for (Object o : section.getContent()) {
      if (o instanceof Section) {
        renderSection((Section) o);
      } else if (o instanceof String) {
        txt.add((String) o);
      } else if (o instanceof Paragraph) {
        paragraphRenderer((Paragraph) o);
      } else if (o instanceof List) {
        // TODO ListRenderer
      }
    }
  }