import React from 'react'; import { Link } from 'react-router'; import ImagePreview from './ImagePreview'; import VideoPlayer from './VideoPlayer'; import * as utils from '../utils'; export default class Article extends React.Component { constructor(props) { super(props); this.imgToPreview = this.imgToPreview.bind(this); this.enhanceVideo = this.enhanceVideo.bind(this); } isPreviewImg(string) { return /^; } isVideo(string) { return /^; } render() { const { content, location } = this.props; const jumper = content.description.filter((node) => { return node.type === 'h2'; }).map((node) => { return (
  • ); }); content.description = content.description .map(this.imgToPreview) .map(this.enhanceVideo); return (

    { content.meta.chinese || content.meta.english } { !content.meta.subtitle ? null : { content.meta.subtitle } }

    { !content.intro ? null : content.intro.map(utils.objectToComponent.bind(null, location.pathname)) } { jumper.length > 0 ?
      { jumper }
    : null } { content.description.map(utils.objectToComponent.bind(null, location.pathname)) }
    ); } }