Overview
| Comment: | [build][fr] variable sContext for regex rules too [doc] update |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fr | build | doc |
| Files: | files | file ages | folders |
| SHA3-256: |
d31122ee4c57ad92831cd9f521ce9128 |
| User & Date: | olr on 2020-04-16 16:36:06 |
| Other Links: | manifest | tags |
Context
|
2020-04-16
| ||
| 17:28 | [build] rule names are now mandatory [doc] update check-in: 564da6fd9a user: olr tags: trunk, build, doc | |
| 16:36 | [build][fr] variable sContext for regex rules too [doc] update check-in: d31122ee4c user: olr tags: trunk, fr, build, doc | |
| 15:29 | [fr] ajustements check-in: 6db406f50b user: olr tags: trunk, fr | |
Changes
Modified compile_rules.py from [5ad409424e] to [9f8d749ce1].
| ︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
return dColorType
def prepareFunction (s):
"convert simple rule syntax to a string of Python code"
s = s.replace("__also__", "bCondMemo")
s = s.replace("__else__", "not bCondMemo")
s = re.sub(r"isStart *\(\)", 'before("^ *$|, *$")', s)
s = re.sub(r"isRealStart *\(\)", 'before("^ *$")', s)
s = re.sub(r"isStart0 *\(\)", 'before0("^ *$|, *$")', s)
s = re.sub(r"isRealStart0 *\(\)", 'before0("^ *$")', s)
s = re.sub(r"isEnd *\(\)", 'after("^ *$|^,")', s)
s = re.sub(r"isRealEnd *\(\)", 'after("^ *$")', s)
s = re.sub(r"isEnd0 *\(\)", 'after0("^ *$|^,")', s)
| > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
return dColorType
def prepareFunction (s):
"convert simple rule syntax to a string of Python code"
s = s.replace("__also__", "bCondMemo")
s = s.replace("__else__", "not bCondMemo")
s = s.replace("sContext", "_sAppContext")
s = re.sub(r"isStart *\(\)", 'before("^ *$|, *$")', s)
s = re.sub(r"isRealStart *\(\)", 'before("^ *$")', s)
s = re.sub(r"isStart0 *\(\)", 'before0("^ *$|, *$")', s)
s = re.sub(r"isRealStart0 *\(\)", 'before0("^ *$")', s)
s = re.sub(r"isEnd *\(\)", 'after("^ *$|^,")', s)
s = re.sub(r"isRealEnd *\(\)", 'after("^ *$")', s)
s = re.sub(r"isEnd0 *\(\)", 'after0("^ *$|^,")', s)
|
| ︙ | ︙ |
Modified doc/syntax.txt from [3e9971cb59] to [d2fc6c099d].
| ︙ | ︙ | |||
417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
`sCountry`
> Contains the current country locale of the checked paragraph.
colour <<- sCountry == "US" ->> color # Use American English spelling.
## ACTIONS ##
There are 5 kinds of actions:
1. Suggestions. The grammar checker suggests corrections.
2. Text processor. A internal process to modify the text internally. This is used to simplify grammar checking.
| > > > > | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
`sCountry`
> Contains the current country locale of the checked paragraph.
colour <<- sCountry == "US" ->> color # Use American English spelling.
`sContext`
> The name of the application running (Python, Writer…)
## ACTIONS ##
There are 5 kinds of actions:
1. Suggestions. The grammar checker suggests corrections.
2. Text processor. A internal process to modify the text internally. This is used to simplify grammar checking.
|
| ︙ | ︙ |
Modified gc_lang/fr/rules.grx from [12c296cd9c] to [4e2e450a5e].
| ︙ | ︙ | |||
815 816 817 818 819 820 821 822 823 824 825 826 827 828 |
TEST: Je suis là. {{viens}}. ->> Viens
TEST: Ils sont devenus idiots. {{c}}’est peine perdue.
__<s>/maj(majuscule_début_paragraphe)__
^ *([a-zàâéèêîôç](?:[\w-]+[’'`‘]?|[’'`‘])) @@$
<<- after("\\w\\w[.] +\\w+") -1>> =\1.capitalize() # Majuscule en début de phrase, sauf éventuellement lors d’une énumération.
TEST: {{je}} suis disponible quand tu veux. Mais pas aujourd’hui.
TEST: {{j’}}arrive. Prépare-toi.
TEST: {{qu’}}il est grand, ce batiment. Faut voir si on pourra la détruire avec si peu de charges.
!!
!!
| > | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 |
TEST: Je suis là. {{viens}}. ->> Viens
TEST: Ils sont devenus idiots. {{c}}’est peine perdue.
__<s>/maj(majuscule_début_paragraphe)__
^ *([a-zàâéèêîôç](?:[\w-]+[’'`‘]?|[’'`‘])) @@$
<<- after("\\w\\w[.] +\\w+") -1>> =\1.capitalize() # Majuscule en début de phrase, sauf éventuellement lors d’une énumération.
# autre possibilité: avec or (sContext != "Writer" and after("[.] *$"))
TEST: {{je}} suis disponible quand tu veux. Mais pas aujourd’hui.
TEST: {{j’}}arrive. Prépare-toi.
TEST: {{qu’}}il est grand, ce batiment. Faut voir si on pourra la détruire avec si peu de charges.
!!
!!
|
| ︙ | ︙ |