<commit_before>import { PropTypes } from 'react';
import { Link } from 'react-router';
import GithubFragment from './github_fragment';

const Fragment = ({ routeName, text, github, url }) => {
  if (routeName) {
    return <Link to={routeName}>{text}</Link>;
  } else if (github) {
    return <GithubFragment github={github} />;
  } else if (url) {
    return <a href={url}>{text || url}</a>;
  }

  return <span>{text}</span>;
};

Fragment.propTypes = {
  github: PropTypes.string,
  routeName: PropTypes.string,<commit_msg>Make outside links open new tab<commit_after>import { PropTypes } from 'react';
import { Link } from 'react-router';
import GithubFragment from './github_fragment';

const Fragment = ({ routeName, text, github, url }) => {
  if (routeName) {
    return <Link to={routeName}>{text}</Link>;
  } else if (github) {
    return <GithubFragment github={github} />;
  } else if (url) {
    return (
      <a href={url} target={url.match(/https?:/) ? '_blank': null}>
        {text || url}
      </a>
    );
  }

  return <span>{text}</span>;
};

Fragment.propTypes = {
  github: PropTypes.string,
  routeName: PropTypes.string,
{'fraction_non_alphanumeric': 0.17467248908296942, 'fraction_numerical': 0.0, 'mean_word_length': 3.7160493827160495, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2335472', 'n_tokens_mistral': 372, 'n_tokens_neox': 367, 'n_words': 95}