function main() {
	var fpath;
	var file;
	var opts;
	var out;
	var tmp;
	var f;
	var i;

	opts = {
		'encoding': 'utf8'
	};
	for ( i = 0; i < FILE_LIST.length; i++ ) {
		f = FILE_LIST[ i ];
		fpath = resolve( __dirname, '..', 'data', f );
		file = readFileSync( fpath, opts );
		out = {};
		if ( f === 'contents.txt' ) {
			out.chapter = 'Contents';
			out.title = '';
		} else if ( f === 'epilogue.txt' ) {
			tmp = RE_TITLE.exec( file );
			if ( !tmp ) {
				throw new Error( 'Unexpected file content for file '+f+'.' );
			}
			out.chapter = 'Epilogue';
			out.title = tmp[ 1 ];
		} else if ( f === 'etymology.txt' ) {
			tmp = RE_TITLE.exec( file );
			if ( !tmp ) {
				throw new Error( 'Unexpected file content for file '+f+'.' );
			}
			out.chapter = 'Etymology';
			out.title = tmp[ 1 ];
		} else if ( f === 'extracts.txt' ) {
			tmp = RE_TITLE.exec( file );
			if ( !tmp ) {
				throw new Error( 'Unexpected file content for file '+f+'.' );
			}
			out.chapter = 'Extracts';
			out.title = tmp[ 1 ];
		} else {
			tmp = RE_CHAPTER_TITLE.exec( file );
			if ( !tmp ) {
				throw new Error( 'Unexpected file content for file '+f+'.' );
			}
			out.chapter = tmp[ 1 ];
			out.title = tmp[ 2 ];
			file = replace( file, RE_FIRST_TWO_LINES, '' );
		}
		out.text = file;
		fpath = replace( fpath, '.txt', '.json' );
		writeFileSync( fpath, JSON.stringify( out ), opts );
	}
}
Main execution sequence.

@private
@throws {Error} unexpected file content