#!/bin/bash ## Description: Render TYPO3 extension documentation to HTML ## Usage: docs ## Example: "ddev docs" set -e PROJECT_DIR="$(pwd)" DOC_SOURCE="${PROJECT_DIR}/Documentation" DOC_OUTPUT="${PROJECT_DIR}/Documentation-GENERATED-temp" echo "๐Ÿ“š Rendering TYPO3 Extension Documentation" echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" # Check if Documentation directory exists if [ ! -d "$DOC_SOURCE" ]; then echo "โŒ Error: Documentation directory not found" echo "๐Ÿ’ก Tip: Create a Documentation/ directory with Index.rst to get started" exit 1 fi # Check if Index.rst exists if [ ! -f "$DOC_SOURCE/Index.rst" ]; then echo "โŒ Error: Index.rst not found in Documentation/" echo "๐Ÿ’ก Tip: Create Documentation/Index.rst as the main entry point" exit 1 fi echo "๐Ÿ“– Source: Documentation/" echo "๐Ÿ“ฆ Output: Documentation-GENERATED-temp/" echo "" # Clean previous output if [ -d "$DOC_OUTPUT" ]; then echo "๐Ÿงน Cleaning previous documentation build..." rm -rf "$DOC_OUTPUT" fi # Render documentation using TYPO3's official docker image echo "๐Ÿ”จ Rendering documentation with TYPO3 render-guides..." echo "" docker run --rm \ -v "${PROJECT_DIR}:/project" \ --user "$(id -u):$(id -g)" \ ghcr.io/typo3-documentation/render-guides:latest \ --no-progress \ --output=/project/Documentation-GENERATED-temp \ /project/Documentation 2>&1 if [ $? -eq 0 ]; then # Check for output files (structure may vary) if [ -f "$DOC_OUTPUT/Result/project/0.0.0/Index.html" ] || \ [ -f "$DOC_OUTPUT/Index.html" ] || \ [ -d "$DOC_OUTPUT" ]; then echo "" echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" echo "โœ… Documentation rendered successfully!" echo "" echo "๐ŸŒ View at: https://docs.$(ddev describe -j | jq -r .raw.name).ddev.site/" echo "๐Ÿ“ Output: Documentation-GENERATED-temp/" echo "" else echo "" echo "โš ๏ธ Build completed but output structure unclear" echo "๐Ÿ“ Check: Documentation-GENERATED-temp/" fi else echo "" echo "โŒ Documentation rendering failed" echo "๐Ÿ’ก Check your .rst files for syntax errors" exit 1 fi