Package org.eclipse.xtext.xdoc.xdoc

Examples of org.eclipse.xtext.xdoc.xdoc.TextPart


  public void testEscape() throws Exception {
    XdocFile file = getDocFromFile(TEST_FILE_DIR + "testEscape.xdoc");
    TextOrMarkup textOrMarkup = file.getMainSection()
        .getContents().get(0);
    assertEquals(1, textOrMarkup.getContents().size());
    TextPart p = (TextPart) textOrMarkup.getContents().get(0);
    assertEquals("\\\\ \\[ \\]", p.getText());
  }
View Full Code Here


    EList<TableData> data = t.getRows().get(0).getData();
    assertEquals(2, data.size());
    TableData td = data.get(0);
    EList<TextOrMarkup> contents = td.getContents();
    assertEquals(2, contents.size());
    TextPart text = (TextPart)contents.get(0).getContents().get(0);
    assertEquals(dataString, text.getText());
    text = (TextPart)contents.get(1).getContents().get(0);
    assertEquals(dataString2, text.getText());
    td = data.get(1);
    assertEquals(0, td.getContents().size());
  }
View Full Code Here

  public void testFullSectionHirarchy() throws Exception {
    XdocFile file = getDocFromFile(TEST_FILE_DIR + "downToSection4Test.xdoc");
    Document doc = (Document) file.getMainSection();
    assertEquals(1, doc.getTitle().getContents().size());
    TextPart textPart = (TextPart)(doc.getTitle().getContents().get(0));
    assertEquals("foo", textPart.getText());
    assertEquals(1, doc.getChapters().size());
    Chapter chapter = doc.getChapters().get(0);
    assertEquals(1, chapter.getTitle().getContents().size());
    textPart = (TextPart)(chapter.getTitle().getContents().get(0));
    assertEquals("bar", textPart.getText());
    assertEquals(1, chapter.getSubSections().size());
    Section section = chapter.getSubSections().get(0);
    assertEquals(1, section.getTitle().getContents().size());
    textPart = (TextPart) section.getTitle().getContents().get(0);
    assertEquals("foo�", textPart.getText());
    assertEquals(1, section.getSubSections().size());
    Section2 section2 = section.getSubSections().get(0);
    assertEquals(1, section2.getTitle().getContents().size());
    textPart = (TextPart) section2.getTitle().getContents().get(0);
    assertEquals("pilz", textPart.getText());
    assertEquals(1, section2.getSubSections().size());
    Section3 section3 = section2.getSubSections().get(0);
    assertEquals(1, section3.getTitle().getContents().size());
    textPart = (TextPart) section3.getTitle().getContents().get(0);
    assertEquals("sna", textPart.getText());
    assertEquals(1, section3.getSubSections().size());
    Section4 section4 = section3.getSubSections().get(0);
    assertEquals(1, section4.getTitle().getContents().size());
    textPart = (TextPart) section4.getTitle().getContents().get(0);
    assertEquals("fu", textPart.getText());
  }
View Full Code Here

      EList<EObject> _contents_1 = textOrMarkup.getContents();
      int _size = _contents_1.size();
      Assert.assertEquals(1, _size);
      EList<EObject> _contents_2 = textOrMarkup.getContents();
      EObject _head = IterableExtensions.<EObject>head(_contents_2);
      final TextPart p = ((TextPart) _head);
      String _text = p.getText();
      Assert.assertEquals("\\\\ \\[ \\]", _text);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

      int _size_3 = contents.size();
      Assert.assertEquals(2, _size_3);
      TextOrMarkup _head_3 = IterableExtensions.<TextOrMarkup>head(contents);
      EList<EObject> _contents_1 = _head_3.getContents();
      EObject _head_4 = IterableExtensions.<EObject>head(_contents_1);
      TextPart text = ((TextPart) _head_4);
      String _text = text.getText();
      Assert.assertEquals(dataString, _text);
      Iterable<TextOrMarkup> _tail = IterableExtensions.<TextOrMarkup>tail(contents);
      TextOrMarkup _head_5 = IterableExtensions.<TextOrMarkup>head(_tail);
      EList<EObject> _contents_2 = _head_5.getContents();
      EObject _head_6 = IterableExtensions.<EObject>head(_contents_2);
      text = ((TextPart) _head_6);
      String _text_1 = text.getText();
      Assert.assertEquals(dataString2, _text_1);
      Iterable<TableData> _tail_1 = IterableExtensions.<TableData>tail(data);
      TableData _head_7 = IterableExtensions.<TableData>head(_tail_1);
      td = _head_7;
      EList<TextOrMarkup> _contents_3 = td.getContents();
View Full Code Here

      int _size = _contents.size();
      Assert.assertEquals(1, _size);
      TextOrMarkup _title_1 = doc.getTitle();
      EList<EObject> _contents_1 = _title_1.getContents();
      EObject _head = IterableExtensions.<EObject>head(_contents_1);
      TextPart textPart = ((TextPart) _head);
      String _text = textPart.getText();
      Assert.assertEquals("foo", _text);
      EList<Chapter> _chapters = doc.getChapters();
      int _size_1 = _chapters.size();
      Assert.assertEquals(1, _size_1);
      EList<Chapter> _chapters_1 = doc.getChapters();
      final Chapter chapter = IterableExtensions.<Chapter>head(_chapters_1);
      TextOrMarkup _title_2 = chapter.getTitle();
      EList<EObject> _contents_2 = _title_2.getContents();
      int _size_2 = _contents_2.size();
      Assert.assertEquals(1, _size_2);
      TextOrMarkup _title_3 = chapter.getTitle();
      EList<EObject> _contents_3 = _title_3.getContents();
      EObject _head_1 = IterableExtensions.<EObject>head(_contents_3);
      textPart = ((TextPart) _head_1);
      String _text_1 = textPart.getText();
      Assert.assertEquals("bar", _text_1);
      EList<Section> _subSections = chapter.getSubSections();
      int _size_3 = _subSections.size();
      Assert.assertEquals(1, _size_3);
      EList<Section> _subSections_1 = chapter.getSubSections();
      final Section section = IterableExtensions.<Section>head(_subSections_1);
      TextOrMarkup _title_4 = section.getTitle();
      EList<EObject> _contents_4 = _title_4.getContents();
      int _size_4 = _contents_4.size();
      Assert.assertEquals(1, _size_4);
      TextOrMarkup _title_5 = section.getTitle();
      EList<EObject> _contents_5 = _title_5.getContents();
      EObject _head_2 = IterableExtensions.<EObject>head(_contents_5);
      textPart = ((TextPart) _head_2);
      String _text_2 = textPart.getText();
      Assert.assertEquals("foo�", _text_2);
      EList<Section2> _subSections_2 = section.getSubSections();
      int _size_5 = _subSections_2.size();
      Assert.assertEquals(1, _size_5);
      EList<Section2> _subSections_3 = section.getSubSections();
      final Section2 section2 = IterableExtensions.<Section2>head(_subSections_3);
      TextOrMarkup _title_6 = section2.getTitle();
      EList<EObject> _contents_6 = _title_6.getContents();
      int _size_6 = _contents_6.size();
      Assert.assertEquals(1, _size_6);
      TextOrMarkup _title_7 = section2.getTitle();
      EList<EObject> _contents_7 = _title_7.getContents();
      EObject _head_3 = IterableExtensions.<EObject>head(_contents_7);
      textPart = ((TextPart) _head_3);
      String _text_3 = textPart.getText();
      Assert.assertEquals("pilz", _text_3);
      EList<Section3> _subSections_4 = section2.getSubSections();
      int _size_7 = _subSections_4.size();
      Assert.assertEquals(1, _size_7);
      EList<Section3> _subSections_5 = section2.getSubSections();
      final Section3 section3 = IterableExtensions.<Section3>head(_subSections_5);
      TextOrMarkup _title_8 = section3.getTitle();
      EList<EObject> _contents_8 = _title_8.getContents();
      int _size_8 = _contents_8.size();
      Assert.assertEquals(1, _size_8);
      TextOrMarkup _title_9 = section3.getTitle();
      EList<EObject> _contents_9 = _title_9.getContents();
      EObject _head_4 = IterableExtensions.<EObject>head(_contents_9);
      textPart = ((TextPart) _head_4);
      String _text_4 = textPart.getText();
      Assert.assertEquals("sna", _text_4);
      EList<Section4> _subSections_6 = section3.getSubSections();
      int _size_9 = _subSections_6.size();
      Assert.assertEquals(1, _size_9);
      EList<Section4> _subSections_7 = section3.getSubSections();
      final Section4 section4 = IterableExtensions.<Section4>head(_subSections_7);
      TextOrMarkup _title_10 = section4.getTitle();
      EList<EObject> _contents_10 = _title_10.getContents();
      int _size_10 = _contents_10.size();
      Assert.assertEquals(1, _size_10);
      TextOrMarkup _title_11 = section4.getTitle();
      EList<EObject> _contents_11 = _title_11.getContents();
      EObject _head_5 = IterableExtensions.<EObject>head(_contents_11);
      textPart = ((TextPart) _head_5);
      String _text_5 = textPart.getText();
      Assert.assertEquals("fu", _text_5);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

  public void testEm() throws Exception {
    XdocFactory fac = XdocFactory.eINSTANCE;
    Emphasize emphasize = fac.createEmphasize();
    TextOrMarkup textOrMarkup = fac.createTextOrMarkup();
    TextPart textPart = fac.createTextPart();
    textPart.setText("Testtext_");
    textOrMarkup.getContents().add(textPart);
    emphasize.getContents().add(textOrMarkup);
    String expected = "<em>Testtext_</em>";
    String actual = generator.genText(emphasize).toString();
    assertEquals(expected, actual);
    // and for two paragraphs in one em
    TextOrMarkup textOrMarkup2 = fac.createTextOrMarkup();
    TextPart textPart2 = fac.createTextPart();
    textPart2.setText("more test");
    textOrMarkup2.getContents().add(textPart2);
    emphasize.getContents().add(textOrMarkup2);
    expected = "<em>\n" +
        "<p>\n" +
        "Testtext_\n" +
View Full Code Here

  }

  public Chapter getChapter(String title) {
    Chapter chapter = XdocFactory.eINSTANCE.createChapter();
    TextPart tp = XdocFactory.eINSTANCE.createTextPart();
    tp.setText(title);
    TextOrMarkup tom = XdocFactory.eINSTANCE.createTextOrMarkup();
    tom.getContents().add(tp);
    chapter.setTitle(tom);
    return chapter;
  }
View Full Code Here

    return chapter;
  }

  public Section getSection(String title) {
    Section section = XdocFactory.eINSTANCE.createSection();
    TextPart tp = XdocFactory.eINSTANCE.createTextPart();
    tp.setText(title);
    TextOrMarkup tom = XdocFactory.eINSTANCE.createTextOrMarkup();
    tom.getContents().add(tp);
    section.setTitle(tom);
    return section;
  }
View Full Code Here

  }

  protected Document initDoc(String name) {
    Document result = XdocFactory.eINSTANCE.createDocument();
    TextOrMarkup tomTitle = XdocFactory.eINSTANCE.createTextOrMarkup();
    TextPart title = XdocFactory.eINSTANCE.createTextPart();
    title.setText(name);
    tomTitle.getContents().add(title);
    result.setTitle(tomTitle);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.xdoc.xdoc.TextPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.