<commit_before>'use strict';

// Load modules
var Joi = require('joi');
var Hoek = require('hoek');
var Path = require('path');
var Handlebars = require('handlebars');


// Declare internals

var internals = {
    defaults: {
        endpoint: '/docs',
        auth: false,
        cssPath: Path.join(__dirname, '../public/css'),
        helpersPath: Path.join(__dirname, '../templates/helpers'),
        indexTemplate: 'index',
        routeTemplate: 'route',
        methodsOrder: ['get', 'head', 'post', 'put', 'delete', 'trace']
    }
};


exports.register = function (plugin, options, next) {

    var settings = Hoek.clone(internals.defaults);
    Hoek.merge(settings, options);

    var cssBaseUrl = (settings.endpoint === '/' ? '' : settings.endpoint) + '/css';

    plugin.views({
        engines: settings.engines || { html: { module: Handlebars } },
        path: Path.join(__dirname, '../templates'),
        basePath: settings.basePath,
        partialsPath: Path.join(__dirname, '../templates'),
        helpersPath: settings.helpersPath,
        runtimeOptions: {
            data: {
                cssBaseUrl: cssBaseUrl
            }
        }
    });

    plugin.route({
        method: 'GET',
        path: settings.endpoint,
        config: internals.docs(settings, plugin)
    });

    if (settings.cssPath) {
        plugin.route({
            method: 'GET',
            path: cssBaseUrl + '/{path*}',
            config: {
                handler: {<commit_msg>fix basePath in lout config<commit_after>'use strict';

// Load modules
var Joi = require('joi');
var Hoek = require('hoek');
var Path = require('path');
var Handlebars = require('handlebars');


// Declare internals

var internals = {
    defaults: {
        endpoint: '/docs',
        auth: false,
        cssPath: Path.join(__dirname, '../public/css'),
        helpersPath: Path.join(__dirname, '../templates/helpers'),
        indexTemplate: 'index',
        routeTemplate: 'route',
        methodsOrder: ['get', 'head', 'post', 'put', 'delete', 'trace'],
        basePath: Path.join(__dirname, '../')
    }
};


exports.register = function (plugin, options, next) {

    var settings = Hoek.clone(internals.defaults);
    Hoek.merge(settings, options);

    var cssBaseUrl = (settings.endpoint === '/' ? '' : settings.endpoint) + '/css';
    var basePath = Path.join(settings.basePath, './templates');

    plugin.views({
        engines: settings.engines || { html: { module: Handlebars } },
        path: basePath,
        partialsPath: Path.join(__dirname, '../templates'),
        helpersPath: settings.helpersPath,
        runtimeOptions: {
            data: {
                cssBaseUrl: cssBaseUrl
            }
        }
    });

    plugin.route({
        method: 'GET',
        path: settings.endpoint,
        config: internals.docs(settings, plugin)
    });

    if (settings.cssPath) {
        plugin.route({
            method: 'GET',
            path: cssBaseUrl + '/{path*}',
            config: {
                handler: {
{'fraction_non_alphanumeric': 0.15643564356435644, 'fraction_numerical': 0.0, 'mean_word_length': 2.2486602357984995, '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': '169862', 'n_tokens_mistral': 870, 'n_tokens_neox': 857, 'n_words': 197}