Skip to content

Commit f1d8bde

Browse files
authored
Change how newlines are output in yaml file remarks (#2349)
1 parent 929a858 commit f1d8bde

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

generate-docs/scripts/postprocessor.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { generateEnumList } from './util';
44
import * as fsx from 'fs-extra';
55
import * as jsyaml from "js-yaml";
66
import * as path from "path";
7-
import * as os from "os";
8-
9-
const EOL = os.EOL;
107

118

129
const OLDEST_EXCEL_RELEASE_WITH_CUSTOM_FUNCTIONS = 9;
@@ -128,7 +125,7 @@ const docsDestination = path.resolve("../../docs/docs-ref-autogen");
128125
const tocTemplateLocation = path.resolve("../../docs");
129126

130127
tryCatch(async () => {
131-
console.log(`${EOL}Starting postprocessor script...`);
128+
console.log(`\nStarting postprocessor script...`);
132129

133130
console.log(`Deleting old docs at: ${docsDestination}`);
134131
// delete everything except the 'overview' folder from the /docs folder
@@ -257,7 +254,7 @@ tryCatch(async () => {
257254
fsx.removeSync(docsDestination + "/office_release/toc.yml");
258255
fsx.removeSync(docsDestination + "/office-runtime/toc.yml");
259256

260-
console.log(`${EOL}Postprocessor script complete${EOL}`);
257+
console.log(`\nPostprocessor script complete\n`);
261258

262259
process.exit(0);
263260
});
@@ -397,7 +394,7 @@ function fixToc(tocPath: string, globalToc: Toc, hostName: string, versionNumber
397394
}
398395

399396
function fixCommonToc(tocPath: string, globalToc: Toc): Toc {
400-
console.log(`${EOL}Updating the structure of the Common TOC file: ${tocPath}`);
397+
console.log(`\nUpdating the structure of the Common TOC file: ${tocPath}`);
401398

402399
let origToc = (jsyaml.load(fsx.readFileSync(tocPath).toString()) as Toc);
403400
let runtimeToc = (jsyaml.load(fsx.readFileSync(path.resolve("../../docs/docs-ref-autogen/office-runtime/toc.yml")).toString()) as Toc);
@@ -483,7 +480,7 @@ function cleanUpYmlFile(ymlFile: string, hostName: string): string {
483480

484481
// Add links for type aliases.
485482
if (apiYaml.uid.endsWith(":type") && (apiYaml.uid.indexOf("Office") < 0)) {
486-
let remarks = `${EOL}${EOL}Learn more about the types in this type alias through the following links. ${EOL}${EOL}`
483+
let remarks = `\n\nLearn more about the types in this type alias through the following links. \n\n`
487484
apiYaml.syntax.substring(apiYaml.syntax.indexOf('=')).match(/[\w]+/g).forEach((match, matchIndex, matches) => {
488485
remarks += `[${capitalizeFirstLetter(hostName)}.${match}](/javascript/api/${hostName}/${hostName}.${match.toLowerCase()})`;
489486
if (matchIndex < matches.length - 1) {
@@ -493,7 +490,7 @@ function cleanUpYmlFile(ymlFile: string, hostName: string): string {
493490

494491
let exampleIndex = apiYaml.remarks.indexOf("#### Examples");
495492
if (exampleIndex > 0) {
496-
apiYaml.remarks = `${apiYaml.remarks.substring(0, exampleIndex)}${remarks}${EOL}${EOL}${apiYaml.remarks.substring(exampleIndex)}`;
493+
apiYaml.remarks = `${apiYaml.remarks.substring(0, exampleIndex)}${remarks}\n\n${apiYaml.remarks.substring(exampleIndex)}`;
497494
} else {
498495
apiYaml.remarks += remarks;
499496
}

0 commit comments

Comments
 (0)