mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: buildContent: add new line between sections
This commit is contained in:
1 file changed
+9
-9
@@ -15,15 +15,15 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
|
||||
// required by upgrade 90_91
|
||||
if (source instanceof Array) {
|
||||
return type === 'html'
|
||||
? source.map((node) => [
|
||||
? source.flatMap((node) => [
|
||||
node.type !== 'Plain' ? `<h2>${node.sectionTitle}</h2>` : '',
|
||||
node.type === 'Sample'
|
||||
? `<pre><code class="language-input${++cnt}">${node.payload[0]}</code></pre>`
|
||||
+ `<pre><code class="language-output${cnt}">${node.payload[1]}</code></pre>`
|
||||
: '',
|
||||
node.text,
|
||||
].join('\n')).join('\n')
|
||||
: source.map((node) => [
|
||||
]).join('\n')
|
||||
: source.flatMap((node) => [
|
||||
node.type !== 'Plain' && (node.type !== 'Sample' || !cnt) ? `## ${node.sectionTitle}` : '',
|
||||
...node.type === 'Sample'
|
||||
? [
|
||||
@@ -41,7 +41,7 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
|
||||
'',
|
||||
node.text,
|
||||
'',
|
||||
].join('\n')).join('\n');
|
||||
]).join('\n');
|
||||
}
|
||||
return type === 'html'
|
||||
? [
|
||||
@@ -60,9 +60,9 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
|
||||
...source.source ? [`<h2>${_('Source')}</h2>`, source.source] : [],
|
||||
].join('\n')
|
||||
: [
|
||||
...source.description ? [`## ${_('Description')}`, source.description] : [],
|
||||
...source.input ? [`## ${_('Input Format')}`, source.input] : [],
|
||||
...source.output ? [`## ${_('Output Format')}`, source.output] : [],
|
||||
...source.description ? [`## ${_('Description')}`, '', source.description, ''] : [],
|
||||
...source.input ? [`## ${_('Input Format')}`, '', source.input, ''] : [],
|
||||
...source.output ? [`## ${_('Output Format')}`, '', source.output, ''] : [],
|
||||
...(source.samples).map((sample, i) => [
|
||||
`\`\`\`input${i + 1}`,
|
||||
sample[0],
|
||||
@@ -72,8 +72,8 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
|
||||
'```',
|
||||
].join('\n')),
|
||||
...source.samplesRaw ? [source.samplesRaw] : [],
|
||||
...source.hint ? [`## ${_('Hint')}`, source.hint] : [],
|
||||
...source.source ? [`## ${_('Source')}`, source.source] : [],
|
||||
...source.hint ? [`## ${_('Hint')}`, '', source.hint, ''] : [],
|
||||
...source.source ? [`## ${_('Source')}`, '', source.source, ''] : [],
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user