diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb4b7c9..706162f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,11 +86,11 @@ description: "Concise description of the content. This description is reused as - **title**: phrased as a question (`"How to do X?"`, `"What is X?"`). Wrapped in quotes. - **slug**: URL identifier, in kebab-case, without accents. No leading slash. The English and French versions can have different slugs (e.g., `how-to-create-a-weather` vs `creer-une-meteo`). - **sidebar_position**: position within the section. Must match the filename prefix and be identical between locales. -- **description**: one or two sentence summary. Repeated verbatim as the first paragraph of the page body. +- **description**: one or two sentence summary, in **plain text** — no Markdown. This field feeds the SEO `` tag and the category index cards, both of which render it as raw text, so `**bold**` or `` `code` `` markers would show up literally. The page's first paragraph repeats the same wording (see below). ### First Paragraph -The first paragraph after the frontmatter must repeat the `description` word for word. This ensures consistency between previews (lists, search engines) and the actual page content. +The first paragraph after the frontmatter must repeat the `description`'s wording. The paragraph may add Markdown emphasis (`**bold**`, `` `inline code` ``) for readability, but the `description` field itself stays plain text. This keeps previews (lists, search engines, cards) consistent with the page content while keeping the meta tag clean. ### Adding a Section @@ -130,7 +130,7 @@ To translate the section label in French, add an entry under `i18n/fr/docusaurus ### Page Structure 1. **Frontmatter** with title, slug, sidebar_position, description. -2. **Introduction paragraph** (identical to the description). +2. **Introduction paragraph** (same wording as the description; may add `**bold**` / `` `code` `` emphasis). 3. **`##` sections** for major parts. 4. **`###` subsections** if needed. Do not go deeper than `###`. 5. **`## Conclusion` section** at the end: bullet list summarizing key points. diff --git a/content/ruby/03-arrays.md b/content/ruby/03-arrays.md index 6714454..cb95439 100644 --- a/content/ruby/03-arrays.md +++ b/content/ruby/03-arrays.md @@ -2,7 +2,7 @@ title: "How to use arrays in Ruby?" slug: arrays sidebar_position: 3 -description: "This chapter introduces **Arrays**, the most commonly used data structure in Ruby. An Array allows storing multiple values in a single variable." +description: "This chapter introduces Arrays, the most commonly used data structure in Ruby. An Array allows storing multiple values in a single variable." --- This chapter introduces **Arrays**, the most commonly used data structure in Ruby. An Array allows storing multiple values in a single variable. diff --git a/content/ruby/04-hashes.md b/content/ruby/04-hashes.md index 432f25d..05c6880 100644 --- a/content/ruby/04-hashes.md +++ b/content/ruby/04-hashes.md @@ -2,7 +2,7 @@ title: "How to use hashes in Ruby?" slug: hashes sidebar_position: 4 -description: "This chapter introduces **Hashes**, a structure that associates **keys** with **values**. Where an Array stores elements by position (index 0, 1, 2...), a Hash stores them by name." +description: "This chapter introduces Hashes, a structure that associates keys with values. Where an Array stores elements by position (index 0, 1, 2...), a Hash stores them by name." --- This chapter introduces **Hashes**, a structure that associates **keys** with **values**. Where an Array stores elements by position (index 0, 1, 2...), a Hash stores them by name. diff --git a/content/ruby/05-conditionals.md b/content/ruby/05-conditionals.md index b39b943..1f91a00 100644 --- a/content/ruby/05-conditionals.md +++ b/content/ruby/05-conditionals.md @@ -2,7 +2,7 @@ title: "How to use conditionals in Ruby?" slug: conditionals sidebar_position: 5 -description: "This chapter introduces **conditionals**, the mechanism that allows a program to make decisions. Depending on the situation, the code executes one branch or another." +description: "This chapter introduces conditionals, the mechanism that allows a program to make decisions. Depending on the situation, the code executes one branch or another." --- This chapter introduces **conditionals**, the mechanism that allows a program to make decisions. Depending on the situation, the code executes one branch or another. diff --git a/content/ruby/06-loops.md b/content/ruby/06-loops.md index 69e59df..642e52a 100644 --- a/content/ruby/06-loops.md +++ b/content/ruby/06-loops.md @@ -2,7 +2,7 @@ title: "How to use loops and iterators in Ruby?" slug: loops-and-iterators sidebar_position: 6 -description: "This chapter introduces the tools that allow you to **repeat** instructions: classic loops and iterators. We also discover how to read what the user types on the keyboard." +description: "This chapter introduces the tools that allow you to repeat instructions: classic loops and iterators. We also discover how to read what the user types on the keyboard." --- This chapter introduces the tools that allow you to **repeat** instructions: classic loops and iterators. We also discover how to read what the user types on the keyboard. diff --git a/content/ruby/07-methods.md b/content/ruby/07-methods.md index 5387f11..7644108 100644 --- a/content/ruby/07-methods.md +++ b/content/ruby/07-methods.md @@ -2,7 +2,7 @@ title: "How to use methods and blocks in Ruby?" slug: methods-and-blocks sidebar_position: 7 -description: "This chapter introduces **methods** (named, reusable pieces of code) and **blocks** (pieces of code that you pass to a method). This is a fundamental chapter: from now on, we can structure our code instead of writing everything in a single script." +description: "This chapter introduces methods (named, reusable pieces of code) and blocks (pieces of code that you pass to a method). This is a fundamental chapter: from now on, we can structure our code instead of writing everything in a single script." --- This chapter introduces **methods** (named, reusable pieces of code) and **blocks** (pieces of code that you pass to a method). This is a fundamental chapter: from now on, we can structure our code instead of writing everything in a single script. diff --git a/content/ruby/08-classes.md b/content/ruby/08-classes.md index dca76ee..407d9bd 100644 --- a/content/ruby/08-classes.md +++ b/content/ruby/08-classes.md @@ -2,7 +2,7 @@ title: "How to create classes and objects in Ruby?" slug: classes-and-objects sidebar_position: 8 -description: "This chapter introduces **classes**, the central mechanism for organizing code in Ruby. A class groups data and behaviors in a single place." +description: "This chapter introduces classes, the central mechanism for organizing code in Ruby. A class groups data and behaviors in a single place." --- This chapter introduces **classes**, the central mechanism for organizing code in Ruby. A class groups data and behaviors in a single place. diff --git a/content/ruby/09-inheritance.md b/content/ruby/09-inheritance.md index 780df0f..a98552f 100644 --- a/content/ruby/09-inheritance.md +++ b/content/ruby/09-inheritance.md @@ -2,7 +2,7 @@ title: "How to use inheritance in Ruby?" slug: inheritance sidebar_position: 9 -description: "This chapter introduces **inheritance**, the mechanism that allows a class to take everything another class defines and add its own specifics on top." +description: "This chapter introduces inheritance, the mechanism that allows a class to take everything another class defines and add its own specifics on top." --- This chapter introduces **inheritance**, the mechanism that allows a class to take everything another class defines and add its own specifics on top. diff --git a/content/ruby/10-modules.md b/content/ruby/10-modules.md index 0f712c4..2c75c51 100644 --- a/content/ruby/10-modules.md +++ b/content/ruby/10-modules.md @@ -2,7 +2,7 @@ title: "How to use modules in Ruby?" slug: modules sidebar_position: 10 -description: "This chapter introduces **modules**, a tool for organizing code and sharing behavior between classes. Modules are the natural complement to classes and inheritance." +description: "This chapter introduces modules, a tool for organizing code and sharing behavior between classes. Modules are the natural complement to classes and inheritance." --- This chapter introduces **modules**, a tool for organizing code and sharing behavior between classes. Modules are the natural complement to classes and inheritance. diff --git a/content/ruby/11-prepend.md b/content/ruby/11-prepend.md index ee5c5c7..42e0a0f 100644 --- a/content/ruby/11-prepend.md +++ b/content/ruby/11-prepend.md @@ -2,7 +2,7 @@ title: "How to extend existing code with prepend in Ruby?" slug: extending-code-with-prepend sidebar_position: 11 -description: "This chapter presents techniques for **extending existing code** without modifying it directly. This is a fundamental concept in Ruby: you can enrich a class after its creation, even if you do not have access to the source file." +description: "This chapter presents techniques for extending existing code without modifying it directly. This is a fundamental concept in Ruby: you can enrich a class after its creation, even if you do not have access to the source file." --- This chapter presents techniques for **extending existing code** without modifying it directly. This is a fundamental concept in Ruby: you can enrich a class after its creation, even if you do not have access to the source file. diff --git a/content/ruby/12-enumerable.md b/content/ruby/12-enumerable.md index 00f60ce..08ac220 100644 --- a/content/ruby/12-enumerable.md +++ b/content/ruby/12-enumerable.md @@ -2,7 +2,7 @@ title: "How to use Enumerable in Ruby?" slug: enumerable sidebar_position: 12 -description: "This chapter introduces **Enumerable**, a module that provides over 50 collection manipulation methods. We also discover **Comparable**, which allows comparing objects with each other." +description: "This chapter introduces Enumerable, a module that provides over 50 collection manipulation methods. We also discover Comparable, which allows comparing objects with each other." --- This chapter introduces **Enumerable**, a module that provides over 50 collection manipulation methods. We also discover **Comparable**, which allows comparing objects with each other. diff --git a/content/ruby/13-errors.md b/content/ruby/13-errors.md index 721aac7..137969e 100644 --- a/content/ruby/13-errors.md +++ b/content/ruby/13-errors.md @@ -2,7 +2,7 @@ title: "How to handle errors in Ruby?" slug: error-handling sidebar_position: 14 -description: "This chapter introduces **exception handling**, the mechanism that allows you to react when something goes wrong in a program. Instead of silent crashes or unexplained `nil` values, you will learn how to raise, catch, and handle errors properly." +description: "This chapter introduces exception handling, the mechanism that allows you to react when something goes wrong in a program. Instead of silent crashes or unexplained nil values, you will learn how to raise, catch, and handle errors properly." --- This chapter introduces **exception handling**, the mechanism that allows you to react when something goes wrong in a program. Instead of silent crashes or unexplained `nil` values, you will learn how to raise, catch, and handle errors properly. diff --git a/content/ruby/14-files.md b/content/ruby/14-files.md index 77d7039..12c72ad 100644 --- a/content/ruby/14-files.md +++ b/content/ruby/14-files.md @@ -2,7 +2,7 @@ title: "How to read and write files in Ruby?" slug: reading-and-writing-files sidebar_position: 15 -description: "This chapter introduces reading and writing files, then **serialization**: turning Ruby objects into data that can be saved and reloaded later." +description: "This chapter introduces reading and writing files, then serialization: turning Ruby objects into data that can be saved and reloaded later." --- This chapter introduces reading and writing files, then **serialization**: turning Ruby objects into data that can be saved and reloaded later. diff --git a/content/ruby/15-advanced-classes.md b/content/ruby/15-advanced-classes.md index d763280..5185f3a 100644 --- a/content/ruby/15-advanced-classes.md +++ b/content/ruby/15-advanced-classes.md @@ -2,7 +2,7 @@ title: "How to use advanced class features in Ruby?" slug: advanced-class-features sidebar_position: 16 -description: "This chapter introduces advanced class features: operator overloading, duck typing, `Struct`, and object identity management. These tools make classes more expressive and natural to use." +description: "This chapter introduces advanced class features: operator overloading, duck typing, Struct, and object identity management. These tools make classes more expressive and natural to use." --- This chapter introduces advanced class features: operator overloading, duck typing, `Struct`, and object identity management. These tools make classes more expressive and natural to use. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/03-arrays.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/03-arrays.md index bf4c576..c4c57be 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/03-arrays.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/03-arrays.md @@ -2,7 +2,7 @@ title: "Comment utiliser les tableaux en Ruby ?" slug: tableaux sidebar_position: 3 -description: "Ce chapitre présente les **Array** (tableaux), la structure de données la plus utilisée en Ruby. Un Array permet de stocker plusieurs valeurs dans une seule variable." +description: "Ce chapitre présente les Array (tableaux), la structure de données la plus utilisée en Ruby. Un Array permet de stocker plusieurs valeurs dans une seule variable." --- Ce chapitre présente les **Array** (tableaux), la structure de données la plus utilisée en Ruby. Un Array permet de stocker plusieurs valeurs dans une seule variable. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/04-hashes.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/04-hashes.md index 67c5795..429a50f 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/04-hashes.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/04-hashes.md @@ -2,7 +2,7 @@ title: "Comment utiliser les tables associatives en Ruby ?" slug: tables-associatives sidebar_position: 4 -description: "Ce chapitre présente les **Hash** (tables associatives), une structure qui associe des **clés** à des **valeurs**. Là où un Array range les éléments par position (index 0, 1, 2...), un Hash les range par nom." +description: "Ce chapitre présente les Hash (tables associatives), une structure qui associe des clés à des valeurs. Là où un Array range les éléments par position (index 0, 1, 2...), un Hash les range par nom." --- Ce chapitre présente les **Hash** (tables associatives), une structure qui associe des **clés** à des **valeurs**. Là où un Array range les éléments par position (index 0, 1, 2...), un Hash les range par nom. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/05-conditionals.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/05-conditionals.md index 63fe692..817c9b4 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/05-conditionals.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/05-conditionals.md @@ -2,7 +2,7 @@ title: "Comment utiliser les conditions en Ruby ?" slug: conditions sidebar_position: 5 -description: "Ce chapitre présente les **conditions**, le mécanisme qui permet à un programme de prendre des décisions. Selon la situation, le code exécute une branche ou une autre." +description: "Ce chapitre présente les conditions, le mécanisme qui permet à un programme de prendre des décisions. Selon la situation, le code exécute une branche ou une autre." --- Ce chapitre présente les **conditions**, le mécanisme qui permet à un programme de prendre des décisions. Selon la situation, le code exécute une branche ou une autre. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/06-loops.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/06-loops.md index a323fa8..7121cbf 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/06-loops.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/06-loops.md @@ -2,7 +2,7 @@ title: "Comment utiliser les boucles et les itérateurs en Ruby ?" slug: boucles-et-iterateurs sidebar_position: 6 -description: "Ce chapitre présente les outils qui permettent de **répéter** des instructions : les boucles classiques et les itérateurs. On découvre aussi comment lire ce que l'utilisateur tape au clavier." +description: "Ce chapitre présente les outils qui permettent de répéter des instructions : les boucles classiques et les itérateurs. On découvre aussi comment lire ce que l'utilisateur tape au clavier." --- Ce chapitre présente les outils qui permettent de **répéter** des instructions : les boucles classiques et les itérateurs. On découvre aussi comment lire ce que l'utilisateur tape au clavier. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/07-methods.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/07-methods.md index c286182..786b28f 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/07-methods.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/07-methods.md @@ -2,7 +2,7 @@ title: "Comment utiliser les méthodes et les blocs en Ruby ?" slug: methodes-et-blocs sidebar_position: 7 -description: "Ce chapitre présente les **méthodes** (des morceaux de code nommés et réutilisables) et les **blocs** (des morceaux de code qu'on passe à une méthode). C'est un chapitre fondamental : à partir de maintenant, on peut structurer son code au lieu de tout écrire dans un seul script." +description: "Ce chapitre présente les méthodes (des morceaux de code nommés et réutilisables) et les blocs (des morceaux de code qu'on passe à une méthode). C'est un chapitre fondamental : à partir de maintenant, on peut structurer son code au lieu de tout écrire dans un seul script." --- Ce chapitre présente les **méthodes** (des morceaux de code nommés et réutilisables) et les **blocs** (des morceaux de code qu'on passe à une méthode). C'est un chapitre fondamental : à partir de maintenant, on peut structurer son code au lieu de tout écrire dans un seul script. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/08-classes.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/08-classes.md index 8a485c5..5ecfba5 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/08-classes.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/08-classes.md @@ -2,7 +2,7 @@ title: "Comment créer des classes et des objets en Ruby ?" slug: classes-et-objets sidebar_position: 8 -description: "Ce chapitre introduit les **classes**, le mécanisme central pour organiser le code en Ruby. Une classe regroupe des données et des comportements dans un seul endroit." +description: "Ce chapitre introduit les classes, le mécanisme central pour organiser le code en Ruby. Une classe regroupe des données et des comportements dans un seul endroit." --- Ce chapitre introduit les **classes**, le mécanisme central pour organiser le code en Ruby. Une classe regroupe des données et des comportements dans un seul endroit. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/09-inheritance.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/09-inheritance.md index a31cee2..ea6dacf 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/09-inheritance.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/09-inheritance.md @@ -2,7 +2,7 @@ title: "Comment utiliser l'héritage en Ruby ?" slug: heritage sidebar_position: 9 -description: "Ce chapitre présente l'**héritage**, le mécanisme qui permet à une classe de reprendre tout ce qu'une autre classe définit et d'y ajouter ses propres spécificités." +description: "Ce chapitre présente l'héritage, le mécanisme qui permet à une classe de reprendre tout ce qu'une autre classe définit et d'y ajouter ses propres spécificités." --- Ce chapitre présente l'**héritage**, le mécanisme qui permet à une classe de reprendre tout ce qu'une autre classe définit et d'y ajouter ses propres spécificités. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/10-modules.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/10-modules.md index b22e771..2f065fe 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/10-modules.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/10-modules.md @@ -2,7 +2,7 @@ title: "Comment utiliser les modules en Ruby ?" slug: modules sidebar_position: 10 -description: "Ce chapitre présente les **modules**, un outil pour organiser le code et partager du comportement entre classes. Les modules sont le complément naturel des classes et de l'héritage." +description: "Ce chapitre présente les modules, un outil pour organiser le code et partager du comportement entre classes. Les modules sont le complément naturel des classes et de l'héritage." --- Ce chapitre présente les **modules**, un outil pour organiser le code et partager du comportement entre classes. Les modules sont le complément naturel des classes et de l'héritage. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/11-prepend.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/11-prepend.md index b347d5a..5916f32 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/11-prepend.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/11-prepend.md @@ -2,7 +2,7 @@ title: "Comment étendre du code existant avec prepend en Ruby ?" slug: etendre-du-code-avec-prepend sidebar_position: 11 -description: "Ce chapitre présente les techniques pour **étendre du code existant** sans le modifier directement. C'est un concept fondamental en Ruby : on peut enrichir une classe après sa création, même si on n'a pas accès au fichier source." +description: "Ce chapitre présente les techniques pour étendre du code existant sans le modifier directement. C'est un concept fondamental en Ruby : on peut enrichir une classe après sa création, même si on n'a pas accès au fichier source." --- Ce chapitre présente les techniques pour **étendre du code existant** sans le modifier directement. C'est un concept fondamental en Ruby : on peut enrichir une classe après sa création, même si on n'a pas accès au fichier source. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/12-enumerable.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/12-enumerable.md index 47013b2..66985ee 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/12-enumerable.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/12-enumerable.md @@ -2,7 +2,7 @@ title: "Comment utiliser Enumerable en Ruby ?" slug: enumerable sidebar_position: 12 -description: "Ce chapitre présente **Enumerable**, un module qui donne plus de 50 méthodes de manipulation de collections. On découvre aussi **Comparable**, qui permet de comparer des objets entre eux." +description: "Ce chapitre présente Enumerable, un module qui donne plus de 50 méthodes de manipulation de collections. On découvre aussi Comparable, qui permet de comparer des objets entre eux." --- Ce chapitre présente **Enumerable**, un module qui donne plus de 50 méthodes de manipulation de collections. On découvre aussi **Comparable**, qui permet de comparer des objets entre eux. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/13-errors.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/13-errors.md index 225f1fb..a700007 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/13-errors.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/13-errors.md @@ -2,7 +2,7 @@ title: "Comment gérer les erreurs en Ruby ?" slug: gestion-des-erreurs sidebar_position: 14 -description: "Ce chapitre présente la **gestion des exceptions**, le mécanisme qui permet de réagir quand quelque chose tourne mal dans un programme. Au lieu de crash silencieux ou de valeurs `nil` inexpliquées, on apprend à lever, capturer et traiter les erreurs proprement." +description: "Ce chapitre présente la gestion des exceptions, le mécanisme qui permet de réagir quand quelque chose tourne mal dans un programme. Au lieu de crash silencieux ou de valeurs nil inexpliquées, on apprend à lever, capturer et traiter les erreurs proprement." --- Ce chapitre présente la **gestion des exceptions**, le mécanisme qui permet de réagir quand quelque chose tourne mal dans un programme. Au lieu de crash silencieux ou de valeurs `nil` inexpliquées, on apprend à lever, capturer et traiter les erreurs proprement. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/14-files.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/14-files.md index b29735e..24b1284 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/14-files.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/14-files.md @@ -2,7 +2,7 @@ title: "Comment lire et écrire des fichiers en Ruby ?" slug: lire-et-ecrire-des-fichiers sidebar_position: 15 -description: "Ce chapitre présente la lecture et l'écriture de fichiers, puis la **sérialisation** : transformer des objets Ruby en données qu'on peut sauvegarder et recharger plus tard." +description: "Ce chapitre présente la lecture et l'écriture de fichiers, puis la sérialisation : transformer des objets Ruby en données qu'on peut sauvegarder et recharger plus tard." --- Ce chapitre présente la lecture et l'écriture de fichiers, puis la **sérialisation** : transformer des objets Ruby en données qu'on peut sauvegarder et recharger plus tard. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/15-advanced-classes.md b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/15-advanced-classes.md index 96095f7..6bb75fe 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/ruby/15-advanced-classes.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/ruby/15-advanced-classes.md @@ -2,7 +2,7 @@ title: "Comment utiliser les fonctionnalités avancées des classes en Ruby ?" slug: fonctionnalites-avancees-des-classes sidebar_position: 16 -description: "Ce chapitre présente des fonctionnalités avancées des classes : la surcharge d'opérateurs, le duck typing, `Struct` et la gestion de l'identité des objets. Ces outils rendent les classes plus expressives et naturelles à utiliser." +description: "Ce chapitre présente des fonctionnalités avancées des classes : la surcharge d'opérateurs, le duck typing, Struct et la gestion de l'identité des objets. Ces outils rendent les classes plus expressives et naturelles à utiliser." --- Ce chapitre présente des fonctionnalités avancées des classes : la surcharge d'opérateurs, le duck typing, `Struct` et la gestion de l'identité des objets. Ces outils rendent les classes plus expressives et naturelles à utiliser. diff --git a/src/css/custom.css b/src/css/custom.css index 2f59ce0..f854f49 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -81,27 +81,6 @@ --ifm-global-border-color: #2b2a32; } -/* Cards: single column by default, 2 columns above 1440px */ -article .col.col--6 { - --ifm-col-width: 100%; - max-width: 100%; - flex: 0 0 100%; - padding: 8px; - margin-bottom: 0; -} - -article .row { - margin: -8px; -} - -@media (min-width: 1440px) { - article .col.col--6 { - --ifm-col-width: 50%; - max-width: 50%; - flex: 0 0 50%; - } -} - /* === Footer === */ /* Hide external link icons in the footer (visual noise, redundant diff --git a/src/theme/DocCardList/index.tsx b/src/theme/DocCardList/index.tsx new file mode 100644 index 0000000..09a711a --- /dev/null +++ b/src/theme/DocCardList/index.tsx @@ -0,0 +1,113 @@ +import Link from "@docusaurus/Link"; +import type { + PropSidebarItem, + PropSidebarItemCategory, + PropSidebarItemLink, +} from "@docusaurus/plugin-content-docs"; +import { + filterDocCardListItems, + findFirstSidebarItemLink, + useCurrentSidebarSiblings, + useDocById, +} from "@docusaurus/plugin-content-docs/client"; +import { ThemeClassNames } from "@docusaurus/theme-common"; +import type { Props } from "@theme/DocCardList"; +import clsx from "clsx"; +import type { ReactNode } from "react"; +import styles from "./styles.module.css"; + +/** + * Swizzled DocCardList (safe eject of @docusaurus/theme-classic). + * + * Category index pages (`generated-index`) ship a 2-column grid of boxed, + * truncated cards. That format does not scale: sections like Ruby (16 chapters) + * or the battle engine (16 guides) become a long wall of cards, and a grid + * breaks the reading order of the numbered Ruby course. We render a single + * compact list instead — one scannable row per entry, reading order preserved. + * + * DocCardList is the component the theme marks as `safe` to swizzle (DocCard + * and DocCard/Layout are not), so this owns the whole structure using only the + * public `@docusaurus/plugin-content-docs/client` API — no `theme-common/internal` + * imports, nothing to break on a minor upgrade. The leading-emoji-from-label + * feature is dropped on purpose: no label in this repo uses it. + * + * Descriptions are rendered as plain text: the frontmatter `description` is the + * SEO meta tag and is kept Markdown-free by convention (see CONTRIBUTING.md). + */ + +type RowProps = { + href: string; + title: string; + description?: string; +}; + +function Row({ href, title, description }: RowProps): ReactNode { + return ( + + + {title} + {description && ( + {description} + )} + + + + ); +} + +function CategoryRow({ item }: { item: PropSidebarItemCategory }): ReactNode { + const href = findFirstSidebarItemLink(item); + // Categories with no linkable child are filtered out upstream; guard anyway. + if (!href) { + return null; + } + return ; +} + +function LinkRow({ item }: { item: PropSidebarItemLink }): ReactNode { + const doc = useDocById(item.docId ?? undefined); + return ( + + ); +} + +function DocListRow({ item }: { item: PropSidebarItem }): ReactNode { + switch (item.type) { + case "link": + return ; + case "category": + return ; + default: + // "html" items never appear on generated-index pages. + return null; + } +} + +function CurrentSidebarRows({ className }: { className?: string }): ReactNode { + const items = useCurrentSidebarSiblings(); + return ; +} + +export default function DocCardList(props: Props): ReactNode { + const { items, className } = props; + if (!items) { + return ; + } + const filteredItems = filterDocCardListItems(items); + return ( +
+ {filteredItems.map((item, index) => ( + + ))} +
+ ); +} diff --git a/src/theme/DocCardList/styles.module.css b/src/theme/DocCardList/styles.module.css new file mode 100644 index 0000000..cbc5850 --- /dev/null +++ b/src/theme/DocCardList/styles.module.css @@ -0,0 +1,66 @@ +/** + * Compact list rendering for category index pages (generated-index). + * Replaces the stock boxed-card grid with one scannable row per entry. + * See ./index.tsx for the rationale. + */ + +.list { + margin: 0; +} + +.row { + display: flex; + align-items: center; + gap: 0.9rem; + padding: 0.8rem 0.75rem; + border-bottom: 1px solid var(--ifm-color-emphasis-200); + + --ifm-link-color: var(--ifm-color-emphasis-900); + --ifm-link-hover-color: var(--ifm-color-emphasis-900); + --ifm-link-hover-decoration: none; + + transition: background-color var(--ifm-transition-fast) ease; +} + +/* Rows are direct children of the list, so no trailing separator at the end. */ +.row:last-child { + border-bottom: none; +} + +.row:hover { + background-color: var(--ifm-color-emphasis-100); +} + +/* min-width: 0 lets the truncated description ellipsis work inside flex. */ +.body { + display: flex; + min-width: 0; + flex: 1 1 auto; + flex-direction: column; + gap: 0.15rem; +} + +.title { + font-weight: 600; + line-height: 1.3; +} + +.description { + overflow: hidden; + font-size: 0.85rem; + color: var(--ifm-color-emphasis-600); + text-overflow: ellipsis; + white-space: nowrap; +} + +.chevron { + flex: 0 0 auto; + font-size: 1.4rem; + color: var(--ifm-color-emphasis-500); + transition: transform var(--ifm-transition-fast) ease; +} + +.row:hover .chevron { + color: var(--ifm-color-primary); + transform: translateX(3px); +}