Skip to content

refactor: centralize regex patterns in dedicated module#341

Merged
rochacbruno merged 1 commit intomainfrom
feat/centralized-regex-patterns
Aug 16, 2025
Merged

refactor: centralize regex patterns in dedicated module#341
rochacbruno merged 1 commit intomainfrom
feat/centralized-regex-patterns

Conversation

@rochacbruno
Copy link
Copy Markdown
Owner

Summary

  • Created src/re.rs module containing all regex pattern constants
  • Replaced hardcoded regex patterns across the codebase with centralized constants
  • Added comprehensive documentation for each pattern

Changes

  • New file: src/re.rs - Contains 14 regex pattern constants with documentation
  • Updated modules:
    • src/site.rs - HTML/template tag patterns
    • src/parser.rs - Link and heading extraction patterns
    • src/shortcodes.rs - Shortcode and macro patterns
    • src/content.rs - Date, stream, and slugify patterns
    • src/main.rs - Added module declaration

Benefits

  • Maintainability: All regex patterns in one place
  • Documentation: Each pattern has clear comments explaining its purpose
  • Consistency: Ensures patterns are used consistently across the codebase
  • Readability: Descriptive constant names make code more self-documenting

Test plan

  • All existing tests pass
  • cargo test - 220 tests pass
  • mask fmt - Code formatted
  • mask check - No clippy warnings
  • mask pedantic - No pedantic warnings

@rochacbruno rochacbruno force-pushed the feat/centralized-regex-patterns branch from 6c419b3 to dfac881 Compare August 16, 2025 19:46
- Create src/re.rs with all regex pattern constants
- Add comprehensive documentation for each pattern
- Replace hardcoded regex patterns across codebase
- Update imports in affected modules (site, parser, shortcodes, content)
- Improve maintainability by centralizing pattern definitions

This refactoring makes regex patterns easier to maintain and understand,
with each pattern having a descriptive constant name and documentation
explaining its purpose and format.
@rochacbruno rochacbruno force-pushed the feat/centralized-regex-patterns branch from dfac881 to e9d517d Compare August 16, 2025 19:48
@rochacbruno rochacbruno merged commit 3176ff7 into main Aug 16, 2025
3 checks passed
@rochacbruno rochacbruno deleted the feat/centralized-regex-patterns branch August 16, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant