diff --git a/content/export-templates.md b/content/export-templates.md index fa09041..916fca3 100644 --- a/content/export-templates.md +++ b/content/export-templates.md @@ -7,7 +7,12 @@ draft: false # Export Templates mpvQC uses the [Jinja template](https://jinja.palletsprojects.com/en/3.1.x/) engine to customize how QC reports are -exported. This allows you to control the format and structure of your exported documents. +exported: templates control the format and structure of the documents written by the export menu. + +Templates are made for human-readable output. If you want to feed QC data into scripts or other tooling, you don't +need a template: mpvQC saves QC documents in a +[versioned JSON format](https://github.com/mpvqc/mpvQC/tree/main/docs/document-format) with a JSON Schema per +version, designed exactly for that. ## Getting Started @@ -16,51 +21,77 @@ exported. This allows you to control the format and structure of your exported d 3. Edit the template file using any text editor 4. Restart mpvQC to load the new template -Once loaded, your custom template will appear as a new export option in the File menu. +Once loaded, your custom template appears as a new entry under **File → Export QC Document**. ## Template Reference In addition to standard Jinja expressions, mpvQC provides the following properties and filters: -### Properties - -| | | | -|--------------------------|--------------|---------------------------------------------------------------------| -| **Report Metadata** | | | -| `write_date` | `bool` | Whether to include the export date/time | -| `date` | `str` | Current date/time formatted according to user's locale (LongFormat) | -| `write_generator` | `bool` | Whether to include the generator information | -| `generator` | `str` | mpvQC version string (e.g., "mpvQC 0.9.0") | -| | | | -| **Video Information** | | | -| `write_video_path` | `bool` | Whether to include the video file path | -| `video_path` | `str` | Absolute path to the video file (empty if no video loaded) | -| `video_name` | `str` | Video filename with extension (empty if no video loaded) | -| | | | -| **User Information** | | | -| `write_nickname` | `bool` | Whether to include the user's nickname | -| `nickname` | `str` | User's nickname for report attribution | -| | | | -| **Subtitle Information** | | | -| `write_subtitle_paths` | `bool` | Whether to include manually imported subtitle paths | -| `subtitles` | `list[str]` | List of subtitle file paths | -| | | | -| **Comments** | | | -| `comments` | `list[dict]` | List of comment dictionaries containing: | -| | | • `time` (int): Time in seconds | -| | | • `commentType` (str): Type of comment | -| | | • `comment` (str): The comment text | +{{< card >}} +### Report Metadata + +| Property | Type | Description | +|-------------------|--------|----------------------------------------------| +| `write_date` | `bool` | Whether to include the export date/time | +| `date` | `str` | Current date/time as `yyyy-MM-dd HH:mm` | +| `write_generator` | `bool` | Whether to include the generator information | +| `generator` | `str` | mpvQC version string (e.g., "mpvQC 0.9.0") | +{{< /card >}} + +{{< card >}} +### Video + +| Property | Type | Description | +|--------------------|--------|------------------------------------------------------------| +| `write_video_path` | `bool` | Whether to include the video file path | +| `video_path` | `str` | Absolute path to the video file (empty if no video loaded) | +| `video_name` | `str` | Video filename with extension (empty if no video loaded) | +{{< /card >}} + +{{< card >}} +### User + +| Property | Type | Description | +|------------------|--------|----------------------------------------| +| `write_nickname` | `bool` | Whether to include the user's nickname | +| `nickname` | `str` | User's nickname for report attribution | +{{< /card >}} + +{{< card >}} +### Subtitles + +| Property | Type | Description | +|------------------------|-------------|------------------------------------------------------| +| `write_subtitle_paths` | `bool` | Whether to include manually imported subtitle paths | +| `subtitles` | `list[str]` | List of subtitle file paths | +{{< /card >}} + +{{< card >}} +### Comments + +`comments` is a list of dictionaries, one per comment: + +| Key | Type | Description | +|---------------|-------|----------------------| +| `time` | `int` | Time in seconds | +| `time_ms` | `int` | Time in milliseconds | +| `commentType` | `str` | Type of comment | +| `comment` | `str` | The comment text | +{{< /card >}} +{{< card >}} ### Filters | Filter | Purpose | Usage | |-------------------|--------------------------------------------|-------------------------------------------------------------------------| | `as_time` | Converts seconds to `HH:mm:ss` format | `{{ comment['time'] \| as_time }}` → `00:00:00` | +| `as_time_ms` | Converts milliseconds to `HH:mm:ss.zzz` | `{{ comment['time_ms'] \| as_time_ms }}` → `00:15:29.340` | | `as_comment_type` | Translates comment type to user's language | `{{ comment['commentType'] \| as_comment_type }}` → Localized type name | +{{< /card >}} -## Default Template +## Example: The Classic Template -mpvQC uses this template internally for saving QC documents: +mpvQC uses this template internally for the built-in **mpvQC Classic** export: ``` [FILE] diff --git a/layouts/partials/style.html b/layouts/partials/style.html index 7c0af63..c0b2f3b 100644 --- a/layouts/partials/style.html +++ b/layouts/partials/style.html @@ -20,6 +20,7 @@ --code-text-color: #222; --blockquote-border-color: #666; --blockquote-text-color: #666; + --card-border-color: #ddd; } @media (prefers-color-scheme: dark) { @@ -37,6 +38,7 @@ --code-text-color: #ddd; --blockquote-border-color: #ccc; --blockquote-text-color: #ccc; + --card-border-color: #999; } } @@ -158,4 +160,21 @@ list-style-type: none; margin-left: -25.5px; } + + .card { + box-sizing: border-box; + border: 1px solid var(--card-border-color); + border-radius: 12px; + padding: 0.25rem 1.25rem 1rem; + } + + .content-card + .content-card { + margin-top: 1rem; + } + + .card th, + .card td { + padding: 6px 16px 6px 0; + text-align: left; + } diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html new file mode 100644 index 0000000..5f831dc --- /dev/null +++ b/layouts/shortcodes/card.html @@ -0,0 +1,3 @@ +