<commit_before><?php

  // cleanup requested filepath
  $_GET['f'] = isset($_GET['f']) ? $_GET['f'] : 'spotlight';
  $_GET['f'] = preg_replace('#(\.*[\/])+#', '', $_GET['f']);
  $_GET['f'] = $_GET['f'] . (preg_match('/\.[a-z]+$/', $_GET['f']) ? '' : '.js');

  // output filename
  $_GET['o'] = isset($_GET['o']) ? $_GET['o'] : basename($_GET['f']);

  /*--------------------------------------------------------------------------*/

  require('../vendor/docdown/docdown.php');

  // generate Markdown
  $markdown = docdown(array(
    'path' => '../' . $_GET['f'],
    'url'  => 'https://github.com/bestiejs/spotlight/blob/master/spotlight.js'
  ));

  // save to a .md file
  file_put_contents($_GET['o'] . '.md', $markdown);

  // print<commit_msg>Doc parser: allow passing the output filename as a command-line argument, e.g.<commit_after><?php

  // cleanup requested filepath
  $file = isset($_GET['f']) ? $_GET['f'] : 'spotlight';
  $file = preg_replace('#(\.*[\/])+#', '', $file);
  $file .= preg_match('/\.[a-z]+$/', $file) ? '' : '.js';

  // output filename
  $output = isset($_GET['o'])
    ? $_GET['o'] : isset($_SERVER['argv'][1])
    ? $_SERVER['argv'][1] : basename($file);

  /*--------------------------------------------------------------------------*/

  require('../vendor/docdown/docdown.php');

  // generate Markdown
  $markdown = docdown(array(
    'path' => '../' . $file,
    'url'  => 'https://github.com/bestiejs/spotlight/blob/master/spotlight.js'
  ));

  // save to a .md file
  file_put_contents($output . '.md', $markdown);

  // print
{'fraction_non_alphanumeric': 0.34716017868538607, 'fraction_numerical': 0.0012763241863433313, 'mean_word_length': 2.25987525987526, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '5405271', 'n_tokens_mistral': 536, 'n_tokens_neox': 524, 'n_words': 91}