mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 10:07:33 +02:00
ESLintify Part 1 (#837)
* ESLint-ify * Allow empty try/catch * Escape regexp
This commit is contained in:
parent
128dbfca0a
commit
e8e3f42685
44 changed files with 466 additions and 555 deletions
|
@ -5,19 +5,31 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const classNames = require('classnames');
|
||||
const React = require('react');
|
||||
|
||||
const BlogPost = require('./BlogPost.js');
|
||||
const BlogSidebar = require('./BlogSidebar.js');
|
||||
const Container = require('./Container.js');
|
||||
const Site = require('./Site.js');
|
||||
const OnPageNav = require('./nav/OnPageNav.js');
|
||||
const utils = require('./utils.js');
|
||||
const classNames = require('classnames');
|
||||
|
||||
// used for entire blog posts, i.e., each written blog article with sidebar with site header/footer
|
||||
class BlogPostLayout extends React.Component {
|
||||
getDescription() {
|
||||
const descLines = this.props.children.trim().split('\n');
|
||||
for (let i = 0; i < descLines.length; i++) {
|
||||
// Don't want blank lines or descriptions that are raw image rendering strings.
|
||||
if (descLines[i] && !descLines[i].startsWith('![')) {
|
||||
return descLines[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
renderSocialButtons() {
|
||||
let post = this.props.metadata;
|
||||
const post = this.props.metadata;
|
||||
post.path = utils.getPath(post.path, this.props.config.cleanUrl);
|
||||
|
||||
const fbComment = this.props.config.facebookAppId &&
|
||||
|
@ -72,8 +84,9 @@ class BlogPostLayout extends React.Component {
|
|||
}
|
||||
data-related={this.props.config.twitter}
|
||||
data-via={post.authorTwitter}
|
||||
data-show-count="false"
|
||||
/>
|
||||
data-show-count="false">
|
||||
Tweet
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
@ -86,17 +99,6 @@ class BlogPostLayout extends React.Component {
|
|||
);
|
||||
}
|
||||
|
||||
getDescription() {
|
||||
const descLines = this.props.children.trim().split('\n');
|
||||
for (var i = 0; i < descLines.length; i++) {
|
||||
// Don't want blank lines or descriptions that are raw image rendering strings
|
||||
if (descLines[i] && !descLines[i].startsWith('![')) {
|
||||
return descLines[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
render() {
|
||||
const hasOnPageNav = this.props.config.onPageNav === 'separate';
|
||||
const post = this.props.metadata;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue