da6de0080b
Update complete pdf code for entire system * docs and code for generation of updated docs
212 lines
5.0 KiB
Bash
Executable File
212 lines
5.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script to build Docker container and generate PDF documentation
|
|
# Run this script from the docs_temp/scripts directory
|
|
|
|
set -e # Exit on any error
|
|
|
|
echo "🚀 Building Docker container for PDF generation..."
|
|
|
|
# Build the Docker image
|
|
docker build -t doczy-docs-generator .
|
|
|
|
echo "📝 Preparing documentation files..."
|
|
|
|
# Go back to docs_temp directory
|
|
cd ..
|
|
|
|
# Create complete documentation file with proper order and formatting
|
|
cat > complete-documentation.md << 'EOF'
|
|
# DoczyAI Query Orchestration Platform
|
|
## System Documentation
|
|
|
|
EOF
|
|
|
|
# Concatenate all documentation files in logical order
|
|
echo "📚 Combining documentation files..."
|
|
cat README.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 01-system-overview.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 02-service-architecture.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 03-api-documentation.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 04-data-architecture.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 05-getting-started.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 06-code-organization.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 07-configuration-management.md >> complete-documentation.md
|
|
echo -e "\n\n\\pagebreak\n" >> complete-documentation.md
|
|
|
|
cat 08-operations-guide.md >> complete-documentation.md
|
|
|
|
echo "🔧 Creating custom CSS file..."
|
|
|
|
# Create a custom CSS file for styling
|
|
cat > custom-styles.css << 'CSS_EOF'
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
line-height: 1.6;
|
|
color: #333;
|
|
max-width: none;
|
|
}
|
|
|
|
h1, h2, h3, h4, h5, h6 {
|
|
color: #2c3e50;
|
|
margin-top: 2em;
|
|
margin-bottom: 1em;
|
|
page-break-after: avoid;
|
|
}
|
|
|
|
h1 {
|
|
border-bottom: 3px solid #3498db;
|
|
padding-bottom: 10px;
|
|
page-break-before: always;
|
|
}
|
|
|
|
h1:first-child {
|
|
page-break-before: avoid;
|
|
}
|
|
|
|
h2 {
|
|
border-bottom: 2px solid #ecf0f1;
|
|
padding-bottom: 5px;
|
|
}
|
|
|
|
code {
|
|
background-color: #f8f9fa;
|
|
padding: 2px 4px;
|
|
border-radius: 3px;
|
|
font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
pre {
|
|
background-color: #f8f9fa;
|
|
padding: 16px;
|
|
border-radius: 6px;
|
|
border-left: 4px solid #3498db;
|
|
overflow-x: auto;
|
|
page-break-inside: avoid;
|
|
}
|
|
|
|
blockquote {
|
|
border-left: 4px solid #3498db;
|
|
margin: 0;
|
|
padding-left: 16px;
|
|
color: #6c757d;
|
|
font-style: italic;
|
|
}
|
|
|
|
table {
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
margin: 1em 0;
|
|
page-break-inside: avoid;
|
|
}
|
|
|
|
th, td {
|
|
border: 1px solid #dee2e6;
|
|
padding: 8px 12px;
|
|
text-align: left;
|
|
}
|
|
|
|
th {
|
|
background-color: #f8f9fa;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.mermaid {
|
|
text-align: center;
|
|
margin: 2em 0;
|
|
page-break-inside: avoid;
|
|
}
|
|
|
|
a {
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* Page break utilities */
|
|
.pagebreak {
|
|
page-break-before: always;
|
|
}
|
|
|
|
/* Print-specific styles */
|
|
@media print {
|
|
body {
|
|
font-size: 12pt;
|
|
}
|
|
|
|
h1 { font-size: 18pt; }
|
|
h2 { font-size: 16pt; }
|
|
h3 { font-size: 14pt; }
|
|
|
|
pre, code {
|
|
font-size: 10pt;
|
|
}
|
|
}
|
|
|
|
/* Ensure diagrams and code blocks don't break across pages */
|
|
pre, .mermaid, table {
|
|
page-break-inside: avoid;
|
|
}
|
|
CSS_EOF
|
|
|
|
echo "🔧 Skipping shell preprocessing - letting JavaScript handle all link processing..."
|
|
|
|
# Don't preprocess links in shell - let the JavaScript handle it properly
|
|
|
|
echo "🔧 Generating PDF with Docker container..."
|
|
|
|
# Run the Docker container with our custom conversion script and security options for Mermaid rendering
|
|
docker run --rm \
|
|
--security-opt seccomp=unconfined \
|
|
--cap-add=SYS_ADMIN \
|
|
-v "$(pwd):/app/docs" \
|
|
-w /app/docs \
|
|
doczy-docs-generator \
|
|
complete-documentation.md
|
|
|
|
# Check if PDF was generated successfully
|
|
if [ -f "complete-documentation.pdf" ]; then
|
|
echo "✅ PDF generated successfully: complete-documentation.pdf"
|
|
|
|
# Get file size for confirmation
|
|
SIZE=$(ls -lh complete-documentation.pdf | awk '{print $5}')
|
|
echo "📄 File size: $SIZE"
|
|
|
|
# Move PDF to more descriptive name with timestamp
|
|
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
|
mv complete-documentation.pdf "DoczyAI-Documentation-${TIMESTAMP}.pdf"
|
|
echo "📁 Final file: DoczyAI-Documentation-${TIMESTAMP}.pdf"
|
|
else
|
|
echo "❌ Error: PDF generation failed"
|
|
exit 1
|
|
fi
|
|
|
|
# Clean up temporary files
|
|
rm -f complete-documentation.md custom-styles.css
|
|
|
|
echo "🎉 Documentation PDF generation complete!"
|
|
echo ""
|
|
echo "The generated PDF includes:"
|
|
echo " • Table of contents with working links"
|
|
echo " • Rendered Mermaid diagrams"
|
|
echo " • Proper page breaks between sections"
|
|
echo " • Professional formatting and styling"
|
|
echo " • Code syntax highlighting" |