|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is the Chinese translation of the CodeIgniter 4 User Guide, built using Sphinx documentation system. The project translates English CodeIgniter 4 documentation into Chinese using ReStructuredText (.rst) format. |
| 8 | + |
| 9 | +## Essential Commands |
| 10 | + |
| 11 | +### Building Documentation |
| 12 | +```bash |
| 13 | +# Install dependencies (requires Python 3.5+) |
| 14 | +pip install -r requirements.txt |
| 15 | + |
| 16 | +# Build HTML documentation |
| 17 | +make html |
| 18 | + |
| 19 | +# Build PDF documentation |
| 20 | +make latexpdf |
| 21 | + |
| 22 | +# Clean build artifacts |
| 23 | +make clean |
| 24 | +``` |
| 25 | + |
| 26 | +### Docker Development |
| 27 | +```bash |
| 28 | +# Build and run in Docker container |
| 29 | +docker build -t codeigniter4-user-guide . |
| 30 | +docker run --rm -v $(pwd):/app -w /app codeigniter4-user-guide make html |
| 31 | +``` |
| 32 | + |
| 33 | +## Architecture |
| 34 | + |
| 35 | +### Directory Structure |
| 36 | +- **`source/`**: All ReStructuredText documentation files |
| 37 | + - `conf.py`: Sphinx configuration with Chinese language settings |
| 38 | + - `index.rst`: Master document tree defining site structure |
| 39 | + - Topic directories: `tutorial/`, `installation/`, `concepts/`, `database/`, `libraries/`, `helpers/` |
| 40 | + - `_static/`: CSS, JavaScript, images, and other assets |
| 41 | + - `_templates/`: Custom Sphinx templates |
| 42 | +- **`build/`**: Generated documentation output |
| 43 | + - `html/`: Web-ready HTML files |
| 44 | + - `doctrees/`: Sphinx build cache |
| 45 | + |
| 46 | +### Key Technologies |
| 47 | +- **Sphinx 5.3.0+**: Static site generator optimized for technical documentation |
| 48 | +- **ReStructuredText**: Markup format for all content files |
| 49 | +- **sphinxcontrib-phpdomain**: PHP syntax highlighting and cross-referencing |
| 50 | +- **sphinx-rtd-theme**: Read the Docs theme |
| 51 | +- **jieba**: Chinese text segmentation for search functionality |
| 52 | + |
| 53 | +### Build System |
| 54 | +The project uses a standard Sphinx Makefile workflow: |
| 55 | +1. RST files in `source/` are processed by Sphinx |
| 56 | +2. Chinese language configuration in `source/conf.py` |
| 57 | +3. Output generated to `build/html/` or `build/latex/` |
| 58 | +4. GitHub Actions automates builds and deploys to GitHub Pages |
| 59 | + |
| 60 | +## Translation Guidelines |
| 61 | + |
| 62 | +When editing documentation: |
| 63 | +- Follow Chinese copywriting standards defined in `translation-guide.md` |
| 64 | +- Maintain consistency with existing terminology |
| 65 | +- Preserve RST markup structure and Sphinx directives |
| 66 | +- Test builds locally before committing: `make html` |
| 67 | +- Use signed commits as required by project workflow |
| 68 | + |
| 69 | +## CI/CD Pipeline |
| 70 | + |
| 71 | +GitHub Actions automatically: |
| 72 | +- Builds HTML and PDF versions on master branch pushes |
| 73 | +- Deploys HTML to GitHub Pages |
| 74 | +- Uses LaTeX/XeTeX for proper Chinese PDF generation |
| 75 | +- Validates all builds before deployment |
| 76 | + |
| 77 | +## Development Workflow |
| 78 | + |
| 79 | +1. Edit RST files in appropriate `source/` subdirectories |
| 80 | +2. Run `make html` to build and preview locally in `build/html/` |
| 81 | +3. Check `build/html/index.html` in browser to verify changes |
| 82 | +4. For PDF testing, run `make latexpdf` (requires LaTeX installation) |
| 83 | +5. Commit with signed-off commits following project conventions |
| 84 | + |
| 85 | +## Common File Patterns |
| 86 | + |
| 87 | +- Documentation pages: `source/**/*.rst` |
| 88 | +- Configuration: `source/conf.py` |
| 89 | +- Static assets: `source/_static/**/*` |
| 90 | +- Templates: `source/_templates/**/*` |
| 91 | +- Build output: `build/**/*` (git-ignored) |
0 commit comments