<commit_before>use error::{Error,Result, Source};
use bookoption::BookOption;

use yaml_rust::{Yaml, YamlLoader};
use std::collections::HashMap;
use std::path::PathBuf;
use std::env;

static OPTIONS:&'static str = "
# Metadata
author:str:Anonymous                # The author of the book
title:str:Untitled                  # The title of the book
lang:str:en                         # The language of the book
subject:str                         # Subject of the book (used for EPUB metadata)
description:str                     # Description of the book (used for EPUB metadata)
cover:path                          # File name of the cover of the book 
# Output options
output.epub:path                    # Output file name for EPUB rendering
output.html:path                    # Output file name for HTML rendering
output.html_dir:path                # Output directory name for HTML rendering
output.tex:path                     # Output file name for LaTeX rendering
output.pdf:path                     # Output file name for PDF rendering
output.odt:path                     # Output file name for ODT rendering

# Resources option
resources.base_path:path                 # Path where to find resources (in the source tree). By default, links and images are relative to the Markdown file. If this is set, it will be to this path. 
resources.base_path.links:path           # Set base path but only for links. Useless if resources.base_path is set.
resources.base_path.images:path:.        # Set base path but only for images. Useless if resources.base_path is set.
resources.base_path.files:path:.         # Set base path but only for additional files. Useless if resources.base_path is set.
resources.out_path:path:data        # Paths where additional resources should be copied in the EPUB file or HTML directory 
resources.files:str                 # Whitespace-separated list of files to embed in e.g. EPUB file ; useful for including additional fonts

# Misc options
enable_yaml_blocks:bool:false       # Enable inline YAML blocks to override options set in config file
zip.command:str:zip                 # Command to use to zip files (for EPUB/ODT)
numbering:int:1                     # The  maximum heading levels to number (0: no numbering, 1: only chapters, ..., 6: all)
display_toc:bool:false              # If true, display a table of content in the document
toc_name:str:Table of contents      # Name of the table of contents if toc is displayed in line
autoclean:bool:true                 # Toggles cleaning of input markdown (not used for LaTeX)
verbose:bool:false                  # If set to true, print warnings in Markdown processing
side_notes:bool:false               # Display footnotes as side notes in HTML/Epub
temp_dir:path:                      # Path where to create a temporary directory (default: uses result from Rust's std::env::temp_dir())
numbering_template:str:\"{{number}}. {{title}}\" # Format of numbered titles


# HTML options
html.template:path                  # Path of an HTML template
html.css:path                       # Path of a stylesheet to use with HTML rendering
html.print_css:path                 # Path of a stylesheet to use with media print in HTML rendering
html.script:path                    # Path of a javascript file
html.display_chapter:bool:false      # Display one chapter at a time (with option to display all)

# Multifile HTML options
html_dir.script:path                # Path of a javascript file
html_dir.css:path                   # Path of a CSS template
html_dir.index.html:path            # Path of index.html template
html_dir.chapter.html:path          # Path of a chapter.html template

# EPUB options
epub.version:int:2                  # The EPUB version to generate
epub.css:path                       # Path of a stylesheet to use with EPUB rendering
epub.template:path                  # Path of an epub template for chapter

# LaTeX options
tex.short:bool:false                # If set to true, use article class instead of book and the default `\\maketitle` command
tex.links_as_footnotes:bool:true    # If set to true, will add foontotes to URL of links in LaTeX/PDF output
tex.command:str:pdflatex            # LaTeX flavour to use for generating PDF
tex.template:path                   # Path of a LaTeX template file

# Deprecated options
base_path:alias:resources.base_path  # Renamed
base_path.links:alias:resources.base_path.links  # Renamed
base_path.images:alias:resources.base_path.images  # Renamed
nb_char:alias # Removed
";



/// Contains the options of a book.<commit_msg>Rename side_notes to html.side_notes, reorganize order of options<commit_after>use error::{Error,Result, Source};
use bookoption::BookOption;

use yaml_rust::{Yaml, YamlLoader};
use std::collections::HashMap;
use std::path::PathBuf;
use std::env;

static OPTIONS:&'static str = "
# Metadata
author:str:Anonymous                # The author of the book
title:str:Untitled                  # The title of the book
lang:str:en                         # The language of the book
subject:str                         # Subject of the book (used for EPUB metadata)
description:str                     # Description of the book (used for EPUB metadata)
cover:path                          # File name of the cover of the book 
# Output options
output.epub:path                    # Output file name for EPUB rendering
output.html:path                    # Output file name for HTML rendering
output.html_dir:path                # Output directory name for HTML rendering
output.tex:path                     # Output file name for LaTeX rendering
output.pdf:path                     # Output file name for PDF rendering
output.odt:path                     # Output file name for ODT rendering

# Misc options
numbering_template:str:\"{{number}}. {{title}}\" # Format of numbered titles
numbering:int:1                     # The  maximum heading levels to number (0: no numbering, 1: only chapters, ..., 6: all)
display_toc:bool:false              # If true, display a table of content in the document
toc_name:str:Table of contents      # Name of the table of contents if toc is displayed in line
verbose:bool:false                  # If set to true, print warnings in Markdown processing

# HTML options
html.template:path                  # Path of an HTML template
html.css:path                       # Path of a stylesheet to use with HTML rendering
html.print_css:path                 # Path of a stylesheet to use with media print in HTML rendering
html.script:path                    # Path of a javascript file
html.display_chapter:bool:false     # Display one chapter at a time (with option to display all)
html.side_notes:bool:false          # Display footnotes as side notes in HTML/Epub (experimental)

# Multifile HTML options
html_dir.script:path                # Path of a javascript file
html_dir.css:path                   # Path of a CSS template
html_dir.index.html:path            # Path of index.html template
html_dir.chapter.html:path          # Path of a chapter.html template

# EPUB options
epub.version:int:2                  # The EPUB version to generate
epub.css:path                       # Path of a stylesheet to use with EPUB rendering
epub.template:path                  # Path of an epub template for chapter

# LaTeX options
tex.short:bool:false                # If set to true, use article class instead of book and the default `\\maketitle` command
tex.links_as_footnotes:bool:true    # If set to true, will add foontotes to URL of links in LaTeX/PDF output
tex.command:str:pdflatex            # LaTeX flavour to use for generating PDF
tex.template:path                   # Path of a LaTeX template file

# Advanced options
enable_yaml_blocks:bool:false       # Enable inline YAML blocks to override options set in config file
zip.command:str:zip                 # Command to use to zip files (for EPUB/ODT)
autoclean:bool:true                 # Toggles cleaning of input markdown (not used for LaTeX)
side_notes:bool:false               # Display footnotes as side notes in HTML/Epub
temp_dir:path:                      # Path where to create a temporary directory (default: uses result from Rust's std::env::temp_dir())

# Resources option
resources.base_path:path                 # Path where to find resources (in the source tree). By default, links and images are relative to the Markdown file. If this is set, it will be to this path. 
resources.base_path.links:path           # Set base path but only for links. Useless if resources.base_path is set.
resources.base_path.images:path:.        # Set base path but only for images. Useless if resources.base_path is set.
resources.base_path.files:path:.         # Set base path but only for additional files. Useless if resources.base_path is set.
resources.out_path:path:data        # Paths where additional resources should be copied in the EPUB file or HTML directory 
resources.files:str                 # Whitespace-separated list of files to embed in e.g. EPUB file ; useful for including additional fonts

# Deprecated options
base_path:alias:resources.base_path  # Renamed
base_path.links:alias:resources.base_path.links  # Renamed
base_path.images:alias:resources.base_path.images  # Renamed
side_notes:alias:html.side_notes # Renamed
nb_char:alias # Removed
";



/// Contains the options of a book.
{'fraction_non_alphanumeric': 0.06378666666666667, 'fraction_numerical': 0.0010666666666666667, 'mean_word_length': 2.5301204819277108, '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': '200592', 'n_tokens_mistral': 2485, 'n_tokens_neox': 2392, 'n_words': 995}