Allow parentheses (angle brackets) in file name pattern (#1601)

This commit is contained in:
Aditya Chandel
2025-11-21 09:56:12 -07:00
committed by GitHub
parent ab2992ed82
commit 9a70fb5d81
3 changed files with 35 additions and 35 deletions
@@ -181,49 +181,49 @@
<div class="example-category">
<h4 class="subsection-title">Examples with Full Metadata</h4>
<div class="metadata-sample">
<span>title: <code>Harry Potter and the Sorcerer's Stone</code></span>
<span>subtitle: <code>The Boy Who Lived</code></span>
<span>authors: <code>J.K. Rowling</code></span>
<span>series: <code>Harry Potter</code></span>
<span>title: <code>The Name of the Wind</code></span>
<span>subtitle: <code>Special Edition</code></span>
<span>authors: <code>Patrick Rothfuss</code></span>
<span>series: <code>The Kingkiller Chronicle</code></span>
<span>seriesIndex: <code>01</code></span>
<span>year: <code>1997</code></span>
<span>currentFilename: <code>harry1_original.epub</code></span>
<span>year: <code>2007</code></span>
<span>currentFilename: <code>name_of_the_wind_original.epub</code></span>
</div>
<div class="example-list">
<div class="example-item">
<p class="example-pattern"><strong>Basic pattern:</strong> <code>{{ '{authors} - {title}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>J.K. Rowling - Harry Potter and the Sorcerer's Stone.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>Patrick Rothfuss - The Name of the Wind.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Pattern with punctuation:</strong> <code>{{ '{title}: {series}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Harry Potter and the Sorcerer's Stone: Harry Potter.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>The Name of the Wind: The Kingkiller Chronicle.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Series in folder path:</strong> <code>{{ '{authors}/{series}/{seriesIndex} - {title}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>J.K. Rowling/Harry Potter/01 - Harry Potter and the Sorcerer's Stone.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>Patrick Rothfuss/The Kingkiller Chronicle/01 - The Name of the Wind.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Folder only:</strong> <code>{{ '{title}/' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>/Harry Potter and the Sorcerer's Stone/harry1_original.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>/The Name of the Wind/name_of_the_wind_original.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Absolute path:</strong> <code>{{ '/{authors}/{title}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>/J.K. Rowling/Harry Potter and the Sorcerer's Stone.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>/Patrick Rothfuss/The Name of the Wind.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Reuse original filename in path:</strong> <code>{{ '{authors}/{series}/{currentFilename}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>J.K. Rowling/Harry Potter/harry1_original.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>Patrick Rothfuss/The Kingkiller Chronicle/name_of_the_wind_original.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Title + Subtitle:</strong> <code>{{ '{title}: {subtitle}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Harry Potter and the Sorcerer's Stone: The Boy Who Lived.epub</code></p>
<p class="example-output"><strong>Output:</strong> <code>The Name of the Wind: The Kingkiller Chronicle: Day One.epub</code></p>
</div>
</div>
</div>
@@ -38,7 +38,7 @@
.settings-description {
color: var(--p-text-muted-color);
font-size: 0.875rem;
font-size: 0.9rem;
line-height: 1.5;
margin-bottom: 1rem;
}
@@ -75,7 +75,7 @@
.section-description {
color: var(--p-text-muted-color);
font-size: 0.875rem;
font-size: 0.9rem;
line-height: 1.5;
margin: 0;
}
@@ -103,7 +103,7 @@
label {
font-weight: 600;
color: var(--p-text-color);
font-size: 0.875rem;
font-size: 0.9rem;
}
}
@@ -120,7 +120,7 @@
.error-message {
color: var(--p-red-500);
font-size: 0.875rem;
font-size: 0.9rem;
margin-top: 0.25rem;
}
@@ -138,7 +138,7 @@
.preview-label {
color: var(--p-text-muted-color);
font-size: 0.875rem;
font-size: 0.9rem;
}
.preview-value {
@@ -227,7 +227,7 @@
.placeholders-description {
color: var(--p-text-muted-color);
font-size: 0.875rem;
font-size: 0.9rem;
line-height: 1.5;
code {
@@ -263,7 +263,7 @@
li {
color: var(--p-text-color);
font-size: 0.875rem;
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
}
@@ -280,7 +280,7 @@
.optional-blocks-info {
p {
color: var(--p-text-color);
font-size: 0.875rem;
font-size: 0.9rem;
line-height: 1.5;
margin-bottom: 1rem;
}
@@ -307,7 +307,7 @@
li {
color: var(--p-text-color);
font-size: 0.875rem;
font-size: 0.9rem;
margin-bottom: 0.25rem;
}
}
@@ -342,7 +342,7 @@
}
span {
font-size: 0.875rem;
font-size: 0.9rem;
color: var(--p-text-muted-color);
code {
@@ -376,7 +376,7 @@
}
.example-pattern {
font-size: 0.875rem;
font-size: 0.9rem;
margin-bottom: 0.5rem;
strong {
@@ -392,7 +392,7 @@
}
.example-output {
font-size: 0.875rem;
font-size: 0.9rem;
margin: 0;
strong {
@@ -21,15 +21,15 @@ import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-
})
export class FileNamingPatternComponent implements OnInit {
readonly exampleMetadata: Record<string, string> = {
title: "Harry Potter and the Sorcerer's Stone",
subtitle: 'The Boy Who Lived',
authors: 'J.K. Rowling',
year: '1997',
series: 'Harry Potter',
seriesIndex: '01',
language: 'en',
publisher: 'Bloomsbury',
isbn: '9780747532699',
title: "The Name of the Wind",
subtitle: "Special Edition",
authors: "Patrick Rothfuss",
year: "2007",
series: "The Kingkiller Chronicle",
seriesIndex: "01",
language: "English",
publisher: "DAW Books",
isbn: "9780756404741",
};
defaultPattern = '';
@@ -95,7 +95,7 @@ export class FileNamingPatternComponent implements OnInit {
}
validatePattern(pattern: string): boolean {
const validPatternRegex = /^[\w\s\-{}\/().<>.,:'"]*$/;
const validPatternRegex = /^[\w\s\-{}\[\]\/().<>.,:'"]*$/;
return validPatternRegex.test(pattern);
}