<commit_before>import { Component, Modal } from 'substance'
import EntityEditor from '../../entities/EntityEditor'
import entityRenderers from '../../entities/entityRenderers'

export default class Bibliography extends Component {

  getInitialState() {
    return {
      entityId: undefined
    }
  }

  render($$) {
    let el = $$('div').addClass('sc-bibliography')
    let editorSession = this.context.editorSession
    let entityDb = this.context.editorSession.getDocument()

    if (this.state.editEntity) {
      var modal = $$(Modal, {
        width: 'medium',
        textAlign: 'center'
      })

      modal.append(
        $$(EntityEditor, {
          editorSession: editorSession,
          node: entityDb.get(this.state.entityId)
        })
      )
    }

    this.context.referenceManager.getBibliography().forEach((reference) => {
      let fragments = entityRenderers[reference.type]($$, reference.id, entityDb)
      el.append(
        $$('div').addClass('se-reference').append(
          $$('div').addClass('se-text').append(
            ...fragments
          ),
          $$('div').addClass('se-actions').append(
            $$('button').append('Edit').on('click', this._toggleEditor.bind(this, reference.id)),
            $$('button').append('Delete')
          )
        )
      )
    })
    return el
  }

  _toggleEditor(referenceId) {
    console.log('TODO: open editor for ', referenceId)
  }
}
<commit_msg>Linting.<commit_after>import { Component, Modal } from 'substance'
import EntityEditor from '../../entities/EntityEditor'
import entityRenderers from '../../entities/entityRenderers'

export default class Bibliography extends Component {

  getInitialState() {
    return {
      entityId: undefined
    }
  }

  render($$) {
    let el = $$('div').addClass('sc-bibliography')
    let editorSession = this.context.editorSession
    let entityDb = this.context.editorSession.getDocument()

    if (this.state.editEntity) {
      var modal = $$(Modal, {
        width: 'medium',
        textAlign: 'center'
      })

      modal.append(
        $$(EntityEditor, {
          editorSession: editorSession,
          node: entityDb.get(this.state.entityId)
        })
      )
    }

    this.context.referenceManager.getBibliography().forEach((reference) => {
      let fragments = entityRenderers[reference.type]($$, reference.id, entityDb)
      el.append(
        $$('div').addClass('se-reference').append(
          $$('div').addClass('se-text').append(
            ...fragments
          ),
          $$('div').addClass('se-actions').append(
            $$('button').append('Edit').on('click', this._toggleEditor.bind(this, reference.id)),
            $$('button').append('Delete')
          )
        )
      )
    })
    return el
  }

  _toggleEditor(referenceId) {
    console.warn('TODO: open editor for ', referenceId)
  }
}

{'fraction_non_alphanumeric': 0.15736217725052337, 'fraction_numerical': 0.0, 'mean_word_length': 2.479368932038835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3089502', 'n_tokens_mistral': 817, 'n_tokens_neox': 810, 'n_words': 142}