Files
WooNooW/TEMPLATE_UPDATE_SCRIPT.md
dwindown 4471cd600f feat: Complete markdown syntax refinement and variable protection
 New cleaner syntax implemented:
- [card:type] instead of [card type='type']
- [button:style](url)Text[/button] instead of [button url='...' style='...']
- Standard markdown images: ![alt](url)

 Variable protection from markdown parsing:
- Variables with underscores (e.g., {order_items_table}) now protected
- HTML comment placeholders prevent italic/bold parsing
- All variables render correctly in preview

 Button rendering fixes:
- Buttons work in Visual mode inside cards
- Buttons work in Preview mode
- Button clicks prevented in visual editor
- Proper styling for solid and outline buttons

 Backward compatibility:
- Old syntax still supported
- No breaking changes

 Bug fixes:
- Fixed order_item_table → order_items_table naming
- Fixed button regex to match across newlines
- Added button/image parsing to parseMarkdownBasics
- Prevented button clicks on .button and .button-outline classes

📚 Documentation:
- NEW_MARKDOWN_SYNTAX.md - Complete user guide
- MARKDOWN_SYNTAX_AND_VARIABLES.md - Technical analysis
2025-11-15 20:05:50 +07:00

260 lines
3.6 KiB
Markdown

# Template Update Script
## Changes to Make in DefaultTemplates.php
For ALL templates, replace the footer pattern:
### Pattern to Find:
```
---
[Any text with {support_email} or similar]
© {current_year} {site_name}
```
### Replace With:
```
[card type="basic"]
[Same text with {support_email}]
[/card]
```
### Remove:
- All instances of `© {current_year} {site_name}` (already in global footer)
- All instances of standalone `---` before footer text
## Specific Updates:
### Customer Templates:
1. **customer_order_placed** (line 138-141):
```php
// OLD:
---
Need help? Contact us: {support_email}
© {current_year} {site_name}';
// NEW:
[card type="basic"]
Need help? Contact us: {support_email}
[/card]';
```
2. **customer_order_confirmed** (line 180-183):
```php
// OLD:
---
Questions? We\'re here to help: {support_email}
© {current_year} {site_name}';
// NEW:
[card type="basic"]
Questions? We\'re here to help: {support_email}
[/card]';
```
3. **customer_order_shipped** (line 222-225):
```php
// OLD:
---
Need assistance? Contact {support_email}
© {current_year} {site_name}';
// NEW:
[card type="basic"]
Need assistance? Contact {support_email}
[/card]';
```
4. **customer_order_completed** (line 262-267):
```php
// OLD:
---
Questions or issues with your order? We\'re here to help.
{support_email}
© {current_year} {site_name}';
// NEW:
[card type="basic"]
Questions or issues with your order? We\'re here to help.
Contact: {support_email}
[/card]';
```
5. **customer_order_cancelled** (line 309-311):
```php
// OLD:
---
© {current_year} {site_name}';
// NEW:
';
// (Just remove the footer entirely - no support text here)
```
6. **customer_payment_received** (line 349-351):
```php
// OLD:
---
© {current_year} {site_name}';
// NEW:
';
// (Just remove)
```
7. **customer_payment_failed** (line 398-400):
```php
// OLD:
---
© {current_year} {site_name}';
// NEW:
';
// (Already has support text in card, just remove footer)
```
8. **customer_registered** (line 436-439):
```php
// OLD:
---
Need help? Contact {support_email}
© {current_year} {site_name}';
// NEW:
[card type="basic"]
Need help? Contact {support_email}
[/card]';
```
9. **customer_vip_upgraded** (line 473-476):
```php
// OLD:
---
Questions? {support_email}
© {current_year} {site_name}';
// NEW:
[card type="basic"]
Questions? {support_email}
[/card]';
```
### Staff Templates:
10. **staff_order_placed** (line 535-538):
```php
// OLD:
---
WooNooW Order Management
© {current_year} {site_name}';
// NEW:
';
// (Remove - staff doesn't need this footer)
```
11. **staff_order_confirmed** (line 582-585):
```php
// OLD:
---
WooNooW Order Management
© {current_year} {site_name}';
// NEW:
';
```
12. **staff_order_shipped** (line 618-621):
```php
// OLD:
---
WooNooW Order Management
© {current_year} {site_name}';
// NEW:
';
```
13. **staff_order_completed** (line 664-667):
```php
// OLD:
---
WooNooW Order Management
© {current_year} {site_name}';
// NEW:
';
```
14. **staff_order_cancelled** (line 716-719):
```php
// OLD:
---
WooNooW Order Management
© {current_year} {site_name}';
// NEW:
';
```
15. **staff_payment_received** (line 763-766):
```php
// OLD:
---
WooNooW Payment Management
© {current_year} {site_name}';
// NEW:
';
```
16. **staff_payment_failed** (line 809-812):
```php
// OLD:
---
WooNooW Payment Management
© {current_year} {site_name}';
// NEW:
';
```
## Summary:
- **Customer templates**: Wrap support text in `[card type="basic"]`, remove copyright
- **Staff templates**: Remove footer entirely (they don't need support contact)
- **All templates**: Remove `© {current_year} {site_name}` (handled by global footer)