refactor: extract TypstVariableMapper from PandocCommandBuilder
Extract comprehensive variable mapping and transformation logic into dedicated TypstVariableMapper class. This modularizes the variable handling system for better maintainability and separation of concerns. Changes: - Create src/converters/pandoc/TypstVariableMapper.ts (320+ lines) - Extract addExportConfigVariables and addPluginSettingsVariables methods - Extract complete variable transformation logic with name mapping - Extract typography and page setup variable handling - Update PandocCommandBuilder to use new variable mapper - Remove 127 lines of variable mapping code from PandocCommandBuilder Key Features: - TypstVariable interface for structured variable handling - Priority system: ExportConfig variables override plugin settings - Complete variable name mapping (bodyFont → font, margins + 'cm', etc.) - Modular variable mapping: ExportConfig, Typography, PageSetup, Margins - Unit conversion handling (pt, cm) and paper size mapping - Pandoc argument generation from mapped variables Maintains all existing functionality: - Variable priority and fallback system preserved - All font, layout, and template variable mappings intact - Plugin settings integration with proper precedence - Paper size mapping via mapToTypstPaperSize utility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
3 files changed
+340
-131
No files matched your search
@@ -101,7 +101,7 @@ The main.ts file is the plugin entry point and most critical to get right.
|
||||
|
||||
**CHECKPOINT: Complete test of all Phase 1 functionality** - DONE
|
||||
|
||||
## PHASE 2: Refactor MarkdownPreprocessor.ts - IN PROGRESS
|
||||
## PHASE 2: Refactor MarkdownPreprocessor.ts - DONE
|
||||
|
||||
### Step 2.1: Create FrontmatterProcessor.ts - DONE
|
||||
**Location:** `src/converters/preprocessors/FrontmatterProcessor.ts` (~200 lines)
|
||||
@@ -165,9 +165,9 @@ The main.ts file is the plugin entry point and most critical to get right.
|
||||
|
||||
**CHECKPOINT: Test various note types with different content**
|
||||
|
||||
## PHASE 3: Refactor PandocTypstConverter.ts
|
||||
## PHASE 3: Refactor PandocTypstConverter.ts - IN PROGRESS
|
||||
|
||||
### Step 3.1: Create PandocCommandBuilder.ts
|
||||
### Step 3.1: Create PandocCommandBuilder.ts - DONE
|
||||
**Location:** `src/converters/pandoc/PandocCommandBuilder.ts` (~200 lines)
|
||||
**Extract:**
|
||||
- Command building logic
|
||||
@@ -176,7 +176,7 @@ The main.ts file is the plugin entry point and most critical to get right.
|
||||
|
||||
**STOP** → Verify build → Test Pandoc command generation
|
||||
|
||||
### Step 3.2: Create TypstVariableMapper.ts
|
||||
### Step 3.2: Create TypstVariableMapper.ts - DONE
|
||||
**Location:** `src/converters/pandoc/TypstVariableMapper.ts` (~200 lines)
|
||||
**Extract:**
|
||||
- Variable mapping logic
|
||||
@@ -185,7 +185,7 @@ The main.ts file is the plugin entry point and most critical to get right.
|
||||
|
||||
**STOP** → Verify build → Test variable application in templates
|
||||
|
||||
### Step 3.3: Create ResourcePathResolver.ts
|
||||
### Step 3.3: Create ResourcePathResolver.ts - IN PROGRESS
|
||||
**Location:** `src/converters/pandoc/ResourcePathResolver.ts` (~150 lines)
|
||||
**Extract:**
|
||||
- `resolveResourcePaths()` method
|
||||
|
||||
Reference in new issue
Block a user