Skip to content

Commit 8e31c3b

Browse files
committed
Update api-ja.js
1 parent e6d04b3 commit 8e31c3b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

scripts/api-ja.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ let COMPONENT_LINK_REGEXP;
1212
const response = await fetch(
1313
'https://raw.githubusercontent.com/ionic-team/ionic-docs/translation/jp/scripts/data/translated-api.json',
1414
);
15-
15+
1616
if (!response.ok) {
1717
console.error(`Failed to fetch translated API data: ${response.status} ${response.statusText}`);
1818
return;
1919
}
20-
20+
2121
const data = await response.json();
22-
22+
2323
if (!data || !data.components) {
2424
console.error('Invalid API data structure - missing components');
2525
return;
2626
}
27-
27+
2828
const { components } = data;
2929

3030
const names = components.map((component) => component.tag.slice(4));
@@ -57,13 +57,13 @@ function writePage(page) {
5757
data = data.replace(COMPONENT_LINK_REGEXP, '($1.md$2)');
5858

5959
const filePath = `i18n/ja/docusaurus-plugin-content-docs/current/api/${page.tag.slice(4)}.md`;
60-
60+
6161
// Ensure directory exists
6262
const dir = path.dirname(filePath);
6363
if (!fs.existsSync(dir)) {
6464
fs.mkdirSync(dir, { recursive: true });
6565
}
66-
66+
6767
fs.writeFileSync(filePath, data);
6868
} catch (error) {
6969
console.error(`Error writing page for ${page.tag}:`, error);
@@ -99,15 +99,15 @@ function renderReadme(page) {
9999
console.warn(`Missing readme for component: ${page?.tag || 'unknown'}`);
100100
return '';
101101
}
102-
102+
103103
const readme = page.readme;
104104
const endIndex = readme.indexOf('\n');
105-
105+
106106
// Add additional safety check
107107
if (endIndex === -1) {
108108
return readme; // Return the whole readme if no newline found
109109
}
110-
110+
111111
const title = readme.substring(0, endIndex);
112112
const rest = readme.substring(endIndex);
113113

0 commit comments

Comments
 (0)