<commit_before>import { first, ready, select } from '../../util'
import * as downloads from './downloads'
import * as references from './references'
import DateTimeFormat = Intl.DateTimeFormat

const dateFormatter = new DateTimeFormat('en-US', {
  month: 'short',
  day: 'numeric',
  year: 'numeric',
})

const formatDate = (dateEl: Element | null): void => {
  if (dateEl instanceof Element) {
    const date = new Date(dateEl.innerHTML)
    dateEl.innerHTML = dateFormatter.format(date)
  }
}

const getArticleId = (): string => {
  const selector =
    ':--identifier meta[content="https://registry.identifiers.org/registry/publisher-id"] ~ [itemprop="value"]'
  return first(selector)?.innerHTML ?? ''
}

ready((): void => {
  formatDate(first(':--datePublished'))

  downloads.build(
    getArticleId(),
    first(':--title')?.getAttribute('content') ?? ''
  )

  references.movePagesEnd(
    references.movePagesStart(
      references.movePeriodicalNames(
        references.moveVolumeNumbers(
          references.moveTitles(select(':--reference'))
        )
      )
    )
  )
})<commit_msg>feat(Elife): Get the article DOI<commit_after>import { first, ready, select } from '../../util'
import * as downloads from './downloads'
import * as references from './references'
import DateTimeFormat = Intl.DateTimeFormat

const dateFormatter = new DateTimeFormat('en-US', {
  month: 'short',
  day: 'numeric',
  year: 'numeric',
})

const formatDate = (dateEl: Element | null): void => {
  if (dateEl instanceof Element) {
    const date = new Date(dateEl.innerHTML)
    dateEl.innerHTML = dateFormatter.format(date)
  }
}

const getArticleId = (): string => {
  const selector =
    ':--identifier meta[content="https://registry.identifiers.org/registry/publisher-id"] ~ [itemprop="value"]'
  return first(selector)?.innerHTML ?? ''
}

const getArticleDoi = (): string => {
  const selector =
    ':--identifier meta[content="https://registry.identifiers.org/registry/doi"] ~ [itemprop="value"]'
  return first(selector)?.innerHTML ?? ''
}

ready((): void => {
  formatDate(first(':--datePublished'))

  downloads.build(
    getArticleId(),
    first(':--title')?.getAttribute('content') ?? ''
  )

  references.movePagesEnd(
    references.movePagesStart(
      references.movePeriodicalNames(
        references.moveVolumeNumbers(
          references.moveTitles(select(':--reference'))
        )
      )
    )
  )
})
{'fraction_non_alphanumeric': 0.16226259289843104, 'fraction_numerical': 0.0, 'mean_word_length': 3.732421875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1430088', 'n_tokens_mistral': 736, 'n_tokens_neox': 723, 'n_words': 146}