• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ECSSVersion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.helger.css.ECSSVersion的典型用法代码示例。如果您正苦于以下问题:Java ECSSVersion类的具体用法?Java ECSSVersion怎么用?Java ECSSVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ECSSVersion类属于com.helger.css包,在下文中一共展示了ECSSVersion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: matches

import com.helger.css.ECSSVersion; //导入依赖的package包/类
public boolean matches(CSSSelector selector) {
	for (ICSSSelectorMember member : selector.getAllMembers()) {
		if (member instanceof CSSSelectorSimpleMember && !((CSSSelectorSimpleMember) member).isPseudo()) {
			CSSSelectorSimpleMember simpleMember = (CSSSelectorSimpleMember) member;
			if (!matches(simpleMember)) {
				return false;
			}
		} else {
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Only simple selector members ('.class', 'name', '#id') are supported. The selector '{}' and the related declarations will be ignored.",
						selector.getAsCSSString(new CSSWriterSettings(ECSSVersion.CSS30), 0));
			}
			return false;
		}
	}
	
	return true;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:19,代码来源:PhlocCssMatchableHtmlTag.java


示例2: process

import com.helger.css.ECSSVersion; //导入依赖的package包/类
public String process( String input )
{
	CascadingStyleSheet css = CSSReader.readFromString( input, CCharset.CHARSET_UTF_8_OBJ, ECSSVersion.CSS30 );

	CascadingStyleSheet out = new CascadingStyleSheet();
	for( ICSSTopLevelRule rule : css.getAllRules() )
	{
		ICSSTopLevelRule outRule = filterRule( rule );
		if( outRule != null )
			out.addRule( outRule );
	}

	CSSWriterSettings settings = new CSSWriterSettings( ECSSVersion.CSS30, true );
	settings.setRemoveUnnecessaryCode( true );
	return new CSSWriter( settings ).getCSSAsString( out );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:17,代码来源:CssRewriter.java


示例3: testIssue

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testIssue ()
{
  // Multiple errors contained
  final IReadableResource aRes = new ClassPathResource ("testfiles/css30/bad_but_browsercompliant/issue19.css");
  assertTrue (aRes.exists ());
  final CascadingStyleSheet aCSS = CSSReader.readFromStream (aRes,
                                                             new CSSReaderSettings ().setFallbackCharset (StandardCharsets.UTF_8)
                                                                                     .setCSSVersion (ECSSVersion.CSS30)
                                                                                     .setCustomErrorHandler (new LoggingCSSParseErrorHandler ())
                                                                                     .setBrowserCompliantMode (true));
  assertNotNull (aCSS);
  if (false)
    System.out.println (new CSSWriter (ECSSVersion.CSS30).getCSSAsString (aCSS));
  assertEquals (1, aCSS.getRuleCount ());
  assertEquals (1, aCSS.getStyleRuleCount ());
}
 
开发者ID:phax,项目名称:ph-css,代码行数:18,代码来源:Issue19Test.java


示例4: isValidCSS

import com.helger.css.ECSSVersion; //导入依赖的package包/类
/**
 * Check if the passed CSS resource can be parsed without error
 *
 * @param aRes
 *        The resource to be parsed. May not be <code>null</code>.
 * @param aCharset
 *        The charset to be used for reading the CSS file. May not be
 *        <code>null</code>.
 * @param eVersion
 *        The CSS version to be used for scanning. May not be
 *        <code>null</code>.
 * @return <code>true</code> if the file can be parsed without error,
 *         <code>false</code> if not
 */
public static boolean isValidCSS (@Nonnull final IReadableResource aRes,
                                  @Nonnull final Charset aCharset,
                                  @Nonnull final ECSSVersion eVersion)
{
  ValueEnforcer.notNull (aRes, "Resource");
  ValueEnforcer.notNull (aCharset, "Charset");
  ValueEnforcer.notNull (eVersion, "Version");

  final Reader aReader = aRes.getReader (aCharset);
  if (aReader == null)
  {
    s_aLogger.warn ("Failed to open CSS reader " + aRes);
    return false;
  }
  return isValidCSS (aReader, eVersion);
}
 
开发者ID:phax,项目名称:ph-css,代码行数:31,代码来源:CSSReaderDeclarationList.java


示例5: testMargin1

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testMargin1 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.MARGIN);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("margin:1px", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (4, aSplittedDecls.size ());

  assertEquals ("margin-top:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("margin-right:1px", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("margin-bottom:1px", aSplittedDecls.get (2).getAsCSSString (CWS));
  assertEquals ("margin-left:1px", aSplittedDecls.get (3).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:20,代码来源:CSSShortHandDescriptorTest.java


示例6: readFromStyleAttributeWithVisitor

import com.helger.css.ECSSVersion; //导入依赖的package包/类
public static void readFromStyleAttributeWithVisitor ()
{
  final String sStyle = "color:red; background:fixed !important";
  final CSSDeclarationList aDeclList = CSSReaderDeclarationList.readFromString (sStyle, ECSSVersion.CSS30);
  if (aDeclList == null)
    throw new IllegalStateException ("Failed to parse CSS: " + sStyle);
  // Create a custom visitor
  final ICSSVisitor aVisitor = new DefaultCSSVisitor ()
  {
    @Override
    public void onDeclaration (@Nonnull final CSSDeclaration aDeclaration)
    {
      System.out.println (aDeclaration.getProperty () +
                          ": " +
                          aDeclaration.getExpression ().getAsCSSString (new CSSWriterSettings (ECSSVersion.CSS30)) +
                          (aDeclaration.isImportant () ? " (important)" : " (not important)"));
    }
  };
  CSSVisitor.visitAllDeclarations (aDeclList, aVisitor);
}
 
开发者ID:phax,项目名称:ph-css,代码行数:21,代码来源:WikiVisitFromHtml.java


示例7: testPadding1

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testPadding1 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.PADDING);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("padding:1px", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (4, aSplittedDecls.size ());

  assertEquals ("padding-top:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("padding-right:1px", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("padding-bottom:1px", aSplittedDecls.get (2).getAsCSSString (CWS));
  assertEquals ("padding-left:1px", aSplittedDecls.get (3).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:20,代码来源:CSSShortHandDescriptorTest.java


示例8: testBorder3b

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testBorder3b ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.BORDER);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("border:red 1px dashed", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (3, aSplittedDecls.size ());
  assertEquals ("border-color:red", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("border-width:1px", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("border-style:dashed", aSplittedDecls.get (2).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:18,代码来源:CSSShortHandDescriptorTest.java


示例9: testBorder1

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testBorder1 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.BORDER);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("border:1px", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (3, aSplittedDecls.size ());
  assertEquals ("border-width:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("border-style:solid", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("border-color:black", aSplittedDecls.get (2).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:18,代码来源:CSSShortHandDescriptorTest.java


示例10: isValidCSS

import com.helger.css.ECSSVersion; //导入依赖的package包/类
/**
 * Check if the passed CSS resource can be parsed without error
 *
 * @param aRes
 *        The resource to be parsed. May not be <code>null</code>.
 * @param aFallbackCharset
 *        The charset to be used for reading the CSS file in case neither a
 *        <code>@charset</code> rule nor a BOM is present. May not be
 *        <code>null</code>.
 * @param eVersion
 *        The CSS version to be used for scanning. May not be
 *        <code>null</code>.
 * @return <code>true</code> if the file can be parsed without error,
 *         <code>false</code> if not
 */
public static boolean isValidCSS (@Nonnull final IReadableResource aRes,
                                  @Nonnull final Charset aFallbackCharset,
                                  @Nonnull final ECSSVersion eVersion)
{
  ValueEnforcer.notNull (aRes, "Resource");
  ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
  ValueEnforcer.notNull (eVersion, "Version");

  final Reader aReader = aRes.getReader (aFallbackCharset);
  if (aReader == null)
  {
    s_aLogger.warn ("Failed to open CSS reader " + aRes);
    return false;
  }
  return isValidCSS (aReader, eVersion);
}
 
开发者ID:phax,项目名称:ph-css,代码行数:32,代码来源:CSSReader.java


示例11: testWriteCertainRules

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testWriteCertainRules ()
{
  final CSSWriterSettings aSettings = new CSSWriterSettings (ECSSVersion.CSS30, true);
  aSettings.setWriteFontFaceRules (false);
  aSettings.setWriteKeyframesRules (false);
  aSettings.setWriteMediaRules (false);
  aSettings.setWritePageRules (false);
  final CSSWriter aWriter = new CSSWriter (aSettings).setWriteHeaderText (false);

  // Some non-special rules
  CascadingStyleSheet aCSS = CSSReader.readFromString (CSS3, ECSSVersion.CSS30);
  assertNotNull (aCSS);
  assertEquals ("h1{color:red;margin:1px}h2{color:rgb(1,2,3)}h3{}", aWriter.getCSSAsString (aCSS));

  // Only @media rule
  aCSS = CSSReader.readFromString (CSS4, ECSSVersion.CSS30);
  assertNotNull (aCSS);
  assertEquals ("", aWriter.getCSSAsString (aCSS));

  // Nothing special
  aCSS = CSSReader.readFromString (CSS5, ECSSVersion.CSS30);
  assertNotNull (aCSS);
  assertEquals ("h1{color:red;margin:1px}h2{color:red;margin:1px}", aWriter.getCSSAsString (aCSS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:26,代码来源:CSSWriterTest.java


示例12: testReadSingleLineComments

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testReadSingleLineComments ()
{
  final ECSSVersion eVersion = ECSSVersion.CSS30;
  final Charset aCharset = StandardCharsets.UTF_8;
  final File aFile = new File ("src/test/resources/testfiles/css30/good/artificial/test-singleline-comments.css");
  final CascadingStyleSheet aCSS = CSSReader.readFromFile (aFile, aCharset, eVersion);
  assertNotNull (aCSS);
  assertEquals (13, aCSS.getRuleCount ());
  assertEquals (13, aCSS.getStyleRuleCount ());

  // #any1 - #any5
  assertEquals (2, aCSS.getStyleRuleAtIndex (1).getDeclarationCount ());
  assertEquals (1, aCSS.getStyleRuleAtIndex (2).getDeclarationCount ());
  assertEquals (1, aCSS.getStyleRuleAtIndex (3).getDeclarationCount ());
  assertEquals (0, aCSS.getStyleRuleAtIndex (4).getDeclarationCount ());
  assertEquals (0, aCSS.getStyleRuleAtIndex (5).getDeclarationCount ());
  // .test1 - .test7
  assertEquals (2, aCSS.getStyleRuleAtIndex (6).getDeclarationCount ());
  assertEquals (3, aCSS.getStyleRuleAtIndex (7).getDeclarationCount ());
  assertEquals (1, aCSS.getStyleRuleAtIndex (8).getDeclarationCount ());
  assertEquals (1, aCSS.getStyleRuleAtIndex (9).getDeclarationCount ());
  assertEquals (2, aCSS.getStyleRuleAtIndex (10).getDeclarationCount ());
  assertEquals (2, aCSS.getStyleRuleAtIndex (11).getDeclarationCount ());
  assertEquals (1, aCSS.getStyleRuleAtIndex (12).getDeclarationCount ());
}
 
开发者ID:phax,项目名称:ph-css,代码行数:27,代码来源:CSSReader30SpecialFuncTest.java


示例13: testPadding2

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testPadding2 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.PADDING);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("padding:1px 3px", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (4, aSplittedDecls.size ());

  assertEquals ("padding-top:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("padding-right:3px", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("padding-bottom:1px", aSplittedDecls.get (2).getAsCSSString (CWS));
  assertEquals ("padding-left:3px", aSplittedDecls.get (3).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:20,代码来源:CSSShortHandDescriptorTest.java


示例14: testMargin2

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testMargin2 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.MARGIN);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("margin:1px 3px", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (4, aSplittedDecls.size ());

  assertEquals ("margin-top:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("margin-right:3px", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("margin-bottom:1px", aSplittedDecls.get (2).getAsCSSString (CWS));
  assertEquals ("margin-left:3px", aSplittedDecls.get (3).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:20,代码来源:CSSShortHandDescriptorTest.java


示例15: writeCSS30

import com.helger.css.ECSSVersion; //导入依赖的package包/类
/**
 * Write a CSS 3.0 declaration to a file using UTF-8 encoding.
 *
 * @param aCSS
 *        The CSS to be written to a file. May not be <code>null</code>.
 * @param aFile
 *        The file to be written. May not be <code>null</code>.
 * @return {@link ESuccess#SUCCESS} if everything went okay, and
 *         {@link ESuccess#FAILURE} if an error occurred
 */
public ESuccess writeCSS30 (final CascadingStyleSheet aCSS, final File aFile)
{
  // 1.param: version to write
  // 2.param: false== non-optimized output
  final CSSWriterSettings aSettings = new CSSWriterSettings (ECSSVersion.CSS30, false);
  try
  {
    final CSSWriter aWriter = new CSSWriter (aSettings);
    // Write the @charset rule: (optional)
    aWriter.setContentCharset (StandardCharsets.UTF_8.name ());
    // Write a nice file header
    aWriter.setHeaderText ("This file was generated by phloc-css\nGrab a copy at http://code.google.com/p/phloc-css");
    // Convert the CSS to a String
    final String sCSSCode = aWriter.getCSSAsString (aCSS);
    // Finally write the String to a file
    return SimpleFileIO.writeFile (aFile, sCSSCode, StandardCharsets.UTF_8);
  }
  catch (final Exception ex)
  {
    s_aLogger.error ("Failed to write the CSS to a file", ex);
    return ESuccess.FAILURE;
  }
}
 
开发者ID:phax,项目名称:ph-css,代码行数:34,代码来源:WikiWriteCSS.java


示例16: testBorderColor1

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testBorderColor1 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.BORDER_COLOR);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("border-color: red", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (4, aSplittedDecls.size ());
  assertEquals ("border-top-color:red", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("border-right-color:red", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("border-bottom-color:red", aSplittedDecls.get (2).getAsCSSString (CWS));
  assertEquals ("border-left-color:red", aSplittedDecls.get (3).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:19,代码来源:CSSShortHandDescriptorTest.java


示例17: testMargin3

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testMargin3 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.MARGIN);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("margin:1px 3px 5px", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (4, aSplittedDecls.size ());

  assertEquals ("margin-top:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("margin-right:3px", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("margin-bottom:5px", aSplittedDecls.get (2).getAsCSSString (CWS));
  assertEquals ("margin-left:3px", aSplittedDecls.get (3).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:20,代码来源:CSSShortHandDescriptorTest.java


示例18: testBorder2

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void testBorder2 ()
{
  final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.BORDER);
  assertNotNull (aSHD);

  final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("border:1px dashed", ECSSVersion.CSS30)
                                                       .getDeclarationAtIndex (0);
  assertNotNull (aDecl);

  final List <CSSDeclaration> aSplittedDecls = aSHD.getSplitIntoPieces (aDecl);
  assertNotNull (aSplittedDecls);
  assertEquals (3, aSplittedDecls.size ());
  assertEquals ("border-width:1px", aSplittedDecls.get (0).getAsCSSString (CWS));
  assertEquals ("border-style:dashed", aSplittedDecls.get (1).getAsCSSString (CWS));
  assertEquals ("border-color:black", aSplittedDecls.get (2).getAsCSSString (CWS));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:18,代码来源:CSSShortHandDescriptorTest.java


示例19: parseToMediaQuery

import com.helger.css.ECSSVersion; //导入依赖的package包/类
/**
 * Utility method to convert a media query string to a structured list of
 * {@link CSSMediaQuery} objects.
 *
 * @param sMediaQuery
 *        The media query string to parse. May be <code>null</code>.
 * @param eVersion
 *        The CSS version to use. May not be <code>null</code>.
 * @return <code>null</code> if the passed media query is <code>null</code> or
 *         empty or not parsable.
 */
@Nullable
public static ICommonsList <CSSMediaQuery> parseToMediaQuery (@Nullable final String sMediaQuery,
                                                              @Nonnull final ECSSVersion eVersion)
{
  if (StringHelper.hasNoText (sMediaQuery))
    return null;

  final String sCSS = "@media " + sMediaQuery + " {}";
  final CascadingStyleSheet aCSS = CSSReader.readFromString (sCSS, eVersion);
  if (aCSS == null)
    return null;

  final CSSMediaRule aMediaRule = aCSS.getAllMediaRules ().get (0);
  return aMediaRule.getAllMediaQueries ();
}
 
开发者ID:phax,项目名称:ph-css,代码行数:27,代码来源:MediaQueryTools.java


示例20: test2

import com.helger.css.ECSSVersion; //导入依赖的package包/类
@Test
public void test2 () throws ParseException
{
  final ParserCSS30TokenManager aTokenHdl = new ParserCSS30TokenManager (new CSSCharStream (new NonBlockingStringReader (CSS2)));
  aTokenHdl.setDebugStream (System.out);
  final ParserCSS30 aParser = new ParserCSS30 (aTokenHdl);
  aParser.disable_tracing ();
  final CSSNode aNode = aParser.styleSheet ();
  assertNotNull (aNode);

  final CascadingStyleSheet aCSS = CSSHandler.readCascadingStyleSheetFromNode (ECSSVersion.CSS30,
                                                                               aNode,
                                                                               CSSReader.getDefaultInterpretErrorHandler ());
  assertNotNull (aCSS);

  for (final ICSSTopLevelRule aTopLevelRule : aCSS.getAllFontFaceRules ())
    assertTrue (aCSS.removeRule (aTopLevelRule).isChanged ());
}
 
开发者ID:phax,项目名称:ph-css,代码行数:19,代码来源:ParserCSS30Test.java



注:本文中的com.helger.css.ECSSVersion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UnboundedFifoBuffer类代码示例发布时间:2022-05-22
下一篇:
Java MultiPolygon类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap