<commit_before>option(WITH_TUTORIALS "Build tutorials (requires Sphinx)" TRUE)
if(WITH_TUTORIALS)
  find_package(Sphinx)
endif(WITH_TUTORIALS)

if(SPHINX_FOUND)
  file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html")
  if(WIN32)
    set(TMPDIR "$ENV{TEMP}")
  else()
    set(TMPDIR "/tmp")
  endif()
  file(TO_CMAKE_PATH "${TMPDIR}" TMPDIR)
  add_custom_target(tutorials
                    COMMAND "${CMAKE_COMMAND}" -E remove_directory "${TMPDIR}/doctrees"
                    COMMAND "${SPHINX_EXECUTABLE}" -b html -a -d "${TMPDIR}/doctrees" "${CMAKE_CURRENT_SOURCE_DIR}/content" html
                    COMMAND "${SPHINX_EXECUTABLE}" -b html -a -d "${TMPDIR}/doctrees" "${CMAKE_CURRENT_SOURCE_DIR}/../advanced/content" ../advanced/html
                    )
  if(USE_PROJECT_FOLDERS)
    set_target_properties(tutorials PROPERTIES FOLDER "Documentation")
  endif(USE_PROJECT_FOLDERS)
  install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html"
          DESTINATION "${DOC_INSTALL_DIR}/tutorials"
          COMPONENT doc)
  install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/content/sources"
          DESTINATION "${DOC_INSTALL_DIR}/tutorials"
          COMPONENT doc
          PATTERN ".svn" EXCLUDE)
  if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../advanced/html")
    install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../advanced/html"
            DESTINATION "${DOC_INSTALL_DIR}/advanced"
            COMPONENT doc)
  endif()
    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../advanced/content/files")
    install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../advanced/content/files"
            DESTINATION "${DOC_INSTALL_DIR}/advanced"
            COMPONENT doc<commit_msg>Add cmake option to choose HTML file suffix for Sphinx<commit_after>option(WITH_TUTORIALS "Build tutorials (requires Sphinx)" TRUE)
if(WITH_TUTORIALS)
  find_package(Sphinx)
endif(WITH_TUTORIALS)

if(SPHINX_FOUND)
  set(SPHINX_HTML_FILE_SUFFIX "html" CACHE STRING "Suffix (extension) of the HTML files generated by Sphinx")
  file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html")
  if(WIN32)
    set(TMPDIR "$ENV{TEMP}")
  else()
    set(TMPDIR "/tmp")
  endif()
  file(TO_CMAKE_PATH "${TMPDIR}" TMPDIR)
  add_custom_target(tutorials
                    COMMAND "${CMAKE_COMMAND}" -E remove_directory "${TMPDIR}/doctrees"
                    COMMAND "${SPHINX_EXECUTABLE}" -b html -a -d "${TMPDIR}/doctrees" -D html_file_suffix=".${SPHINX_HTML_FILE_SUFFIX}" "${CMAKE_CURRENT_SOURCE_DIR}/content" html
                    COMMAND "${SPHINX_EXECUTABLE}" -b html -a -d "${TMPDIR}/doctrees" -D html_file_suffix=".${SPHINX_HTML_FILE_SUFFIX}" "${CMAKE_CURRENT_SOURCE_DIR}/../advanced/content" ../advanced/html
                    )
  if(USE_PROJECT_FOLDERS)
    set_target_properties(tutorials PROPERTIES FOLDER "Documentation")
  endif(USE_PROJECT_FOLDERS)
  install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html"
          DESTINATION "${DOC_INSTALL_DIR}/tutorials"
          COMPONENT doc)
  install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/content/sources"
          DESTINATION "${DOC_INSTALL_DIR}/tutorials"
          COMPONENT doc
          PATTERN ".svn" EXCLUDE)
  if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../advanced/html")
    install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../advanced/html"
            DESTINATION "${DOC_INSTALL_DIR}/advanced"
            COMPONENT doc)
  endif()
    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../advanced/content/files")
    install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../advanced/content/files"
            DESTINATION "${DOC_INSTALL_DIR}/advanced"
            COMPONENT doc
{'fraction_non_alphanumeric': 0.12706409179960818, 'fraction_numerical': 0.001119507416736636, 'mean_word_length': 3.6841415465268676, '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': '5421461', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1221, 'n_words': 193}