Package com.adobe.epubcheck.ctc.css

Examples of com.adobe.epubcheck.ctc.css.EpubCSSCheckCSSHandler


  {
    boolean hasFixedFormatItems = getHasFixedFormatItems(epack);
    SearchDictionary tsd = new SearchDictionary(DictionaryType.CSS_VALUES);
    SearchDictionary cssTypes = new SearchDictionary(DictionaryType.CSS_FILES);
    SearchDictionary validTypes = new SearchDictionary(DictionaryType.VALID_TEXT_MEDIA_TYPES);
    EpubCSSCheckCSSHandler handler = new EpubCSSCheckCSSHandler(report, isGlobalFixed, hasFixedFormatItems);
    int numCssFiles = 0;

    for (int i = 0; i < epack.getManifest().itemsLength(); i++)
    {
      ManifestItem itemEntry = epack.getManifest().getItem(i);

      if (cssTypes.isValidMediaType(itemEntry.getMediaType()))
      {
        ++numCssFiles;
        String fileToParse = getEntryFileName(itemEntry, epack);

        ZipEntry entry = epack.getZip().getEntry(fileToParse);
        if (entry == null)
        {
          report.message(MessageId.RSC_001, new MessageLocation(epack.getFileName(), -1, -1), fileToParse);
          continue;
        }

        try
        {
          InputStream inputStream = getInputStream(fileToParse);
          CssSource source = new CssSource(fileToParse, inputStream);
          CssParser parser = new CssParser();
          handler.setPath(fileToParse);

          parser.parse(source, handler, handler);
        }
        catch (Exception e)
        {
View Full Code Here


    }
  }

  private boolean IncrementGlobalCssClassCount(String attrValue)
  {
    EpubCSSCheckCSSHandler handler = getCssHandler();
    return handler != null && handler.IncrementGlobalCssClassCount(attrValue);
  }
View Full Code Here

    }
  }

  private void parseCurrentStyleTag(StyleAttribute currentStyleTag)
  {
    EpubCSSCheckCSSHandler handler = new EpubCSSCheckCSSHandler(report, currentStyleTag.getLine(), currentStyleTag.getColumn(), isGlobalFixedFormat, documentIsFixedFormat);
    try
    {
      String s = currentStyleTag.getValue();
      InputStream inputStream = new ByteArrayInputStream(s.getBytes("UTF-8"));
      CssSource source = new CssSource(this.getFileName(), inputStream);
      CssParser parser = new CssParser();
      handler.setPath(this.getFileName());

      HashMap<String, EpubCSSCheckCSSHandler.ClassUsage> localStyleMap = localStyles.peek();
      parser.parse(source, handler, handler);
      HashMap<String, EpubCSSCheckCSSHandler.ClassUsage> map = handler.getClassMap();
      for (String key : map.keySet())
      {
        EpubCSSCheckCSSHandler.ClassUsage cu = map.get(key);
        int line = cu.Location.getLineNumber();
        int column = cu.Location.getColumnNumber();
View Full Code Here

TOP

Related Classes of com.adobe.epubcheck.ctc.css.EpubCSSCheckCSSHandler

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.