<commit_before>var EOL = require('os').EOL;
var util = require('util');
var TextRenderer = require('./text');
var repeat = require('cli-util').repeat;
var dnl = EOL + EOL;

var elements = require('manual').elements;
var escape = require('manual').sanitize;
var strip = function(text) {
  return text.replace(/^\.[a-zA-Z]+\n/gmi, '');
}

function ManRenderer(options) {
  TextRenderer.apply(this, arguments);
}

util.inherits(ManRenderer, TextRenderer);

ManRenderer.prototype.token = function(token, parser) {
  //if(token.text === '`') {
    //console.dir(token);
  //}
}

ManRenderer.prototype.code = function(code, lang, escaped) {
  var single = !/\n/.test(code);
  //console.dir(lang);
  if(single) {
    // single line code blocks are bold
    return EOL +  '  ' + escape(code) + EOL;
  }
  //return EOL + util.format(elements.sp, escape(code));
  if(lang !== 'synopsis') {
    var lines = code.split('\n');
    lines = lines.map(function(value) {
      return '  ' + value;
    })
    code = lines.join('\n')
  }
  return EOL + elements.sp + escape(code) + EOL;
};<commit_msg>Do not indent single line synopsis code blocks.<commit_after>var EOL = require('os').EOL;
var util = require('util');
var TextRenderer = require('./text');
var repeat = require('cli-util').repeat;
var dnl = EOL + EOL;

var elements = require('manual').elements;
var escape = require('manual').sanitize;
var strip = function(text) {
  return text.replace(/^\.[a-zA-Z]+\n/gmi, '');
}

function ManRenderer(options) {
  TextRenderer.apply(this, arguments);
}

util.inherits(ManRenderer, TextRenderer);

ManRenderer.prototype.token = function(token, parser) {
  //if(token.text === '`') {
    //console.dir(token);
  //}
}

ManRenderer.prototype.code = function(code, lang, escaped) {
  var single = !/\n/.test(code);
  //console.dir(lang);
  if(single) {
    // single line code blocks are bold
    return EOL +  (lang !== 'synopsis' ? '  ' : '') + escape(code) + EOL;
  }
  //return EOL + util.format(elements.sp, escape(code));
  if(lang !== 'synopsis') {
    var lines = code.split('\n');
    lines = lines.map(function(value) {
      return '  ' + value;
    })
    code = lines.join('\n')
  }
  return EOL + elements.sp + escape(code) + EOL;
};
{'fraction_non_alphanumeric': 0.19201435621354868, 'fraction_numerical': 0.0, 'mean_word_length': 3.5417515274949083, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3990482', 'n_tokens_mistral': 767, 'n_tokens_neox': 766, 'n_words': 163}