mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fix: import
This commit is contained in:
1 parent
75da6381ee
commit
86689e8d4c
3 files changed
+24
-19
No files matched your search
@@ -24,40 +24,45 @@ class FpsProblemImportHandler extends Handler {
|
|||||||
const content = [];
|
const content = [];
|
||||||
if (p.description) {
|
if (p.description) {
|
||||||
content.push(
|
content.push(
|
||||||
this.translate('problem.import.problem_description'),
|
`<h2>${this.translate('Description')}</h2>`,
|
||||||
p.description.join('\n'),
|
...p.description,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (p.input) {
|
if (p.input) {
|
||||||
content.push(
|
content.push(
|
||||||
this.translate('problem.import.input_format'),
|
`<h2>${this.translate('Input Format')}</h2>`,
|
||||||
p.input.join('\n'),
|
...p.input,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (p.output) {
|
if (p.output) {
|
||||||
content.push(
|
content.push(
|
||||||
this.translate('problem.import.output_format'),
|
`<h2>${this.translate('Output Format')}</h2>`,
|
||||||
p.output.join('\n'),
|
...p.output,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (p.sample_input) {
|
if (p.sample_input) {
|
||||||
|
if (p.sample_input.length === 1) {
|
||||||
content.push(
|
content.push(
|
||||||
this.translate('problem.import.sample_input'),
|
`<h2>${this.translate('Sample Input')}</h2>`,
|
||||||
// eslint-disable-next-line prefer-template
|
`<pre><code>${p.sample_input[0]}</code></pre>`,
|
||||||
p.sample_input.map((i: string) => ('```\n' + i + '\n```')).join('\n'),
|
`<h2>${this.translate('Sample Output')}</h2>`,
|
||||||
|
`<pre><code>${p.sample_output[0]}</code></pre>`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < p.sample_input.length; i++) {
|
||||||
|
content.push(
|
||||||
|
`<h2>${this.translate('Sample Input')}${i + 1}</h2>`,
|
||||||
|
`<pre><code>${p.sample_input[i]}</code></pre>`,
|
||||||
|
`<h2>${this.translate('Sample Output')}${i + 1}</h2>`,
|
||||||
|
`<pre><code>${p.sample_output[i]}</code></pre>`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (p.sample_output) {
|
}
|
||||||
content.push(
|
|
||||||
this.translate('problem.import.sample_output'),
|
|
||||||
// eslint-disable-next-line prefer-template
|
|
||||||
p.sample_output.map((i: string) => ('```\n' + i + '\n```')).join('\n'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (p.hint) {
|
if (p.hint) {
|
||||||
content.push(
|
content.push(
|
||||||
this.translate('problem.import.hint'),
|
`<h2>${this.translate('Hint')}</h2>`,
|
||||||
p.hint.join('\n'),
|
...p.hint,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const config: LocalProblemConfig = {
|
const config: LocalProblemConfig = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/fps-importer",
|
"name": "@hydrooj/fps-importer",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "Import FPS problems",
|
"description": "Import FPS problems",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="row"><div class="columns">
|
<div class="row"><div class="columns">
|
||||||
<label>
|
<label>
|
||||||
{{ _('FPS FILE') }}
|
{{ _('FPS FILE') }}
|
||||||
<textarea name="content" class="textbox" data-xml style="height: 500px"></textarea>
|
<textarea name="input" class="textbox" data-xml style="height: 500px"></textarea>
|
||||||
</label>
|
</label>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="row"><div class="columns">
|
<div class="row"><div class="columns">
|
||||||
|
|||||||
Reference in new issue
Block a user