Skip to content

Conversation

@Arlodotexe
Copy link
Member

Major refactoring of the blog generation asset pipeline to improve flexibility and maintainability:

Core Interface Changes:

  • Renamed IAssetInclusionStrategyIAssetStrategy with nullable return type
  • Updated method signatures across asset interfaces for clarity and consistency
  • Renamed ReferencedAsset record → PageAsset to better reflect its purpose
  • Renamed PostPageDataModelHtmlMarkdownDataTemplateModel for generic use

Asset Strategy System:

  • Deleted ReferenceOnlyInclusionStrategy.cs (replaced with new architecture)
  • Added KnownAssetStrategy.cs: configurable strategy using known asset ID lists
    • Supports both included and referenced asset file ID sets
    • Includes fallback behavior options (Reference/Include/Drop)
  • Added FaultStrategy.cs: enum for unknown asset handling (None/LogWarn/LogError/Throw)

Asset Detection Improvements:

  • Enhanced RegexAssetLinkDetector with improved path matching patterns
  • Added protocol scheme detection to filter out absolute URLs
  • Added standalone filename pattern detection
  • Fixed relative path resolution in RelativePathAssetResolver

Processing Pipeline Refactoring:

  • Moved asset detection earlier in pipeline to include template file assets
  • Changed AssetAwareHtmlTemplatedMarkdownFile to scan both template and markdown
  • Updated post-processing to return nullable for dropped assets
  • Refactored PagesCommand to configure new asset strategy with separate ID sets

Command Structure:

  • Deleted legacy PostPageCommand.cs, PostPageFolder.cs, IndexHtmlFile.cs, PostPageAssetFolder.cs
  • Added new PageCommand.cs for single-page generation
  • Updated WacsdkBlogCommands to use new command structure

Dependencies:

  • Added OwlCore.Extensions package reference for enhanced functionality

Tests:

  • Updated test references from InclusionStrategyAssetStrategy
  • Created temporary ReferenceOnlyAssetStrategy for test compatibility

This refactoring enables fine-grained control over asset handling, supporting scenarios like template-based asset inclusion vs markdown-based asset referencing, with configurable fallback behavior for unknown assets.

…ReferencedAsset tracking

Changes to asset resolution architecture:
- Modified IAssetResolver to accept markdown source per-call instead of storing it as state
- Updated RelativePathAssetResolver to be stateless, receiving context file in ResolveAsync()
- Enables shared resolver instance across multiple pages without coupling

Introduced ReferencedAsset record:
- Captures complete asset reference info: original path, rewritten path, and resolved file
- Facilitates materialization in consumer code (PagesCommand)
- Replaces IFile collection with structured ReferencedAsset collection

AssetAwareHtmlTemplatedMarkdownFile improvements:
- Tracks all referenced assets (both included and referenced) via ReferencedAsset
- Unified asset processing for markdown source and template file detection
- Extracted ProcessAssetLinkAsync() method for shared pipeline logic

Virtual structure simplification:
- Removed automatic asset yielding from AssetAwareHtmlTemplatedMarkdownPageFolder
- Removed template asset yielding from HtmlTemplatedMarkdownPageFolder base class
- Assets now tracked in ReferencedAsset collection for explicit consumer materialization

Implemented PagesCommand:
- CLI command for multi-page blog generation using AssetAwareHtmlTemplatedMarkdownPagesFolder
- Materializes virtual structure by iterating page folders and copying files
- Uses ReferencedAsset.RewrittenPath for correct asset output placement

Added comprehensive test coverage:
- AssetAwareHtmlTemplatedMarkdownPagesFolderTests with 7 test cases
- Covers markdown discovery, hierarchy preservation, asset resolution, and link rewriting

Minor cleanup:
- Removed debug logging from PostPageAssetFolder
- Fixed formatting/whitespace in PostPageFolder and HtmlTemplatedMarkdownPageFolder
- Changed return types to IChildFolder for Pages-related classes
Simplifies asset resolver architecture:
- Removed IFolder SourceFolder property from IAssetResolver interface
- Removed SourceFolder property from RelativePathAssetResolver implementation
- Asset resolution now fully stateless, relying only on markdown source context

Updated PagesCommand implementation:
- Simplified folder materialization logic with better variable naming
- Changed --template-file option to --template-file-name for clarity
- Removed debug logging statements
- Used DepthFirstRecursiveFolder at pagesFolder level instead of per-page
- Improved code formatting and inline documentation
- Streamlined folder creation using CreateFoldersAlongRelativePathAsync pattern

Restored HtmlTemplatedMarkdownPageFolder template asset yielding:
- Re-added template folder enumeration and asset passthrough
- Template HTML file exclusion logic restored
- Enables PostPage scenario to continue working as expected

Updated test setup:
- Removed SourceFolder initialization from RelativePathAssetResolver instances
- Tests now reflect stateless resolver design
…attern

Major refactoring of the blog generation asset pipeline to improve flexibility and maintainability:

**Core Interface Changes:**
- Renamed `IAssetInclusionStrategy` → `IAssetStrategy` with nullable return type
- Updated method signatures across asset interfaces for clarity and consistency
- Renamed `ReferencedAsset` record → `PageAsset` to better reflect its purpose
- Renamed `PostPageDataModel` → `HtmlMarkdownDataTemplateModel` for generic use

**Asset Strategy System:**
- Deleted `ReferenceOnlyInclusionStrategy.cs` (replaced with new architecture)
- Added `KnownAssetStrategy.cs`: configurable strategy using known asset ID lists
  - Supports both included and referenced asset file ID sets
  - Includes fallback behavior options (Reference/Include/Drop)
- Added `FaultStrategy.cs`: enum for unknown asset handling (None/LogWarn/LogError/Throw)

**Asset Detection Improvements:**
- Enhanced `RegexAssetLinkDetector` with improved path matching patterns
- Added protocol scheme detection to filter out absolute URLs
- Added standalone filename pattern detection
- Fixed relative path resolution in `RelativePathAssetResolver`

**Processing Pipeline Refactoring:**
- Moved asset detection earlier in pipeline to include template file assets
- Changed `AssetAwareHtmlTemplatedMarkdownFile` to scan both template and markdown
- Updated post-processing to return nullable for dropped assets
- Refactored `PagesCommand` to configure new asset strategy with separate ID sets

**Command Structure:**
- Deleted legacy `PostPageCommand.cs`, `PostPageFolder.cs`, `IndexHtmlFile.cs`, `PostPageAssetFolder.cs`
- Added new `PageCommand.cs` for single-page generation
- Updated `WacsdkBlogCommands` to use new command structure

**Dependencies:**
- Added `OwlCore.Extensions` package reference for enhanced functionality

**Tests:**
- Updated test references from `InclusionStrategy` → `AssetStrategy`
- Created temporary `ReferenceOnlyAssetStrategy` for test compatibility

This refactoring enables fine-grained control over asset handling, supporting scenarios like template-based asset inclusion vs markdown-based asset referencing, with configurable fallback behavior for unknown assets.
@Arlodotexe Arlodotexe marked this pull request as draft November 24, 2025 16:02
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.

2 participants