Search in sources :

Example 11 with NavPoint

use of org.eclipse.mylyn.docs.epub.ncx.NavPoint in project mylyn.docs by eclipse.

the class TestTOCGenerator method testCrazyStructure.

@Test
public void testCrazyStructure() throws ParserConfigurationException, SAXException, IOException {
    String html = "<body><h3 id='h3-1'>test</h3><h2 id='h2-1'>test</h2><h1 id='h1-1'>test</h1></body>";
    Ncx ncx = createNcx();
    TOCGenerator.parse(new InputSource(new StringReader(html)), "test.html", ncx, 0);
    EList<NavPoint> points = ncx.getNavMap().getNavPoints();
    // "h3" will be created as a "h1" and "h2" added to it
    assertEquals(2, points.size());
}
Also used : Ncx(org.eclipse.mylyn.docs.epub.ncx.Ncx) InputSource(org.xml.sax.InputSource) NavPoint(org.eclipse.mylyn.docs.epub.ncx.NavPoint) StringReader(java.io.StringReader) Test(org.junit.Test)

Aggregations

NavPoint (org.eclipse.mylyn.docs.epub.ncx.NavPoint)11 Ncx (org.eclipse.mylyn.docs.epub.ncx.Ncx)8 Test (org.junit.Test)8 StringReader (java.io.StringReader)5 InputSource (org.xml.sax.InputSource)5 File (java.io.File)3 EPUB (org.eclipse.mylyn.docs.epub.core.EPUB)2 OPSPublication (org.eclipse.mylyn.docs.epub.core.OPSPublication)2 Publication (org.eclipse.mylyn.docs.epub.core.Publication)2 Meta (org.eclipse.mylyn.docs.epub.ncx.Meta)2 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1 FeatureEList (org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)1 Content (org.eclipse.mylyn.docs.epub.ncx.Content)1 NavLabel (org.eclipse.mylyn.docs.epub.ncx.NavLabel)1 Text (org.eclipse.mylyn.docs.epub.ncx.Text)1