Skip to content

Commit

Permalink
upd A + in suffix truncates the subfolder name
Browse files Browse the repository at this point in the history
  • Loading branch information
pchiorean committed Oct 12, 2021
1 parent 9e38019 commit f42cda9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
10 changes: 8 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog

#### [2021-10-12](https://github.com/pchiorean/Indentz/search?q=committer-date%3A2021-10-12&type=commits)

- `upd` **QuickExport v2.13** - When exporting files to subfolders, a `+` in the suffix will truncate the subfolder name

#### [2021-10-11](https://github.com/pchiorean/Indentz/search?q=committer-date%3A2021-10-11&type=commits)

- `fix` **ParseDataFile v2.2** - Fixed an overlap between general errors and record checking errors
Expand Down Expand Up @@ -107,9 +111,9 @@
- `upd` **ParseDataFile** - Keep the record index in the returned object
- `brk` **PrepareForExport, VisibleArea** - Read layer variants from `layers.txt`, fallback to defaults
- `upd` **QuickExport** - Don't include page information for very small files
- `upd` **QuickExport** - Limit export subfolder to suffix's first word
- `upd` **QuickExport** - JSONify preferences (see [this](https://stackoverflow.com/a/56391294) discussion)
- `upd` **ReplaceFonts** - Report changed fonts
- `upd` **ReplaceLinks** - Use wildcards for old links
- `upd` **ReplaceText** - Take an array of strings as input
- `upd` **ReplaceText** - Add a switch for grep matching
- `upd` **Report** - Add auto filtering mode (`true`|`false`|`auto`)
Expand All @@ -118,7 +122,8 @@
- `upd` **SpreadsToFiles** - Split 'ABBBCC' to 'A', 'BBB', 'CC'
- `upd` **TextAutoSize** - Check `baselineShift` ([#132](https://github.com/pchiorean/Indentz/issues/132))
- `brk` **VisibleArea** - Mark the entire spread's visible area, not individual pages
- `upd` **VisibleArea** - Use wildcards for layers' names
- `upd` **VisibleArea** - Use wildcards for layer names
- `upd` Add an optionally verbosity argument to DefaultLayers/Swatches & ReplaceFonts/Links
- `upd` Use a custom object style for 'Visible area' frame ([#123](https://github.com/pchiorean/Indentz/issues/123))
- `sty` Fix UI static/edittext width (see Marc's [measureString()](https://twitter.com/indiscripts/status/1408788941550108674))

Expand All @@ -130,6 +135,7 @@
- `fix` **LabelPageRatios** - Use spreads' ratio
- `fix` **PageSizeFromFilename** - Error on pages set to 1:X scale ([#129](https://github.com/pchiorean/Indentz/issues/129))
- `fix` **PageSizeFromFilename** - Limit detected bleed to max values
- `fix` **PageSizeFromFilename** - Dimensions in pixels
- `fix` **PageSizeFromSelection** - For text frames use outlined text bounds
- `fix` **QR, QRBatch** - Align to page > visible area > margins
- `fix` **QR, QRBatch** - Improve line breaking
Expand Down
4 changes: 2 additions & 2 deletions docs/README-ro.html
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ <h3 class="mume-header" id="export"><strong>Export</strong></h3>
<li>
<p><strong><code>QuickExport</code></strong> export&#x103; &#xEE;n PDF toate documentele deschise sau documentele dintr&#x2011;un folder, cu p&#xE2;n&#x103; la dou&#x103; preseturi configurabile. F&#x103;r&#x103; documente deschise, pute&#x21B;i selecta un folder pentru procesarea &#xEE;n serie:</p>
<p><img src="img/quickexport.png" alt="Quick export"></p>
<p>Textul din c&#xE2;mpul <strong>Suffix</strong> va fi ad&#x103;ugat la numele fi&#x219;ierului exportat (e autodetectat dac&#x103; numele presetului se termin&#x103; cu &#x201E;_<em>sufix</em>&#x201D;). Dac&#x103; <strong>Export in subfolders</strong> e activ, sufixul va fi folosit &#x219;i pentru numele subfolderului.</p>
<p>Textul din c&#xE2;mpul <strong>Suffix</strong> va fi ad&#x103;ugat la numele fi&#x219;ierului exportat (e autodetectat dac&#x103; numele presetului se termin&#x103; cu &#x201E;_<em>sufix</em>&#x201D;). Dac&#x103; <strong>Export in subfolders</strong> e activ, sufixul (p&#xE2;n&#x103; la primul <code>+</code>) va fi folosit &#x219;i pentru numele subfolderului.</p>
<p>Pentru comoditate, c&#xE2;teva op&#x21B;iuni de export sunt direct accesibile: export ca pagini/spreaduri, crop mark&#x2011;uri, page information, slug area; de asemenea, se poate seta un alt bleed.</p>
<p>Op&#x21B;ional, poate rula un JavaScript sau AppleScript &#xEE;nainte de export, de exemplu unul din urm&#x103;toarele:</p>
</li>
Expand Down Expand Up @@ -1038,7 +1038,7 @@ <h2 class="mume-header" id="despre">Despre</h2>
<p>Codul din acest proiect nu ar fi fost posibil f&#x103;r&#x103; InDesign ExtendScript API de <a href="http://jongware.mit.edu">Theunis de Jong</a> &#x219;i <a href="https://www.indesignjs.de/extendscriptAPI/indesign-latest/">Gregor Fellenz</a>, Mozilla <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/About">MDN Web Docs</a>, post&#x103;ri pe bloguri &#x219;i forumuri, tutoriale &#x219;i scripturi de <a href="https://www.indiscripts.com">Marc Autret</a>, <a href="http://jsid.blogspot.com">Dave Saunders</a>, <a href="https://creativepro.com/files/kahrel/indesignscripts.html">Peter Kahrel</a>, <a href="https://github.com/grefel/indesignjs">Gregor Fellenz</a>, <a href="https://indisnip.wordpress.com">Marijan Tompa</a>, <a href="https://github.com/richardharrington/indesign-scripts">Richard Harrington</a> &#x219;i mul&#x21B;i al&#x21B;ii.</p>
<p>&#xA9; 2020-2021 Paul Chiorean &lt;jpeg AT basement.ro&gt;. <br>
Codul este publicat sub licen&#x21B;a MIT (v. <a href="LICENSE.txt">LICENSE.txt</a>).</p>
<p>README-ro.md &#x2022; 11 octombrie 2021</p>
<p>README-ro.md &#x2022; 12 octombrie 2021</p>

</div>

Expand Down
4 changes: 2 additions & 2 deletions docs/README-ro.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Proxy | | | | | |

![Quick export](img/quickexport.png)

Textul din câmpul **Suffix** va fi adăugat la numele fișierului exportat (e autodetectat dacă numele presetului se termină cu „_*sufix*”). Dacă **Export in subfolders** e activ, sufixul va fi folosit și pentru numele subfolderului.
Textul din câmpul **Suffix** va fi adăugat la numele fișierului exportat (e autodetectat dacă numele presetului se termină cu „_*sufix*”). Dacă **Export in subfolders** e activ, sufixul (până la primul `+`) va fi folosit și pentru numele subfolderului.

Pentru comoditate, câteva opțiuni de export sunt direct accesibile: export ca pagini/spreaduri, crop mark‑uri, page information, slug area; de asemenea, se poate seta un alt bleed.

Expand Down Expand Up @@ -373,4 +373,4 @@ Codul din acest proiect nu ar fi fost posibil fără InDesign ExtendScript API d
© 2020-2021 Paul Chiorean \<jpeg AT basement.ro\>. \
Codul este publicat sub licența MIT (v. [LICENSE.txt](LICENSE.txt)).

README-ro.md • 11 octombrie 2021
README-ro.md • 12 octombrie 2021
4 changes: 2 additions & 2 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ <h3 class="mume-header" id="export"><strong>Export</strong></h3>
<li>
<p><strong><code>QuickExport</code></strong> exports to PDF all open documents or documents from a folder, with up to two configurable presets. With no documents open, you can select a folder for batch processing:</p>
<p><img src="img/quickexport.png" alt="Quick export"></p>
<p>The text from the <strong>Suffix</strong> field will be appended to the exported file name (it&#x2019;s autodetected if the preset ends with &#x201C;_<em>suffix</em>&#x201D;). If <strong>Export in subfolders</strong> is checked, the suffix will also be used for the subfolder name.</p>
<p>The text from the <strong>Suffix</strong> field will be appended to the exported file name (it&#x2019;s autodetected if the preset ends with &#x201C;_<em>suffix</em>&#x201D;). If <strong>Export in subfolders</strong> is checked, the suffix (up to the first <code>+</code>) will also be used for the subfolder name.</p>
<p>For convenience, some export options are directly accessible: export as pages/spreads, crop marks, page information, slug area; also, you can set a custom bleed.</p>
<p>Optionally, it can run a JavaScript or AppleScript before exporting, e.g., one of the following:</p>
</li>
Expand Down Expand Up @@ -1038,7 +1038,7 @@ <h2 class="mume-header" id="about">About</h2>
<p>The code in this project would not have been possible without the InDesign ExtendScript API by <a href="http://jongware.mit.edu">Theunis de Jong</a> and <a href="https://www.indesignjs.de/extendscriptAPI/indesign-latest/">Gregor Fellenz</a>, Mozilla&#x2019;s <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/About">MDN Web Docs</a>, also blog posts, forum posts, tutorials or code by <a href="https://www.indiscripts.com">Marc Autret</a>, <a href="http://jsid.blogspot.com">Dave Saunders</a>, <a href="https://creativepro.com/files/kahrel/indesignscripts.html">Peter Kahrel</a>, <a href="https://github.com/grefel/indesignjs">Gregor Fellenz</a>, <a href="https://indisnip.wordpress.com">Marijan Tompa</a>, <a href="https://github.com/richardharrington/indesign-scripts">Richard Harrington</a> and many others.</p>
<p>&#xA9; 2020-2021 Paul Chiorean &lt;jpeg AT basement.ro&gt;. <br>
The code is released under the MIT License (see <a href="LICENSE.txt">LICENSE.txt</a>).</p>
<p>README.md &#x2022; October 11, 2021</p>
<p>README.md &#x2022; October 12, 2021</p>

</div>

Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Proxy | | | | | |

![Quick export](img/quickexport.png)

The text from the **Suffix** field will be appended to the exported file name (it's autodetected if the preset ends with “_*suffix*”). If **Export in subfolders** is checked, the suffix will also be used for the subfolder name.
The text from the **Suffix** field will be appended to the exported file name (it's autodetected if the preset ends with “_*suffix*”). If **Export in subfolders** is checked, the suffix (up to the first `+`) will also be used for the subfolder name.

For convenience, some export options are directly accessible: export as pages/spreads, crop marks, page information, slug area; also, you can set a custom bleed.

Expand Down Expand Up @@ -373,4 +373,4 @@ The code in this project would not have been possible without the InDesign Exten
© 2020-2021 Paul Chiorean \<jpeg AT basement.ro\>. \
The code is released under the MIT License (see [LICENSE.txt](LICENSE.txt)).

README.md • October 11, 2021
README.md • October 12, 2021
15 changes: 8 additions & 7 deletions export/QuickExport.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Quick export v2.12.1 (2021-09-30)
Quick export v2.13 (2021-10-12)
(c) 2020-2021 Paul Chiorean (jpeg@basement.ro)
Exports open .indd documents or a folder with several configurable PDF presets.
Expand Down Expand Up @@ -38,7 +38,7 @@ var VER = '2';
var forbiddenFilenameCharsRE = /[#%^{}\\<>*?\/$!'":@`|=]/g; // eslint-disable-line no-useless-escape
var regexTokensRE = /[|^$(.)[\]{*+?}\\]/g;
var script = (function () { try { return app.activeScript; } catch (e) { return new File(e.fileName); } }());
var settingsFile = File(Folder.userData + '/' + script.name.slice(0, script.name.lastIndexOf('.')) + '.prefs');
var settingsFile = File(Folder.userData + '/' + script.name.replace(/.[^.]+$/, '') + '.prefs');
var presets = app.pdfExportPresets.everyItem().name.sort();
var folderMode = (app.documents.length === 0);
var old = {
Expand Down Expand Up @@ -224,7 +224,7 @@ ui.preset1.preset.onChange = function () {
// Auto-set suffix
var str = this.selection.text;
var pdfExpPreset = app.pdfExportPresets.item(str);
ui.preset1.suffix.text = (/_/g.test(str) && str.slice(str.lastIndexOf('_'))) || '';
ui.preset1.suffix.text = /_/g.test(str) ? str.replace(/^.*_/, '') : '';
// Populate preset options
ui.preset1.exportSpreads.value = pdfExpPreset.exportReaderSpreads;
ui.preset1.cropMarks.value = pdfExpPreset.cropMarks;
Expand Down Expand Up @@ -279,7 +279,7 @@ ui.preset2.preset.onChange = function () {
// Auto-set suffix
var str = this.selection.text;
var pdfExpPreset = app.pdfExportPresets.item(str);
ui.preset2.suffix.text = (/_/g.test(str) && str.slice(str.lastIndexOf('_'))) || '';
ui.preset2.suffix.text = /_/g.test(str) ? str.replace(/^.*_/, '') : '';
// Populate preset options
ui.preset2.exportSpreads.value = pdfExpPreset.exportReaderSpreads;
ui.preset2.cropMarks.value = pdfExpPreset.cropMarks;
Expand All @@ -291,6 +291,7 @@ ui.preset1.suffix.onChange =
ui.preset2.suffix.onChange = function () {
var str = this.text.replace(/^\s+|\s+$/g, ''); // Trim
str = str.replace(forbiddenFilenameCharsRE, ''); // Sanitize suffix
str = str.replace(/^_/, ''); // Delete separator
if (this.text !== str) this.text = str;
};
if (folderMode) {
Expand Down Expand Up @@ -389,10 +390,10 @@ while ((doc = docs.shift())) {
exp = ui['preset' + step]; // Current export preset
if (!exp.isOn.value) continue;
// Create subfolder
suffix = exp.suffix.text ? ('_' + exp.suffix.text.replace(/^_/, '')) : '';
suffix = exp.suffix.text ? ('_' + exp.suffix.text) : '';
subfolder = '';
if (ui.output.options.subfolders.value && suffix) {
subfolder = suffix.replace(/^_/, '');
subfolder = suffix.replace(/^_/, '').replace(/\+.*$/, '').replace(/^\s+|\s+$/g, '');
if (!Folder(baseFolder + '/' + subfolder).exists) Folder(baseFolder + '/' + subfolder).create();
}
if (exp.script.enabled && exp.script.isOn.value && exp.script.path.exists) runScript(exp.script.path);
Expand Down Expand Up @@ -451,7 +452,7 @@ function updateLinks() {
}

function runScript(path) {
var ext = path.fsName.slice(path.fsName.lastIndexOf('.') + 1);
var ext = path.fsName.replace(/^.*\./, '');
app.doScript(path,
(function (str) {
return {
Expand Down

0 comments on commit f42cda9

Please sign in to comment.