poe-css 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +186 -0
- data/.ruby-version +1 -0
- data/CONTRIBUTING.md +85 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +105 -0
- data/LICENSE.txt +22 -0
- data/README.md +275 -0
- data/Rakefile +10 -0
- data/bin/poe-css +14 -0
- data/demo/Gemfile +11 -0
- data/demo/Gemfile.lock +45 -0
- data/demo/app.rb +21 -0
- data/demo/views/index.haml +105 -0
- data/lib/dependencies.rb +11 -0
- data/lib/poe-css.rb +253 -0
- data/lib/poe-css/generator.rb +108 -0
- data/lib/poe-css/parser.rb +177 -0
- data/lib/poe-css/preprocessor.rb +186 -0
- data/lib/poe-css/simplifier.rb +201 -0
- data/lib/poe-css/version.rb +5 -0
- data/poe-css.gemspec +32 -0
- data/tests/poecss/all-clauses-1.output +23 -0
- data/tests/poecss/all-clauses-1.poecss +24 -0
- data/tests/poecss/alternation-1.output +8 -0
- data/tests/poecss/alternation-1.poecss +4 -0
- data/tests/poecss/nesting-1.output +8 -0
- data/tests/poecss/nesting-1.poecss +8 -0
- data/tests/poecss/nesting-2.output +30 -0
- data/tests/poecss/nesting-2.poecss +23 -0
- data/tests/poecss/nesting-3.output +15 -0
- data/tests/poecss/nesting-3.poecss +15 -0
- data/tests/poecss/nesting-4.output +14 -0
- data/tests/poecss/nesting-4.poecss +13 -0
- data/tests/poecss/performance-1.output +3 -0
- data/tests/poecss/performance-1.poecss +59 -0
- data/tests/poecss/performance-2.output +60 -0
- data/tests/poecss/performance-2.poecss +75 -0
- data/tests/poecss/rule-ordering-1.output +25 -0
- data/tests/poecss/rule-ordering-1.poecss +30 -0
- data/tests/poecss/rule-ordering-2.output +3 -0
- data/tests/poecss/rule-ordering-2.poecss +29 -0
- data/tests/poecss/rule-ordering-3.output +30 -0
- data/tests/poecss/rule-ordering-3.poecss +29 -0
- data/tests/poecss/rule-ordering-4.output +20 -0
- data/tests/poecss/rule-ordering-4.poecss +30 -0
- data/tests/poecss/rule-ordering-5.output +8 -0
- data/tests/poecss/rule-ordering-5.poecss +9 -0
- data/tests/poecss/rule-ordering-6.output +7 -0
- data/tests/poecss/rule-ordering-6.poecss +14 -0
- data/tests/poecss/simple-1.output +7 -0
- data/tests/poecss/simple-1.poecss +8 -0
- data/tests/poecss/simplification-1.output +6 -0
- data/tests/poecss/simplification-1.poecss +7 -0
- data/tests/poecss/simplification-2.output +6 -0
- data/tests/poecss/simplification-2.poecss +8 -0
- data/tests/poecss/simplification-3.output +2 -0
- data/tests/poecss/simplification-3.poecss +3 -0
- data/tests/poecss/simplification-4.output +3 -0
- data/tests/poecss/simplification-4.poecss +4 -0
- data/tests/poecss/simplification-5.output +3 -0
- data/tests/poecss/simplification-5.poecss +8 -0
- data/tests/poecss/simplification-6.output +2 -0
- data/tests/poecss/simplification-6.poecss +4 -0
- data/tests/preprocessor/arity-mismatch-1.error.preprocessor +4 -0
- data/tests/preprocessor/arity-mismatch-2.error.preprocessor +4 -0
- data/tests/preprocessor/complex.output +20 -0
- data/tests/preprocessor/complex.preprocessor +19 -0
- data/tests/preprocessor/empty.output +0 -0
- data/tests/preprocessor/empty.preprocessor +0 -0
- data/tests/preprocessor/macro-newlines.output +5 -0
- data/tests/preprocessor/macro-newlines.preprocessor +9 -0
- data/tests/preprocessor/macro.output +3 -0
- data/tests/preprocessor/macro.preprocessor +7 -0
- data/tests/preprocessor/missing-identifier-1.error.preprocessor +1 -0
- data/tests/preprocessor/missing-identifier-2.error.preprocessor +1 -0
- data/tests/preprocessor/normal-newlines.output +2 -0
- data/tests/preprocessor/normal-newlines.preprocessor +2 -0
- data/tests/preprocessor/parse-error-1.error.preprocessor +1 -0
- data/tests/preprocessor/parse-error-2.error.preprocessor +1 -0
- data/tests/preprocessor/parse-error-3.error.preprocessor +4 -0
- data/tests/preprocessor/simple.output +1 -0
- data/tests/preprocessor/simple.preprocessor +3 -0
- data/tests/run-all-tests.rb +60 -0
- data/tests/unit/simplify-bounds-test.rb +57 -0
- data/tests/unit/stricter-query-test.rb +24 -0
- metadata +292 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b354fe9096a347a375766d95be283aa4a8bc756
|
4
|
+
data.tar.gz: f5881993fa54ab9a20cb8b59e5d1cc05af2b720f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca625c6f6361c2248aaf62df0613c9860722d45b0837e5fe376af61c0fe2ef39c393058840d88a529f71b55b6ad6ca5f72a099ecd908799cab70983ea5324148
|
7
|
+
data.tar.gz: 5fba14481d64fc611b19ef0c5e47c966382a1fb3b7e5b58b45f73b9a8df74266ed566e63706f2299125c76540528d3b1298d83f012fda91b37426dc4c76f6508
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
AllCops:
|
2
|
+
CacheRootDirectory: .rubocop-cache
|
3
|
+
TargetRubyVersion: 2.4.2
|
4
|
+
|
5
|
+
Layout/AlignParameters:
|
6
|
+
EnforcedStyle: with_fixed_indentation
|
7
|
+
|
8
|
+
Layout/EmptyLinesAroundArguments:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Layout/FirstArrayElementLineBreak:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
Layout/FirstHashElementLineBreak:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Layout/FirstMethodArgumentLineBreak:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
Layout/FirstMethodParameterLineBreak:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Layout/IndentArray:
|
24
|
+
EnforcedStyle: consistent
|
25
|
+
|
26
|
+
Layout/IndentHash:
|
27
|
+
EnforcedStyle: consistent
|
28
|
+
|
29
|
+
Layout/MultilineMethodCallIndentation:
|
30
|
+
EnforcedStyle: indented
|
31
|
+
|
32
|
+
Layout/MultilineOperationIndentation:
|
33
|
+
EnforcedStyle: indented
|
34
|
+
|
35
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
36
|
+
EnforcedStyle: no_space
|
37
|
+
|
38
|
+
Layout/SpaceAroundOperators:
|
39
|
+
AllowForAlignment: false
|
40
|
+
|
41
|
+
Layout/SpaceBeforeBlockBraces:
|
42
|
+
EnforcedStyleForEmptyBraces: space
|
43
|
+
EnforcedStyle: space
|
44
|
+
|
45
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
46
|
+
Enabled: true
|
47
|
+
EnforcedStyle: space
|
48
|
+
|
49
|
+
Layout/SpaceInsideHashLiteralBraces:
|
50
|
+
EnforcedStyle: space
|
51
|
+
|
52
|
+
Lint/AssignmentInCondition:
|
53
|
+
AllowSafeAssignment: true
|
54
|
+
|
55
|
+
Metrics/AbcSize:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Metrics/BlockLength:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Metrics/BlockNesting:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Metrics/ClassLength:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Metrics/CyclomaticComplexity:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Metrics/LineLength:
|
71
|
+
Max: 150
|
72
|
+
|
73
|
+
Metrics/MethodLength:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Metrics/ModuleLength:
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
Metrics/ParameterLists:
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
Metrics/PerceivedComplexity:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Naming/FileName:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Naming/VariableNumber:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Performance/Casecmp:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Performance/Count:
|
95
|
+
SafeMode: false
|
96
|
+
|
97
|
+
Performance/Detect:
|
98
|
+
SafeMode: false
|
99
|
+
|
100
|
+
Style/Alias:
|
101
|
+
EnforcedStyle: prefer_alias_method
|
102
|
+
|
103
|
+
Style/AsciiComments:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
Style/AutoResourceCleanup:
|
107
|
+
Enabled: true
|
108
|
+
|
109
|
+
Style/BlockDelimiters:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
Style/BracesAroundHashParameters:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
Style/CollectionMethods:
|
116
|
+
PreferredMethods:
|
117
|
+
detect: find
|
118
|
+
|
119
|
+
Style/CommentAnnotation:
|
120
|
+
Enabled: false
|
121
|
+
|
122
|
+
Style/Documentation:
|
123
|
+
Enabled: false
|
124
|
+
|
125
|
+
Style/DoubleNegation:
|
126
|
+
Enabled: false
|
127
|
+
|
128
|
+
Style/FormatStringToken:
|
129
|
+
Enabled: false
|
130
|
+
|
131
|
+
Style/GuardClause:
|
132
|
+
Enabled: false
|
133
|
+
|
134
|
+
Style/IfUnlessModifier:
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
Style/InverseMethods:
|
138
|
+
Enabled: false
|
139
|
+
|
140
|
+
Style/MethodCallWithoutArgsParentheses:
|
141
|
+
Enabled: false
|
142
|
+
|
143
|
+
Style/MultilineBlockChain:
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
Style/MutableConstant:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
Style/NegatedIf:
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Style/NegatedWhile:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Style/Next:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Style/NumericPredicate:
|
159
|
+
EnforcedStyle: comparison
|
160
|
+
|
161
|
+
Style/OptionHash:
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
Style/SignalException:
|
165
|
+
Enabled: false
|
166
|
+
|
167
|
+
Style/SingleLineBlockParams:
|
168
|
+
Enabled: false
|
169
|
+
|
170
|
+
Style/StringMethods:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Style/SymbolArray:
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
Style/TernaryParentheses:
|
177
|
+
Enabled: false
|
178
|
+
|
179
|
+
Style/TrailingCommaInArguments:
|
180
|
+
EnforcedStyleForMultiline: no_comma
|
181
|
+
|
182
|
+
Style/TrailingCommaInLiteral:
|
183
|
+
EnforcedStyleForMultiline: no_comma
|
184
|
+
|
185
|
+
Style/WhileUntilModifier:
|
186
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.2
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
When contributing to this repository, please first discuss the change you wish to make via issue,
|
4
|
+
email, or any other method with the owners of this repository before making a change.
|
5
|
+
|
6
|
+
Please note we have a code of conduct. Please follow it in all your interactions with the project.
|
7
|
+
|
8
|
+
## Pull Request Process
|
9
|
+
|
10
|
+
Before merging, ensure that tests are passing (`bundle exec rake`) and that Rubocop is happy (`bundle exec rubocop`). If you are adding new features, please make sure they are tested.
|
11
|
+
|
12
|
+
## Code of Conduct
|
13
|
+
|
14
|
+
### Our Pledge
|
15
|
+
|
16
|
+
In the interest of fostering an open and welcoming environment, we as
|
17
|
+
contributors and maintainers pledge to making participation in our project and
|
18
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
19
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
20
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
21
|
+
orientation.
|
22
|
+
|
23
|
+
### Our Standards
|
24
|
+
|
25
|
+
Examples of behavior that contributes to creating a positive environment
|
26
|
+
include:
|
27
|
+
|
28
|
+
* Using welcoming and inclusive language
|
29
|
+
* Being respectful of differing viewpoints and experiences
|
30
|
+
* Gracefully accepting constructive criticism
|
31
|
+
* Focusing on what is best for the community
|
32
|
+
* Showing empathy towards other community members
|
33
|
+
|
34
|
+
Examples of unacceptable behavior by participants include:
|
35
|
+
|
36
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
37
|
+
advances
|
38
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
39
|
+
* Public or private harassment
|
40
|
+
* Publishing others' private information, such as a physical or electronic
|
41
|
+
address, without explicit permission
|
42
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
43
|
+
professional setting
|
44
|
+
|
45
|
+
### Our Responsibilities
|
46
|
+
|
47
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
48
|
+
behavior and are expected to take appropriate and fair corrective action in
|
49
|
+
response to any instances of unacceptable behavior.
|
50
|
+
|
51
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
52
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
53
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
54
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
55
|
+
threatening, offensive, or harmful.
|
56
|
+
|
57
|
+
### Scope
|
58
|
+
|
59
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
60
|
+
when an individual is representing the project or its community. Examples of
|
61
|
+
representing a project or community include using an official project e-mail
|
62
|
+
address, posting via an official social media account, or acting as an appointed
|
63
|
+
representative at an online or offline event. Representation of a project may be
|
64
|
+
further defined and clarified by project maintainers.
|
65
|
+
|
66
|
+
### Enforcement
|
67
|
+
|
68
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
69
|
+
reported by contacting alexhquach@gmail.com. All complaints will be reviewed
|
70
|
+
and investigated and will result in a response that is deemed necessary and
|
71
|
+
appropriate to the circumstances. The project team is obligated to maintain
|
72
|
+
confidentiality with regard to the reporter of an incident. Further details of
|
73
|
+
specific enforcement policies may be posted separately.
|
74
|
+
|
75
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
76
|
+
faith may face temporary or permanent repercussions as determined by other
|
77
|
+
members of the project's leadership.
|
78
|
+
|
79
|
+
### Attribution
|
80
|
+
|
81
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
82
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
83
|
+
|
84
|
+
[homepage]: http://contributor-covenant.org
|
85
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
poe-css (0.0.1)
|
5
|
+
parslet
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ansi (1.5.0)
|
11
|
+
ast (2.3.0)
|
12
|
+
binding.repl (3.0.0)
|
13
|
+
builder (3.2.3)
|
14
|
+
cd (1.0.1)
|
15
|
+
clipboard (1.1.1)
|
16
|
+
code (0.9.2)
|
17
|
+
coderay (~> 1.1)
|
18
|
+
method_source (~> 0.9)
|
19
|
+
coderay (1.1.2)
|
20
|
+
debugging (1.1.1)
|
21
|
+
binding.repl (~> 3.0)
|
22
|
+
paint (>= 0.9, < 3.0)
|
23
|
+
every_day_irb (2.0.0)
|
24
|
+
cd (~> 1.0)
|
25
|
+
fancy_irb (1.1.0)
|
26
|
+
paint (>= 0.9, < 3.0)
|
27
|
+
unicode-display_width (~> 1.1)
|
28
|
+
ffi (1.9.18)
|
29
|
+
hirb (0.7.3)
|
30
|
+
instance (0.2.0)
|
31
|
+
interactive_editor (0.0.10)
|
32
|
+
spoon (>= 0.0.1)
|
33
|
+
irbtools (2.1.0)
|
34
|
+
binding.repl (~> 3.0)
|
35
|
+
clipboard (~> 1.1)
|
36
|
+
code (~> 0.9)
|
37
|
+
coderay (~> 1.1)
|
38
|
+
debugging (~> 1.1)
|
39
|
+
every_day_irb (~> 2.0)
|
40
|
+
fancy_irb (~> 1.1)
|
41
|
+
hirb (~> 0.7, >= 0.7.3)
|
42
|
+
instance (~> 0.2)
|
43
|
+
interactive_editor (~> 0.0, >= 0.0.10)
|
44
|
+
method_locator (~> 0.0, >= 0.0.4)
|
45
|
+
methodfinder (~> 2.0)
|
46
|
+
ori (~> 0.1.0)
|
47
|
+
os (~> 1.0)
|
48
|
+
paint (>= 0.9, < 3.0)
|
49
|
+
ruby_engine (~> 1.0)
|
50
|
+
ruby_info (~> 1.0)
|
51
|
+
ruby_version (~> 1.0)
|
52
|
+
wirb (~> 2.0)
|
53
|
+
method_locator (0.0.4)
|
54
|
+
method_source (0.9.0)
|
55
|
+
methodfinder (2.1.0)
|
56
|
+
minitest (5.10.3)
|
57
|
+
minitest-reporters (1.1.18)
|
58
|
+
ansi
|
59
|
+
builder
|
60
|
+
minitest (>= 5.0)
|
61
|
+
ruby-progressbar
|
62
|
+
ori (0.1.0)
|
63
|
+
os (1.0.0)
|
64
|
+
paint (1.0.1)
|
65
|
+
parallel (1.12.1)
|
66
|
+
parser (2.4.0.2)
|
67
|
+
ast (~> 2.3)
|
68
|
+
parslet (1.8.1)
|
69
|
+
powerpack (0.1.1)
|
70
|
+
rainbow (3.0.0)
|
71
|
+
rake (10.5.0)
|
72
|
+
rubocop (0.52.0)
|
73
|
+
parallel (~> 1.10)
|
74
|
+
parser (>= 2.4.0.2, < 3.0)
|
75
|
+
powerpack (~> 0.1)
|
76
|
+
rainbow (>= 2.2.2, < 4.0)
|
77
|
+
ruby-progressbar (~> 1.7)
|
78
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
79
|
+
ruby-progressbar (1.9.0)
|
80
|
+
ruby_engine (1.0.1)
|
81
|
+
ruby_info (1.0.1)
|
82
|
+
ruby_version (1.0.1)
|
83
|
+
spoon (0.0.6)
|
84
|
+
ffi
|
85
|
+
unicode-display_width (1.3.0)
|
86
|
+
wirb (2.1.1)
|
87
|
+
paint (>= 0.9, < 3.0)
|
88
|
+
|
89
|
+
PLATFORMS
|
90
|
+
ruby
|
91
|
+
|
92
|
+
DEPENDENCIES
|
93
|
+
bundler (~> 1.14)
|
94
|
+
irbtools
|
95
|
+
minitest
|
96
|
+
minitest-reporters
|
97
|
+
poe-css!
|
98
|
+
rake (~> 10.0)
|
99
|
+
rubocop
|
100
|
+
|
101
|
+
RUBY VERSION
|
102
|
+
ruby 2.4.2p198
|
103
|
+
|
104
|
+
BUNDLED WITH
|
105
|
+
1.15.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Alex Quach
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,275 @@
|
|
1
|
+
# PoE CSS
|
2
|
+
|
3
|
+
A better way to write item filters for Path of Exile.
|
4
|
+
|
5
|
+
Example:
|
6
|
+
|
7
|
+
```
|
8
|
+
@black: RGB(0, 0, 0)
|
9
|
+
@white: RGB(255, 255, 255)
|
10
|
+
|
11
|
+
@t1-gem-text-color: RGB(30, 200, 200)
|
12
|
+
@t1-gem-border-color: RGB(30, 150, 180)
|
13
|
+
@t1-gem-bg-color: @white
|
14
|
+
|
15
|
+
@volume: 300
|
16
|
+
@t1-drop-sound: 6 @volume
|
17
|
+
@unique-drop-sound: 3 @volume
|
18
|
+
@value-drop-sound: 2 @volume
|
19
|
+
|
20
|
+
@gem-styling() {
|
21
|
+
SetTextColor @t1-gem-text-color
|
22
|
+
SetBorderColor @t1-gem-border-color
|
23
|
+
}
|
24
|
+
|
25
|
+
Class Gems {
|
26
|
+
Hide
|
27
|
+
SetFontSize 36
|
28
|
+
SetBorderColor @black
|
29
|
+
|
30
|
+
Quality >= 1 {
|
31
|
+
Show
|
32
|
+
SetFontSize 40
|
33
|
+
SetBorderColor @t1-gem-border-color
|
34
|
+
}
|
35
|
+
|
36
|
+
BaseType "Detonate Mines" "Added Chaos Damage" "Vaal" "Enhance" | Quality >= 14 {
|
37
|
+
Show
|
38
|
+
SetFontSize 40
|
39
|
+
@gem-styling()
|
40
|
+
PlayAlertSound @value-drop-sound
|
41
|
+
}
|
42
|
+
|
43
|
+
BaseType "Portal" "Empower" "Enlighten" "Vaal Haste" "Vaal Grace" "Item Quantity" "Vaal Breach" {
|
44
|
+
Show
|
45
|
+
SetFontSize 45
|
46
|
+
@gem-styling()
|
47
|
+
PlayAlertSound @unique-drop-sound
|
48
|
+
}
|
49
|
+
}
|
50
|
+
```
|
51
|
+
|
52
|
+
Via the website or the command line tool, filters written in PoE CSS can be
|
53
|
+
transpiled into the native item filter language and plugged right into Path of
|
54
|
+
Exile.
|
55
|
+
|
56
|
+
### Features
|
57
|
+
|
58
|
+
* CSS-style semantics: multiple clauses can match any item, rather than just the first match in the base filter language.
|
59
|
+
* Constants
|
60
|
+
* Macro expansion
|
61
|
+
* Nested and OR matches
|
62
|
+
|
63
|
+
## Getting Started
|
64
|
+
|
65
|
+
`poe-css` is available online at LINK and as a command line utility. Both
|
66
|
+
transform PoE CSS filters into standard item filters that can be plugged into
|
67
|
+
Path of Exile. **PoE CSS filters are not directly compatible with Path of Exile**.
|
68
|
+
Below are instructions for installing the command line tool.
|
69
|
+
|
70
|
+
## Syntax
|
71
|
+
|
72
|
+
It's likely easiest to get a sense of the syntax by looking at the example
|
73
|
+
above. It should be familiar to anyone comfortable with Path of Exile's item
|
74
|
+
filter language as well as people comfortable with CSS/LESS/SASS.
|
75
|
+
|
76
|
+
First, everything in PoE CSS is case-insensitive.
|
77
|
+
|
78
|
+
A PoE CSS file is a list of clauses. A clause generally looks like this:
|
79
|
+
|
80
|
+
```
|
81
|
+
<list of matches, comma separated> {
|
82
|
+
<commands>
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
86
|
+
For example,
|
87
|
+
|
88
|
+
```
|
89
|
+
ItemLevel >= 25 {
|
90
|
+
Show
|
91
|
+
SetFontSize 16
|
92
|
+
}
|
93
|
+
```
|
94
|
+
|
95
|
+
This clause will style any item whose item level is greater than or equal to
|
96
|
+
25. To see all possible conditions and styles, check out the [item filter
|
97
|
+
wiki](https://pathofexile.gamepedia.com/Item_filter). It's missing a few new
|
98
|
+
matches like ShapedItem though.
|
99
|
+
|
100
|
+
**To combine conditions so that all must match, use a comma**:
|
101
|
+
|
102
|
+
```
|
103
|
+
ItemLevel >= 25, Rarity Unique {
|
104
|
+
Show
|
105
|
+
SetFontSize 24
|
106
|
+
}
|
107
|
+
```
|
108
|
+
|
109
|
+
**Differently from the base item filter language, multiple clauses can match any
|
110
|
+
item, just like CSS.** To get an item's final style, PoE CSS finds all clauses
|
111
|
+
that match the given item, then combines all of their respective styles. Later
|
112
|
+
properties override earlier properties, so later clauses are generally more powerful than earlier clauses.
|
113
|
+
|
114
|
+
```
|
115
|
+
ItemLevel >= 25 {
|
116
|
+
Show
|
117
|
+
SetFontSize 25
|
118
|
+
SetBackgroundColor RGB(0, 255, 0)
|
119
|
+
}
|
120
|
+
|
121
|
+
Rarity Unique {
|
122
|
+
Show
|
123
|
+
SetBackgroundColor RGB(255, 0, 0)
|
124
|
+
}
|
125
|
+
```
|
126
|
+
|
127
|
+
ilvl >= 25 items that are not unique will have the font size change and a green
|
128
|
+
background. Unique items will have a red background. ilvl >= 25 items that are
|
129
|
+
also unique will have the font size change and a red background.
|
130
|
+
|
131
|
+
This solves a common pain point with item filters, which is that adding new
|
132
|
+
clauses is very difficult and often accidentally overrides later styles.
|
133
|
+
|
134
|
+
To match one of many conditions (OR), **use `|`**:
|
135
|
+
|
136
|
+
```
|
137
|
+
ItemLevel >= 25 | Rarity Unique {
|
138
|
+
Show
|
139
|
+
SetFontSize 24
|
140
|
+
}
|
141
|
+
```
|
142
|
+
|
143
|
+
This is identical to writing it out long form.
|
144
|
+
|
145
|
+
```
|
146
|
+
ItemLevel >= 25 {
|
147
|
+
Show
|
148
|
+
SetFontSize 24
|
149
|
+
}
|
150
|
+
|
151
|
+
Rarity Unique {
|
152
|
+
Show
|
153
|
+
SetFontSize 24
|
154
|
+
}
|
155
|
+
```
|
156
|
+
|
157
|
+
**Nested clauses** are considered to be restrictions on the parent clause.
|
158
|
+
|
159
|
+
```
|
160
|
+
ItemLevel >= 25 {
|
161
|
+
Show
|
162
|
+
SetFontSize 24
|
163
|
+
|
164
|
+
Rarity Unique {
|
165
|
+
Show
|
166
|
+
SetBackgroundColor RGB(255, 0, 0)
|
167
|
+
}
|
168
|
+
}
|
169
|
+
```
|
170
|
+
|
171
|
+
In this filter, items with ilvl >= 25 will have font size 24, and items with ilvl >= 25 and are unique will have a red background color.
|
172
|
+
|
173
|
+
Nested clauses are useful when you'd like to work within a certain constraint without repeating yourself.
|
174
|
+
|
175
|
+
```
|
176
|
+
Class "Bows" {
|
177
|
+
# All clauses in here will only match bows.
|
178
|
+
|
179
|
+
Show
|
180
|
+
|
181
|
+
ItemLevel >= 65 { SetFontSize 13 }
|
182
|
+
ItemLevel >= 70 { SetFontSize 14 }
|
183
|
+
ItemLevel >= 75 { SetFontSize 15 }
|
184
|
+
}
|
185
|
+
```
|
186
|
+
|
187
|
+
You can **define a constant with `@`**. Constants can only be defined once.
|
188
|
+
|
189
|
+
```
|
190
|
+
@rare-color: RGB(255, 255, 119)
|
191
|
+
|
192
|
+
Rarity Rare {
|
193
|
+
SetFontColor @rare-color
|
194
|
+
}
|
195
|
+
```
|
196
|
+
|
197
|
+
Constants are substituted with naive string substitution. This means anything can be made a constant.
|
198
|
+
|
199
|
+
```
|
200
|
+
@sfc: SetFontColor
|
201
|
+
|
202
|
+
Rarity Rare {
|
203
|
+
@sfc RGB(255, 0, 0)
|
204
|
+
}
|
205
|
+
```
|
206
|
+
|
207
|
+
**For multi-line substitutions or substitutions with variables, you can define macros.**
|
208
|
+
|
209
|
+
```
|
210
|
+
@ilvl-scaled() {
|
211
|
+
ItemLevel >= 65 { Show; SetFontSize 13 }
|
212
|
+
ItemLevel >= 70 { Show; SetFontSize 14 }
|
213
|
+
ItemLevel >= 75 { Show; SetFontSize 15 }
|
214
|
+
}
|
215
|
+
|
216
|
+
Class "Bows" {
|
217
|
+
Show
|
218
|
+
@ilvl-scaled()
|
219
|
+
}
|
220
|
+
|
221
|
+
Class "Maces" {
|
222
|
+
Show
|
223
|
+
@ilvl-scaled()
|
224
|
+
}
|
225
|
+
```
|
226
|
+
|
227
|
+
Macros can have arguments:
|
228
|
+
|
229
|
+
```
|
230
|
+
@hide-under(@ilvl) {
|
231
|
+
ItemLevel < @ilvl {
|
232
|
+
Hide
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
Class Shield {
|
237
|
+
@hide-under(25)
|
238
|
+
}
|
239
|
+
```
|
240
|
+
|
241
|
+
Finally, you can write comments with `#`. Anything after `#` and the `#` will be ignored.
|
242
|
+
|
243
|
+
## Prerequisites
|
244
|
+
|
245
|
+
Ruby >= 2 is necessary to install the command line tool. If you have that, just run `gem install poe-css` and then `poe-css <input file>`.
|
246
|
+
|
247
|
+
## Running the tests
|
248
|
+
|
249
|
+
`bundle exec rake`
|
250
|
+
|
251
|
+
## Built With
|
252
|
+
|
253
|
+
* [Parslet](https://kschiess.github.io/parslet/) - Ruby PEG Parser
|
254
|
+
|
255
|
+
## Contributing
|
256
|
+
|
257
|
+
Please read
|
258
|
+
[CONTRIBUTING.md](https://github.com/aquach/poe-css/blob/master/CONTRIBUTING.md)
|
259
|
+
for details on our code of conduct, and the process for submitting pull
|
260
|
+
requests to us.
|
261
|
+
|
262
|
+
## Versioning
|
263
|
+
|
264
|
+
We use [SemVer](http://semver.org/) for versioning. For the versions available,
|
265
|
+
see the [tags on this repository](https://github.com/aquach/poe-css/tags).
|
266
|
+
|
267
|
+
## Authors
|
268
|
+
|
269
|
+
* **Alex Quach** - *Initial work* - [aquach](https://github.com/aquach)
|
270
|
+
|
271
|
+
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
|
272
|
+
|
273
|
+
## License
|
274
|
+
|
275
|
+
This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details
|