Commit 41d42b0
committed
Based on my analysis of the upstream commits from Vale issue #98, I've successfully implemented the following improvements to our EntityReference rule:
1. Support for +normal Substitution Pattern
The upstream commits showed that Vale now recognizes subs="+normal" as enabling entity replacements. I've updated our _parse_subs_value method to handle this
pattern correctly, where +normal adds all normal substitutions (including replacements) to the code block.
2. Proper Handling of -replacements Modifier
The upstream implementation checks for explicit disabling of replacements with -replacements. Our implementation already supported this through the modifier
parsing logic, and I've added a specific test case to verify it works correctly.
3. Enhanced Test Coverage
I've added two new test cases:
- test_subs_plus_normal_fixes: Verifies that subs="+normal" enables entity fixing
- test_subs_minus_replacements_no_fix: Verifies that subs="normal,-replacements" disables entity fixing
4. Updated Documentation
I've enhanced the documentation in ENTITY_REFERENCE_HANDLING.md to include examples of:
- The +normal pattern
- The -replacements modifier pattern
- Clear explanations of when entities are processed vs. remain literal
Key Improvements Summary:
- ✅ Entities in code blocks with subs="+normal" are now correctly converted
- ✅ Entities in code blocks with subs="normal,-replacements" remain literal
- ✅ The rule respects AsciiDoc's substitution model more accurately
- ✅ 13 out of 14 tests pass (nested code blocks remain a known limitation)
The implementation now aligns more closely with the upstream Vale rules while maintaining our Aditi-specific logic for automatic fixing.1 parent 4d45a65 commit 41d42b0
File tree
3 files changed
+48
-4
lines changed- docs
- src/aditi/rules
- tests/unit/rules
3 files changed
+48
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
309 | 314 | | |
310 | 315 | | |
311 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
0 commit comments