mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
Add Prettier Formatting (#258)
* Add Prettier formatting to source files and example files, and check that Prettier formatting is maintained on PRs * Remove trailing-comma as we are using Node 6 on Circle * Use latest Node 6 LTS version in Circle * Remove unused test
This commit is contained in:
parent
0cead4b6f9
commit
65421db62e
50 changed files with 1376 additions and 1350 deletions
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const React = require("react");
|
||||
const fs = require("fs");
|
||||
const HeaderNav = require("./nav/HeaderNav.js");
|
||||
const Head = require("./Head.js");
|
||||
const Footer = require(process.cwd() + "/core/Footer.js");
|
||||
const translation = require("../server/translation.js");
|
||||
const React = require('react');
|
||||
const fs = require('fs');
|
||||
const HeaderNav = require('./nav/HeaderNav.js');
|
||||
const Head = require('./Head.js');
|
||||
const Footer = require(process.cwd() + '/core/Footer.js');
|
||||
const translation = require('../server/translation.js');
|
||||
|
||||
const CWD = process.cwd();
|
||||
|
||||
|
@ -18,28 +18,28 @@ const CWD = process.cwd();
|
|||
class Site extends React.Component {
|
||||
render() {
|
||||
const tagline = translation[this.props.language]
|
||||
? translation[this.props.language]["localized-strings"].tagline
|
||||
? translation[this.props.language]['localized-strings'].tagline
|
||||
: this.props.config.tagline;
|
||||
const title = this.props.title
|
||||
? this.props.title + " · " + this.props.config.title
|
||||
? this.props.title + ' · ' + this.props.config.title
|
||||
: (!this.props.config.disableTitleTagline &&
|
||||
this.props.config.title + " · " + tagline) ||
|
||||
this.props.config.title + ' · ' + tagline) ||
|
||||
this.props.config.title;
|
||||
const description = this.props.description || tagline;
|
||||
const url =
|
||||
this.props.config.url +
|
||||
this.props.config.baseUrl +
|
||||
(this.props.url || "index.html");
|
||||
(this.props.url || 'index.html');
|
||||
let latestVersion;
|
||||
|
||||
const highlightDefaultVersion = "9.12.0";
|
||||
const highlightDefaultVersion = '9.12.0';
|
||||
const highlightConfig = this.props.config.highlight || {
|
||||
version: highlightDefaultVersion,
|
||||
theme: "default"
|
||||
theme: 'default',
|
||||
};
|
||||
const highlightVersion = highlightConfig.version || highlightDefaultVersion;
|
||||
if (fs.existsSync(CWD + "/versions.json")) {
|
||||
latestVersion = require(CWD + "/versions.json")[0];
|
||||
if (fs.existsSync(CWD + '/versions.json')) {
|
||||
latestVersion = require(CWD + '/versions.json')[0];
|
||||
}
|
||||
return (
|
||||
<html>
|
||||
|
@ -78,24 +78,24 @@ class Site extends React.Component {
|
|||
|
||||
ga('create', '${this.props.config.gaTrackingId}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
`
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{this.props.config.facebookAppId && (
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.fbAsyncInit = function() {FB.init({appId:'${this
|
||||
.props.config
|
||||
.facebookAppId}',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
|
||||
`
|
||||
__html: `window.fbAsyncInit = function() {FB.init({appId:'${
|
||||
this.props.config.facebookAppId
|
||||
}',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{this.props.config.twitter && (
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));`
|
||||
__html: `window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
@ -111,10 +111,10 @@ class Site extends React.Component {
|
|||
algoliaOptions: ${JSON.stringify(
|
||||
this.props.config.algolia.algoliaOptions
|
||||
)
|
||||
.replace("VERSION", this.props.version || latestVersion)
|
||||
.replace("LANGUAGE", this.props.language)}
|
||||
.replace('VERSION', this.props.version || latestVersion)
|
||||
.replace('LANGUAGE', this.props.language)}
|
||||
});
|
||||
`
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
|
@ -126,7 +126,7 @@ class Site extends React.Component {
|
|||
indexName: '${this.props.config.algolia.indexName}',
|
||||
inputSelector: '#search_input_react'
|
||||
});
|
||||
`
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue