iksnae / actual-intelligence

A practical, non-technical guide to using AI tools like ChatGPT in everyday life
MIT License
0 stars 0 forks source link

Fix Spanish book generation using flat directory structure #51

Closed khaos-codi closed 3 months ago

khaos-codi commented 3 months ago

Fix for Spanish Book Generation

This PR resolves the issue with Spanish book generation failing to output files properly. The key fix is to use a flat directory structure in the build directory similar to how Rise and Code works.

Key Changes:

  1. Flat Directory Structure:

    • Changed all language output files to be written directly to the build/ directory rather than language-specific subdirectories
    • Maintains web-specific files in language subdirectories (like build/es/index.html) for GitHub Pages
  2. Simplified Image Handling:

    • Streamlined image copy process to place all images in a single location (build/images/)
    • Added verification to ensure cover image is properly placed
    • Maintained web-specific image directories for language subfolders
  3. Enhanced EPUB Generation:

    • Simplified cover image discovery by using a standard location
    • Added better diagnostics for verifying file generation
    • Reduced file size thresholds for warnings to catch empty files early
  4. Improved Setup Phase:

    • Made directory creation more explicit
    • Added better verification of environment
    • Ensured all necessary directories exist at the start

Testing:

I've focused on making the changes minimal while ensuring both English and Spanish versions can be generated in the same build. The core problem was that we're creating Spanish files in a language-specific subfolder (build/es/) instead of directly in the root directory as the release process expects.

By replicating the flat organization approach from Rise and Code, we ensure that Spanish files are created in the same location as English files, with different filenames based on language.

This PR should resolve the issue without breaking the working English generation.