<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
	<id>https://wiki.theeum.com/index.php?action=history&amp;feed=atom&amp;title=Css-sanitizer</id>
	<title>Css-sanitizer - 편집 역사</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.theeum.com/index.php?action=history&amp;feed=atom&amp;title=Css-sanitizer"/>
	<link rel="alternate" type="text/html" href="https://wiki.theeum.com/index.php?title=Css-sanitizer&amp;action=history"/>
	<updated>2026-05-12T22:34:18Z</updated>
	<subtitle>이 문서의 편집 역사</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.theeum.com/index.php?title=Css-sanitizer&amp;diff=8448&amp;oldid=prev</id>
		<title>HyunJongSu: &quot;Css-sanitizer&quot; 문서를 보호했습니다 ([편집=관리자만 허용] (무기한) [이동=관리자만 허용] (무기한))</title>
		<link rel="alternate" type="text/html" href="https://wiki.theeum.com/index.php?title=Css-sanitizer&amp;diff=8448&amp;oldid=prev"/>
		<updated>2023-05-15T18:39:56Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;&lt;a href=&quot;/wiki/Css-sanitizer&quot; title=&quot;Css-sanitizer&quot;&gt;Css-sanitizer&lt;/a&gt;&amp;quot; 문서를 보호했습니다 ([편집=관리자만 허용] (무기한) [이동=관리자만 허용] (무기한))&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ko&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023년 5월 16일 (화) 03:39 판&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key eumwiki-eumwk_:diff::1.12:old-8447:rev-8448 --&gt;
&lt;/table&gt;</summary>
		<author><name>HyunJongSu</name></author>
	</entry>
	<entry>
		<id>https://wiki.theeum.com/index.php?title=Css-sanitizer&amp;diff=8447&amp;oldid=prev</id>
		<title>HyunJongSu: 새 문서: The &#039;&#039;&#039;CSS Sanitizer&#039;&#039;&#039; library implements a CSS tokenizer, parser, and grammar matcher in PHP that mostly follows the [https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/ CSS Syntax Module Level 3 candidate recommendation dated 20 February 2014], the [https://www.w3.org/TR/2016/CR-css-values-3-20160929/ CSS Values and Units Module Level 3], and the [https://www.w3.org/TR/2011/REC-css3-selectors-20110929/ CSS Selectors Level 3] grammar. It also provides a sanitizer (&lt;code&gt;[http...</title>
		<link rel="alternate" type="text/html" href="https://wiki.theeum.com/index.php?title=Css-sanitizer&amp;diff=8447&amp;oldid=prev"/>
		<updated>2023-05-15T18:38:57Z</updated>

		<summary type="html">&lt;p&gt;새 문서: The &amp;#039;&amp;#039;&amp;#039;CSS Sanitizer&amp;#039;&amp;#039;&amp;#039; library implements a CSS tokenizer, parser, and grammar matcher in PHP that mostly follows the [https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/ CSS Syntax Module Level 3 candidate recommendation dated 20 February 2014], the [https://www.w3.org/TR/2016/CR-css-values-3-20160929/ CSS Values and Units Module Level 3], and the [https://www.w3.org/TR/2011/REC-css3-selectors-20110929/ CSS Selectors Level 3] grammar. It also provides a sanitizer (&amp;lt;code&amp;gt;[http...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;#039;&amp;#039;&amp;#039;CSS Sanitizer&amp;#039;&amp;#039;&amp;#039; library implements a CSS tokenizer, parser, and grammar matcher in PHP that mostly follows the [https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/ CSS Syntax Module Level 3 candidate recommendation dated 20 February 2014], the [https://www.w3.org/TR/2016/CR-css-values-3-20160929/ CSS Values and Units Module Level 3], and the [https://www.w3.org/TR/2011/REC-css3-selectors-20110929/ CSS Selectors Level 3] grammar. It also provides a sanitizer (&amp;lt;code&amp;gt;[https://gerrit.wikimedia.org/r/plugins/gitiles/css-sanitizer/+/master/src/Sanitizer/StylePropertySanitizer.php StylePropertySanitizer]&amp;lt;/code&amp;gt;) that recognizes various [https://www.w3.org/Style/CSS/current-work CSS3 modules].&lt;br /&gt;
&lt;br /&gt;
This library was developed for use in the [[Extension:TemplateStyles|TemplateStyles]] extension for MediaWiki.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Wikimedia\CSS\Parser\Parser;&lt;br /&gt;
use Wikimedia\CSS\Sanitizer\StylesheetSanitizer;&lt;br /&gt;
&lt;br /&gt;
/** Parse a stylesheet from a string **/&lt;br /&gt;
&lt;br /&gt;
$parser = Parser::newFromString( $cssText );&lt;br /&gt;
$stylesheet = $parser-&amp;gt;parseStylesheet();&lt;br /&gt;
&lt;br /&gt;
/** Report any parser errors **/&lt;br /&gt;
&lt;br /&gt;
foreach ( $parser-&amp;gt;getParseErrors() as list( $code, $line, $pos ) ) {&lt;br /&gt;
	// $code is a string that should be suitable as a key for an i18n library.&lt;br /&gt;
	// See errors.md for details.&lt;br /&gt;
	$error = lookupI18nMessage( &amp;quot;css-parse-error-$code&amp;quot; );&lt;br /&gt;
	echo &amp;quot;Parse error: $error at line $line character $pos\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Apply sanitization to the stylesheet **/&lt;br /&gt;
&lt;br /&gt;
// If you need to customize the defaults, copy the code of this method and&lt;br /&gt;
// modify it.&lt;br /&gt;
$sanitizer = StylesheetSanitizer::newDefault();&lt;br /&gt;
$newStylesheet = $sanitizer-&amp;gt;sanitize( $stylesheet );&lt;br /&gt;
&lt;br /&gt;
/** Report any sanitizer errors **/&lt;br /&gt;
&lt;br /&gt;
foreach ( $sanitizer-&amp;gt;getSanitizationErrors() as list( $code, $line, $pos ) ) {&lt;br /&gt;
	// $code is a string that should be suitable as a key for an i18n library.&lt;br /&gt;
	// See errors.md for details.&lt;br /&gt;
	$error = lookupI18nMessage( &amp;quot;css-sanitization-error-$code&amp;quot; );&lt;br /&gt;
	echo &amp;quot;Sanitization error: $error at line $line character $pos\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Convert the sanitized stylesheet back to text **/&lt;br /&gt;
&lt;br /&gt;
$newText = (string)$newStylesheet;&lt;br /&gt;
&lt;br /&gt;
// Or if you&amp;#039;d rather have it minified too&lt;br /&gt;
$minifiedText = Wikimedia\CSS\Util::stringify( $newStylesheet, [ &amp;#039;minify&amp;#039; =&amp;gt; true ] );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
We required a CSS sanitizer with several properties:&lt;br /&gt;
&lt;br /&gt;
* Strict parsing according to modern standards.&lt;br /&gt;
* Includes line and character position for all errors.&lt;br /&gt;
* Configurable to limit unsafe constructs such as external URL references.&lt;br /&gt;
* Errors are easily localizable.&lt;br /&gt;
&lt;br /&gt;
We could not find a library that fit these requirements, so we created one.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
{{PHPLibraryLinks&lt;br /&gt;
|name = css-sanitizer&lt;br /&gt;
|phab-callsign = CSSS&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:css-sanitizer}}&lt;br /&gt;
[[Category:PHP libraries]]&lt;/div&gt;</summary>
		<author><name>HyunJongSu</name></author>
	</entry>
</feed>