diff options
| author | Leandre17 <leandre.godet@epitech.eu> | 2025-02-13 12:17:59 +0100 |
|---|---|---|
| committer | Leandre17 <leandre.godet@epitech.eu> | 2025-02-13 12:17:59 +0100 |
| commit | 0e4cfbb361a0c0f084a63099219a94bc33c6cc48 (patch) | |
| tree | 84d985451f1be01a4d125c67212179cacdab3727 | |
| parent | 9d4049b15d18ebf7f07dfb5b713de22d88c122c2 (diff) | |
fix _extention.qmd to explain the new version of the leandre filter extension
| -rw-r--r-- | _extensions/leandre-filter/leandre.lua | 4 | ||||
| -rw-r--r-- | _extention.qmd | 17 |
2 files changed, 11 insertions, 10 deletions
diff --git a/_extensions/leandre-filter/leandre.lua b/_extensions/leandre-filter/leandre.lua index 25ea053..650e195 100644 --- a/_extensions/leandre-filter/leandre.lua +++ b/_extensions/leandre-filter/leandre.lua @@ -1,6 +1,4 @@ function Str(el) - el.text = el.text:gsub("Leandre", "Léandre") - el.text = el.text:gsub("leandre", "Léandre") - el.text = el.text:gsub("LEANDRE", "Léandre") + el.text = el.text:gsub("[Ll][Ee][Aa][Nn][Dd][Rr][Ee]", "Léandre") return el end diff --git a/_extention.qmd b/_extention.qmd index 4fbb66f..2a8f92d 100644 --- a/_extention.qmd +++ b/_extention.qmd @@ -6,8 +6,10 @@ A filter extention is a flexible and powerful tool for introducing new global be # Creation -To create a extention we need to have an "_extensions" folder and in this folder we need to create a folder for each extention. -For each extention we need to have a file name "_extension.yml" to tell quarto the structure of this extention. Here is an exemple: +To create a extention we need to have an "_extensions" folder +and in this folder we need to create a folder for each extention. +For each extention we need to have a file name "_extension.yml" to tell quarto the structure of this extention. +Here is an exemple: ```yaml title: Leandre Name Filter author: Léandre @@ -32,13 +34,14 @@ _extensions/ For this exemple we will talk about the file leandre.lua ```lua function Str(el) - if el.text:find("Leandre") then - el.text = el.text:gsub("Leandre", "Léandre") - end + el.text = el.text:gsub("[Ll][Ee][Aa][Nn][Dd][Rr][Ee]", "Léandre") return el end ``` -What do this small code do is searching for the string "Leandre" and when it find it. It will replace it with the string "Léandre" +What do this small code do is using the function gsub for each part of the document. +The gsub function search for a patern and replace it with the given string. +The patern given here "[Ll][Ee][Aa][Nn][Dd][Rr][Ee]" to permit to have evry possibility covered of the word léandre. + # More resources @@ -53,4 +56,4 @@ More about filter [https://quarto.org/docs/extensions/filters.html](https://quarto.org/docs/extensions/filters.html) And other type of extension -[https://quarto.org/docs/extensions/creating.html#development](https://quarto.org/docs/extensions/creating.html#development)
\ No newline at end of file +[https://quarto.org/docs/extensions/creating.html#development](https://quarto.org/docs/extensions/creating.html#development) |
