Skip to content

Commit

Permalink
consisten guide naming, phetsims/studio#250
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Feb 17, 2022
1 parent 1bbd6c9 commit 54c1dbf
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions js/grunt/copySupplementalPhetioFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,20 +494,18 @@ const handleClientGuides = ( repoName, simulationDisplayName, buildDir ) => {
}

// handle generating and writing the html file for each client guide
generateAndWriteClientGuide( repoName, simulationDisplayName, PHET_IO_GUIDE_FILENAME, `${clientGuidesSourceRoot}${PHET_IO_GUIDE_FILENAME}.md`, `${builtClientGuidesOutputDir}${PHET_IO_GUIDE_FILENAME}.html` );
generateAndWriteClientGuide( repoName, simulationDisplayName, EXAMPLES_FILENAME, `${clientGuidesSourceRoot}${EXAMPLES_FILENAME}.md`, `${builtClientGuidesOutputDir}${EXAMPLES_FILENAME}.html` );
generateAndWriteClientGuide( repoName, simulationDisplayName, PHET_IO_MIGRATION_GUIDE_FILENAME, `${clientGuidesSourceRoot}${PHET_IO_MIGRATION_GUIDE_FILENAME}.md`, `${builtClientGuidesOutputDir}${PHET_IO_MIGRATION_GUIDE_FILENAME}.html` );
generateAndWriteClientGuide( repoName, `${simulationDisplayName} PhET-iO Guide`, `${clientGuidesSourceRoot}${PHET_IO_GUIDE_FILENAME}.md`, `${builtClientGuidesOutputDir}${PHET_IO_GUIDE_FILENAME}.html` );
generateAndWriteClientGuide( repoName, `${simulationDisplayName} Examples`, `${clientGuidesSourceRoot}${EXAMPLES_FILENAME}.md`, `${builtClientGuidesOutputDir}${EXAMPLES_FILENAME}.html` );
generateAndWriteClientGuide( repoName, `${simulationDisplayName} Migration Guide`, `${clientGuidesSourceRoot}${PHET_IO_MIGRATION_GUIDE_FILENAME}.md`, `${builtClientGuidesOutputDir}${PHET_IO_MIGRATION_GUIDE_FILENAME}.html` );
};

/**
* Takes a markdown client guides, fills in the links, and then generates and writes it as html
* @param {string} repoName
* @param {string} simulationDisplayName
* @param {string} contentFileNameNoSuffix
* @param {string} mdFilePath - to get the source md file
* @param {string} destinationPath - to write to
*/
const generateAndWriteClientGuide = ( repoName, simulationDisplayName, contentFileNameNoSuffix, mdFilePath, destinationPath ) => {
const generateAndWriteClientGuide = ( repoName, title, mdFilePath, destinationPath ) => {

// make sure the source markdown file exists
if ( !fs.existsSync( mdFilePath ) ) {
Expand All @@ -530,7 +528,7 @@ const generateAndWriteClientGuide = ( repoName, simulationDisplayName, contentFi
// link a stylesheet
const clientGuideHTML = `<head>
<link rel='stylesheet' href='common/css/github-markdown.css' type='text/css'>
<title>${simulationDisplayName}: ${contentFileNameNoSuffix}</title>
<title>${title}</title>
</head>
<body>
<div class="markdown-body">
Expand Down

0 comments on commit 54c1dbf

Please sign in to comment.