|
| 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 Jekyll-based source for the official Ruby programming language website (www.ruby-lang.org), featuring multi-language support for 16+ languages and a Tailwind CSS-based design system. |
| 8 | + |
| 9 | +## Build & Development Commands |
| 10 | + |
| 11 | +### Jekyll Site Operations |
| 12 | + |
| 13 | +```bash |
| 14 | +# Build the site (takes several minutes) |
| 15 | +bundle exec rake build |
| 16 | + |
| 17 | +# Serve locally at http://localhost:4000/ |
| 18 | +bundle exec rake serve |
| 19 | + |
| 20 | +# Alternative: Jekyll direct serve with incremental builds |
| 21 | +bundle exec jekyll serve --watch --future --incremental |
| 22 | +``` |
| 23 | + |
| 24 | +### CSS (Tailwind) |
| 25 | + |
| 26 | +```bash |
| 27 | +# Build CSS (production) |
| 28 | +npm run build-css |
| 29 | + |
| 30 | +# Watch CSS for development |
| 31 | +npm run watch-css |
| 32 | +``` |
| 33 | + |
| 34 | +### Testing & Quality Assurance |
| 35 | + |
| 36 | +```bash |
| 37 | +# Run all tests (includes linter, lint, build) |
| 38 | +bundle exec rake test |
| 39 | + |
| 40 | +# Run individual test suites |
| 41 | +bundle exec rake test-news-plugin # News archive plugin tests |
| 42 | +bundle exec rake test-linter # Linter library tests |
| 43 | + |
| 44 | +# Linting |
| 45 | +bundle exec rake lint # Markdown linter |
| 46 | + |
| 47 | +# Post-build validation (requires built site) |
| 48 | +bundle exec rake check:markup # Validate HTML markup |
| 49 | +bundle exec rake check:links # Check for broken links (needs local server running) |
| 50 | +``` |
| 51 | + |
| 52 | +### Creating News Posts |
| 53 | + |
| 54 | +```bash |
| 55 | +# Create news post template for specific language |
| 56 | +bundle exec rake new_post:en # English |
| 57 | +bundle exec rake new_post:ja # Japanese |
| 58 | +bundle exec rake new_post:fr # French |
| 59 | +# ... etc for: bg, de, es, id, it, ko, pl, pt, ru, tr, vi, zh_cn, zh_tw |
| 60 | +``` |
| 61 | + |
| 62 | +## Architecture & Structure |
| 63 | + |
| 64 | +### Multi-Language System |
| 65 | + |
| 66 | +- **16 supported languages**: bg, de, en, es, fr, id, it, ja, ko, pl, pt, ru, tr, vi, zh_cn, zh_tw |
| 67 | +- Language-specific content organized in top-level directories (e.g., `/en/`, `/ja/`) |
| 68 | +- Locale data stored in `_data/locales/*.yml` |
| 69 | +- Language switching handled by `_includes/language_selector.html` |
| 70 | + |
| 71 | +### Jekyll Configuration |
| 72 | + |
| 73 | +- **Markdown**: Kramdown with Rouge syntax highlighting |
| 74 | +- **Timezone**: UTC (critical for news posts) |
| 75 | +- **Permalinks**: Pretty URLs |
| 76 | +- **Build output**: `_site/` directory |
| 77 | + |
| 78 | +### Key Directories |
| 79 | + |
| 80 | +- `_layouts/`: Page templates (default, homepage, news_post, news_archive_month, etc.) |
| 81 | +- `_includes/`: Reusable components (header, footer, navigation, toc, sidebar) |
| 82 | +- `_plugins/`: Custom Jekyll plugins (news archive generator, posted_by, translation_status) |
| 83 | +- `_data/`: YAML data files (releases.yml, downloads.yml, branches.yml, locales/) |
| 84 | +- `lib/`: Ruby utilities (linter, markup checker, draft release) |
| 85 | +- `test/`: Test files for plugins and linter |
| 86 | +- `stylesheets/`: CSS source and compiled output |
| 87 | +- `_javascripts_src/`: TypeScript source files |
| 88 | +- `javascripts/`: Compiled JavaScript output |
| 89 | + |
| 90 | +### Design System (Tailwind CSS) |
| 91 | + |
| 92 | +The site uses a custom Tailwind configuration with: |
| 93 | + |
| 94 | +- **Semantic color tokens** via CSS variables (defined in `tailesheets/semantic-colors.css`) |
| 95 | + - Accessible via `bg-semantic-*`, `text-semantic-*`, `border-semantic-*` classes |
| 96 | + - Automatically handles light/dark mode via `prefers-color-scheme` |
| 97 | +- **Brand colors**: Ruby (red) and Gold palettes |
| 98 | +- **Typography plugin** for prose styling |
| 99 | +- **Custom breakpoints**: Container max-widths configured for content layouts |
| 100 | +- **Dark mode**: Enabled via OS preference (`darkMode: 'media'`) |
| 101 | + |
| 102 | +Input: `stylesheets/tailwind.css` → Output: `stylesheets/compiled.css` |
| 103 | + |
| 104 | +### News System |
| 105 | + |
| 106 | +The news system is powered by a custom Jekyll plugin (`_plugins/news.rb`): |
| 107 | + |
| 108 | +- **Archive generation**: Automatically creates yearly/monthly archive pages |
| 109 | +- **Post structure**: Posts stored in `{lang}/news/_posts/YYYY-MM-DD-title.md` |
| 110 | +- **Archive pages**: Index, yearly archives, monthly archives |
| 111 | +- **RSS feeds**: Generated per language via `news_feed.rss` layout |
| 112 | + |
| 113 | +### Linter (`lib/linter.rb`) |
| 114 | + |
| 115 | +Enforces strict content quality rules: |
| 116 | + |
| 117 | +- YAML front matter validation (lang, author, translator, date) |
| 118 | +- File naming conventions (date must match filename) |
| 119 | +- UTC timezone enforcement for news posts |
| 120 | +- Line ending consistency (LF only, no CRLF) |
| 121 | +- Trailing whitespace checks |
| 122 | +- Release post SHA hash validation (SHA1/SHA256/SHA512) |
| 123 | +- Release data validation against `_data/releases.yml` |
| 124 | + |
| 125 | +### Layout Hierarchy |
| 126 | + |
| 127 | +``` |
| 128 | +default.html (base) |
| 129 | +├── homepage.html |
| 130 | +├── page.html |
| 131 | +├── news.html |
| 132 | +├── news_post.html |
| 133 | +├── news_archive_year.html |
| 134 | +├── news_archive_month.html |
| 135 | +└── news_feed.rss |
| 136 | +``` |
| 137 | + |
| 138 | +### Front Matter Requirements |
| 139 | + |
| 140 | +**Standard pages:** |
| 141 | +```yaml |
| 142 | +--- |
| 143 | +layout: page |
| 144 | +title: "Page Title" |
| 145 | +lang: en |
| 146 | +--- |
| 147 | +``` |
| 148 | + |
| 149 | +**News posts:** |
| 150 | +```yaml |
| 151 | +--- |
| 152 | +layout: news_post |
| 153 | +title: "Post Title" |
| 154 | +author: "Author Name" |
| 155 | +translator: "Translator Name" # Required for non-original language |
| 156 | +date: YYYY-MM-DD HH:MM:SS +0000 # Must be UTC |
| 157 | +lang: en |
| 158 | +--- |
| 159 | +``` |
| 160 | + |
| 161 | +## TypeScript/JavaScript |
| 162 | + |
| 163 | +- Source files in `_javascripts_src/` (TypeScript) |
| 164 | +- Compiled to `javascripts/` (JavaScript) |
| 165 | +- Files: `examples.ts`, `page.ts` |
| 166 | +- No build command specified - likely manual compilation or external process |
| 167 | + |
| 168 | +## Dependencies |
| 169 | + |
| 170 | +**Ruby (Gemfile):** |
| 171 | +- `jekyll` - Static site generator |
| 172 | +- `rouge` - Syntax highlighting |
| 173 | +- `rake` - Task automation |
| 174 | +- `html-proofer` - Markup validation |
| 175 | +- `validate-website` - Link checking |
| 176 | +- `minitest` - Testing framework |
| 177 | +- `csv`, `base64` - Ruby 3.4+ compatibility |
| 178 | + |
| 179 | +**Node (package.json):** |
| 180 | +- `tailwindcss` - CSS framework |
| 181 | +- `@tailwindcss/typography` - Prose styling plugin |
| 182 | + |
| 183 | +## Important Conventions |
| 184 | + |
| 185 | +1. **All news posts must use UTC timezone** (`+0000`) in the date field |
| 186 | +2. **File naming**: News posts must be `YYYY-MM-DD-title.md` matching the date in front matter |
| 187 | +3. **Language codes**: Must match directory structure (e.g., `lang: en` for files in `/en/`) |
| 188 | +4. **Translator field**: Required for translated news posts, not for original posts |
| 189 | +5. **Line endings**: LF only, no CRLF |
| 190 | +6. **Release posts**: Must include valid SHA checksums if referencing downloads |
| 191 | + |
| 192 | +## CI/CD |
| 193 | + |
| 194 | +GitHub Actions workflow (`.github/workflows/ci.yml`): |
| 195 | +- Runs on: Ruby 3.2, Ubuntu latest |
| 196 | +- Executes: `bundle exec rake test` (includes linter, lint, build) |
| 197 | +- Triggers: Push and pull requests |
0 commit comments