Skip to content

Commit 02da911

Browse files
committed
Merge branch 'feature/hold-vars' into main
2 parents aea44d6 + 8f8dc49 commit 02da911

File tree

8 files changed

+358
-231
lines changed

8 files changed

+358
-231
lines changed

build.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ glob.sync(`${pattern}.js`, {
4141
banner += `//DESCRIPTION:${resource.description}\n\n`
4242
}
4343

44-
banner += "#target indesign\n\n"
44+
banner += `#target indesign
45+
#targetengine 'utsutsunogare'\n\n`
4546
banner += `var NAME = '${filename}';\n`
4647

4748
const inputOptions = {
@@ -50,7 +51,7 @@ glob.sync(`${pattern}.js`, {
5051
};
5152
const outputOptions = {
5253
format: "es",
53-
file: path.resolve(distDir, `${filename}.jsx`),
54+
file: path.resolve(distDir, `${resource.name}.jsx`),
5455
banner
5556
};
5657
await build(inputOptions, outputOptions);
Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* CSVRubyProcessor
3-
* Version 1.0
3+
* Version 1.1
44
*
55
* (c) 2022 uco
66
*
@@ -11,6 +11,7 @@
1111
//DESCRIPTION:CSVファイルでルビを一括設定
1212

1313
#target indesign
14+
#targetengine 'utsutsunogare'
1415

1516
var NAME = 'CSVRubyProcessor';
1617

@@ -199,6 +200,10 @@ var NameValueList = function () {
199200
this.value = this.values[this.list.selection.index];
200201
};
201202

203+
_proto.getIndex = function getIndex() {
204+
return this.list.selection.index;
205+
};
206+
202207
return NameValueList;
203208
}();
204209

@@ -287,6 +292,18 @@ var RubySetting = function () {
287292
};
288293
};
289294

295+
_proto.getSettings = function getSettings() {
296+
return {
297+
alignments: this.alignList.getIndex(),
298+
position: this.positionList.getIndex(),
299+
overhang: this.overhangList.getIndex(),
300+
parentspacing: this.parentSpacingList.getIndex(),
301+
xOffset: this.xOffset,
302+
yOffset: this.yOffset,
303+
skipmode: this.isSkip()
304+
};
305+
};
306+
290307
_proto.isSkip = function isSkip() {
291308
return this.inputSkipmode.value;
292309
};
@@ -352,13 +369,29 @@ var DEFAULT = loadconfig(NAME, {
352369
parentspacing: 2,
353370
xOffset: 0,
354371
yOffset: 0,
355-
skipmode: false
372+
skipmode: false,
373+
keepParameter: true
356374
});
357375
app.doScript(main, ScriptLanguage.JAVASCRIPT, [], UndoModes.FAST_ENTIRE_SCRIPT);
358376

359377
function main() {
378+
var _this = this;
379+
360380
var dialog = new Window('dialog', 'ルビ設定');
361-
var rubySettings = new RubySetting(dialog, DEFAULT, true);
381+
382+
var settings = function () {
383+
if (DEFAULT.keepParameter) {
384+
if (typeof CSVRubyProcessor !== 'undefined') {
385+
return CSVRubyProcessor;
386+
} else {
387+
_this.CSVRubyProcessor = null;
388+
}
389+
}
390+
391+
return DEFAULT;
392+
}();
393+
394+
var rubySettings = new RubySetting(dialog, settings, true);
362395
new ActionButtons(dialog, {
363396
width: 96,
364397
height: 24
@@ -371,6 +404,11 @@ function main() {
371404

372405
var rubyOption = rubySettings.getValues();
373406
var skipmode = rubySettings.isSkip();
407+
408+
if (DEFAULT.keepParameter) {
409+
CSVRubyProcessor = rubySettings.getSettings();
410+
}
411+
374412
var fileObj = File.openDialog('', function () {
375413
if (/^windows/i.test($.os)) {
376414
return '*.csv';
Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* pixivRubyConverter
3-
* Version 1.0
3+
* Version 1.1
44
*
55
* (c) 2022 uco
66
*
@@ -11,6 +11,7 @@
1111
//DESCRIPTION:pixivのルビ書式を変換
1212

1313
#target indesign
14+
#targetengine 'utsutsunogare'
1415

1516
var NAME = 'pixivRubyConverter';
1617

@@ -123,6 +124,10 @@ var NameValueList = function () {
123124
this.value = this.values[this.list.selection.index];
124125
};
125126

127+
_proto.getIndex = function getIndex() {
128+
return this.list.selection.index;
129+
};
130+
126131
return NameValueList;
127132
}();
128133

@@ -211,6 +216,18 @@ var RubySetting = function () {
211216
};
212217
};
213218

219+
_proto.getSettings = function getSettings() {
220+
return {
221+
alignments: this.alignList.getIndex(),
222+
position: this.positionList.getIndex(),
223+
overhang: this.overhangList.getIndex(),
224+
parentspacing: this.parentSpacingList.getIndex(),
225+
xOffset: this.xOffset,
226+
yOffset: this.yOffset,
227+
skipmode: this.isSkip()
228+
};
229+
};
230+
214231
_proto.isSkip = function isSkip() {
215232
return this.inputSkipmode.value;
216233
};
@@ -275,13 +292,29 @@ var DEFAULT = loadconfig(NAME, {
275292
overhang: 1,
276293
parentspacing: 2,
277294
xOffset: 0,
278-
yOffset: 0
295+
yOffset: 0,
296+
keepParameter: true
279297
});
280298
app.doScript(main, ScriptLanguage.JAVASCRIPT, [], UndoModes.FAST_ENTIRE_SCRIPT);
281299

282300
function main() {
301+
var _this = this;
302+
283303
var dialog = new Window('dialog', 'ルビ設定');
284-
var rubySettings = new RubySetting(dialog, DEFAULT);
304+
305+
var settings = function () {
306+
if (DEFAULT.keepParameter) {
307+
if (typeof pixivRubyConverter !== 'undefined') {
308+
return pixivRubyConverter;
309+
} else {
310+
_this.pixivRubyConverter = null;
311+
}
312+
}
313+
314+
return DEFAULT;
315+
}();
316+
317+
var rubySettings = new RubySetting(dialog, settings);
285318
new ActionButtons(dialog, {
286319
width: 96,
287320
height: 24
@@ -293,6 +326,11 @@ function main() {
293326
}
294327

295328
var rubyOption = rubySettings.getValues();
329+
330+
if (DEFAULT.keepParameter) {
331+
pixivRubyConverter = rubySettings.getSettings();
332+
}
333+
296334
var PATTERN = '\\[\\[rb: *(.+?) *> *(.+?) *\\]\\]';
297335
app.findGrepPreferences = NothingEnum.nothing;
298336
app.findChangeGrepOptions.kanaSensitive = true;

resourcedata.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
export default {
22
CSVRubyProcessor: {
3-
ver: '1.0',
3+
name: 'CSVルビ一括設定',
4+
ver: '1.1',
45
description: 'CSVファイルでルビを一括設定',
56
},
67
pixivRubyConverter: {
7-
ver: '1.0',
8+
name: 'pixivルビ変換',
9+
ver: '1.1',
810
description: 'pixivのルビ書式を変換',
911
}
1012
}

0 commit comments

Comments
 (0)