HtmGem/docs/BNF-fr.gmi

118 lines
4.2 KiB
Plaintext
Raw Normal View History

2021-03-25 22:47:12 +00:00
# BNF
2021-03-27 22:31:47 +00:00
### Backus-Naur Form
=> https://fr.wikipedia.org/wiki/Forme_de_Backus-Naur Wikipedia / BNF
2021-03-25 22:47:12 +00:00
2021-03-27 22:31:47 +00:00
(EN) The purpose of this document is to show the BNF that HtmGem uses and the way it determines the line type and what information it fetches from. For this, it uses **curly brackets** to explicitely show what information it takes. In addition to this, the **canonical form** shows how it should be displayed.
(FR) Le but de ce document est de montrer la BNF que HtmGem utilise et la façon dont il détermine le type de ligne et quelles informations il en tire. Pour cela, il utilise des **accolades** pour montrer explicitement quelles informations il prend. De plus, la **forme canonique** montre comment ça devrait être affiché.
2021-03-25 22:47:12 +00:00
———————————————————— ✀ ————————————————————
textgemini = *(link / preformat / heading / ulist / quoted / plain)
; Preformat toggle starts as 'false'.
plain = **{[WSP] text} [WSP]** end-of-line
; If preformat toggle is false, wrap text to the
; width of the display. Otherwise, do no wrapping.
; canonical form = {[WSP] text}
preformat = "```" **[WSP]** [{alt-text}] **[WSP]** end-of-line
; Preformat toggle set to opposite state:
; false goes to true
; true goes to false
; While in preformat toggle is true, link, heading,
; ulist and quoted lines are NOT interpreted, but
; displayed as is to the user.
; canonical form = ``` [SP {alt-text}]
link = '=>' **[WSP]** [{URI-reference}] [**[WSP]** {text}] end-of-line
; canonical form = '=>' SP {uri-reference} [SP {text}]
heading = '#' **[WSP]** [{text}] **[WSP]** end-of-line
/ '##' **[WSP]** {text} **[WSP]** end-of-line
/ '###' **[WSP]** {text} **[WSP]** end-of-line
; canonical form = ('#' / '##' / '###') [SP {text}]
ulist = '*' **[WSP]** {text} **[WSP]** end-of-line
; canonical form = '*' SP {text}
quoted = '>' **[WSP]** {text} **[WSP]** end-of-line
; canonical form = '>' SP {text}
alt-text = text
text = ***UVCHAR**
end-of-line = [CR] LF
UVCHAR = VCHAR / UTF8-2v / UTF8-3 / UTF8-4
UTF8-2v = %xC2 %xA0-BF UTF8-tail ; no C1 control set
/ %xC3-DF UTF8-tail
; CRLF from RFC-5234
; DIGIT from RFC-5234
; SP from RFC-5234
; VCHAR from RFC-5234
; OCTET from RFC-5234
; WSP from RFC-5234
;
; UTF8-3 from RFC-3629
; UTF8-4 from RFC-3629
; UTF8-tail from RFC-3629
———————————————————— ✀ ————————————————————
2021-03-27 22:31:47 +00:00
(EN) This BNF was taken from the working group and adapted to HtmGem's implementation.
(FR) Cette BNF a été adaptée à limplémentation de HtmGem depuis la version du groupe de travail.
2021-03-25 22:47:12 +00:00
=> https://gitlab.com/gemini-specification/gemini-text/-/issues/7 Gitlab / Original ticket
2021-03-27 22:31:47 +00:00
(EN) Changes:
2021-03-25 22:47:12 +00:00
* white space management
* capture of text {}
* canonical form
2021-03-27 22:31:47 +00:00
(FR) Changements :
* gestion des espaces blancs
* capture du texte {}
* forme canonique
2021-03-25 22:47:12 +00:00
2021-03-27 22:31:47 +00:00
(EN) The white spaces that end a line are never used. See the definition of //text// in the BNF, which no longer contains //SP//.
(FR) Les espaces blancs terminant une ligne ne sont jamais utilisés. Voir la définition de //text// dans la BNF, qui ne contient plus //SP//.
2021-03-25 22:47:12 +00:00
2021-03-27 22:31:47 +00:00
# Exemples
2021-03-25 22:47:12 +00:00
2021-03-27 22:31:47 +00:00
## => liens
2021-03-25 22:47:12 +00:00
2021-03-27 22:31:47 +00:00
### Lien normal
2021-03-25 22:47:12 +00:00
> link = '=>' [WSP] [{URI-reference}] [[WSP] {text}] end-of-line
> ; canonical form = '=>' SP {uri-reference} [SP {text}]
Source: => foo.invalid text of the link
Data: '=>' {'foo.invalid'} {'text of the link'}
Canonical: => foo.invalid text of the link
Html: <a href="foo.invalid">text of the link</a>
Source: =>foo.invalid text of the link
Data: '=>' {'foo.invalid'} {'text of the link'}
Canonical: => foo.invalid text of the link
Html: <a href="foo.invalid">text of the link</a>
Source: => just_a_page
Data: '=>' {'just_a_page'} {}
Canonical: => just_a_page
Html: <a href="just_a_page">just_a_page</a>
Source: =>
Data: '=>' {''} {''}
Canonical: =>
Html: <a href="">&nbsp;</a>
2021-03-27 22:31:47 +00:00
## # En-têtes
2021-03-25 22:47:12 +00:00
> heading = '#' **[WSP]** [{text}] **[WSP]** end-of-line
> (…)
> ; canonical form = ('#' / '##' / '###') [SP {text}]
Source: #title
Data: '#' {"title"}
Canonical: # title
Source: # title with two spaces between title and with
Data: '#' {"title with spaces"}
Canonical: # title with two spaces between title and with