Commit 0642d3eb authored by Rieks Joosten's avatar Rieks Joosten

update and test %-selection regexes

parent 22d9fe9b
Pipeline #16884 passed with stage
in 2 minutes and 8 seconds
......@@ -15,3 +15,4 @@ start_server.bat
*.lnk
docs/vscode-%%-batch-replacer.txt
**/zzz-*
docs/test.md
This diff is collapsed.
......@@ -17,6 +17,7 @@
beg = "(?<=\W%%)"
mid = "(?<=\|)"
end = "(?=%%\W)"
ss = "(?:['’]?s)?"
dutyright = "(?:dut(?:y|ies)|rights?)"
dutyright = "%{dutyright}(?:-*(?:/|and|or|and/or)-*%{dutyright})?"
......@@ -29,7 +30,7 @@ dutyrighttype = "%{dutyright}-types?"
// `filter "*.txt"` - any .txt file in the root folder
// `filter "**/*.txt"` - any .txt file
filter "docs/terms/credential-type.md"
filter "docs/functional-architecture.md"
// PREPROCESSING: convert single-%-notations into %%-notations.
......@@ -38,11 +39,16 @@ filter "docs/terms/credential-type.md"
// with "$1$2$3"
// First, convert %show text% into %%show text%%
replace-regex "(?<=\s%)(([\w/-]|'|\s)*)(?=%([,.]?\s|-\w))"
// Test set: none may match: %verif%er, %verif"ier%, "%verifier%", `%verifier%`
// Test set: all must match: %my verifier%, (%verifiers%), %verifier's%, %verifier’s%, (%(ver)/ifier%):., %(our) (vfyr)%, %verifier's%. %verifier’s%.....
// replace-regex "(?<=\s\(?%)(\w|\s|\(|\)|[/-’'"])+(?=%([)":,.!?]*\s|-\w))"
replace-regex "(?<=\s\(?%)([^%]+)(?=%(([):,.!?]|\[[^\]]*\]){0,2}\s|-\w))"
with "%$1%"
// Only thereafter can we convert %showtext (words without trailing `%`-char) into %%showtext%%
replace-regex "(?<=\s%)(([\w/-]|')*)(?=[,.]?\s)"
// Test set: none may match: %verif%er, %(our) (verifier)%,
// Test set: all must match: %verifier non-matching-text, %verifiers, %verifier's, %verifier’s, %verifier:, (%verifiers), %verifier's..... %verifier’s,?.!?
replace-regex "(?<=(?:\s\(?|/)%)((\w+((/|-|’|')\w)?)+)(?=(\)?[:,.!?]*\s))"
with "%$1%%"
// Then, we can expand %%show text%% into %%show text|show text%%
......@@ -68,25 +74,25 @@ with "$1-$2"
// ACTUAL PROCESSING: now we need to convert well-known `lowercase-show-text`s to appropriate `reftexts`
// [A]
replace-regex "%{mid}(action|actor|agent|assertion|author)'?s%{end}"
replace-regex "%{mid}(action|actor|agent|assertion|author)%{ss}%{end}"
with "$1"
// [B]
replace-regex "%{mid}(business-transaction)'?s?%{end}"
replace-regex "%{mid}(business-transaction)%{ss}?%{end}"
with "$1"
// [C]
// for 'claim', see 'statement'
replace-regex "%{mid}(colleague|concept|credential(-type)?|commitment-decision)'?s?%{end}"
replace-regex "%{mid}(colleague|concept|credential(-type)?|commitment-decision)%{ss}?%{end}"
with "$1"
replace-regex "%{mid}communications?-(channel|session)'?s?%{end}"
replace-regex "%{mid}communications?-(channel|session)%{ss}?%{end}"
with "communication-$1"
// [D]
replace-regex "%{mid}(definition|dependent|dictionary-file|dictionary|documentation-interop)'?s?%{end}"
replace-regex "%{mid}(definition|dependent|dictionary-file|dictionary|documentation-interop)%{ss}?%{end}"
with "$1"
replace-regex "%{mid}(?:electronic-|digital-)(actor|agent|colleague|communication-channel|policy)'?s%{end}"
replace-regex "%{mid}\(?(?:electronic|digital)\)?-(actor|agent|colleague|communication-channel|policy)%{ss}%{end}"
with "digital-$1"
replace-regex "%{mid}(%{dutyrighttype}|%{dutyright})%{end}"
......@@ -94,17 +100,17 @@ with "pattern-duties-and-rights"
replace-regex "%{mid}data-(collector|discloser)-polic(y's|ies)%{end}"
with "data-$1-policy"
replace-regex "%{mid}data-(collector|discloser)'?s?%{end}"
replace-regex "%{mid}data-(collector|discloser)%{ss}?%{end}"
with "data-$1"
// [E]
replace-regex "%{mid}(employee|employer)'?s%{end}"
replace-regex "%{mid}(employee|employer)%{ss}%{end}"
with "$1"
replace-regex "%{mid}(legal-)?entit(y's|ies)%{end}"
with "$1entity"
// [G]
replace-regex "%{mid}(glossary-file|guardian(ship)?(-relationship)?(-type)?)'?s%{end}"
replace-regex "%{mid}(glossary-file|guardian(ship)?(-relationship)?(-type)?)%{ss}%{end}"
with "$1"
replace-regex "%{mid}glossar(y's|ies)%{end}"
with "glossary"
......@@ -117,20 +123,20 @@ with "governance"
// [H-I-J-K] (all holder, issuer, verifier and wallet stuff, too)
// for associated policies, see [P]
replace-regex "%{mid}(holder|issuer|verifier|wallet|identifier|jurisdiction(-governor)?|knowledge(-governor)?)'?s%{end}"
replace-regex "%{mid}(holder|issuer|verifier|wallet|identifier|jurisdiction(-governor)?|knowledge(-governor)?)%{ss}%{end}"
with "$1"
// [L-M]
replace-regex "%{mid}(legal-jurisdiction|legal-system|mental-model)'?s%{end}"
replace-regex "%{mid}(legal-jurisdiction|legal-system|mental-model)%{ss}%{end}"
with "$1"
// for 'legal entities', see 'entities'
// [O]
replace-regex "%{mid}(objective|organization|owned|owner|ownership)'?s%{end}"
replace-regex "%{mid}(objective|organization|owned|owner|ownership)%{ss}%{end}"
with "$1"
// [P]
replace-regex "%{mid}(participant|pattern-file|pattern|(peer-)(actor|agent)|policy-governor|presentation-request|presentation|principal)'?s%{end}"
replace-regex "%{mid}(participant|pattern-file|pattern|(peer-)(actor|agent)|policy-governor|presentation-request|presentation|principal)%{ss}%{end}"
with "$1"
replace-regex "%{mid}(|peer-)part(y's|ies)%{end}"
with "$1party"
......@@ -139,21 +145,21 @@ with "$1policy"
// [R-S]
// For 'rights', see [D]uties
replace-regex "%{mid}(risk|scope-file|scope|ssi-agent)'?s%{end}"
replace-regex "%{mid}(risk|scope-file|scope|ssi-agent)%{ss}%{end}"
with "$1"
replace-regex "%{mid}(statement|claim)'?s%{end}"
replace-regex "%{mid}(statement|claim)%{ss}%{end}"
with "assertion"
// [T]
// for transaction data collector/discloers policies, see [P]
replace-regex "%{mid}(term-file|term|transaction-(agreement|data-(collector|discloser)|form|proposal))'?s%{end}"
replace-regex "%{mid}(term-file|term|transaction-(agreement|data-(collector|discloser)|form|proposal))%{ss}%{end}"
with "$1"
replace-regex "%{mid}transaction'?s?%{end}"
replace-regex "%{mid}transaction%{ss}?%{end}"
with "business-transaction"
// [V]
// for verifier stuff - see holder
replace-regex "%{mid}(verifiable-credential|verifier)'?s%{end}"
replace-regex "%{mid}(verifiable-credential|verifier)%{ss}%{end}"
with "$1"
replace-regex "%{mid}vocabular(y's|ies)%{end}"
with "vocabulary"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment