generated from CIFriends/typescript-action-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
906983c
commit 251a196
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## Tutorial | ||
|
||
This action allows you to replace variables in a text file. The variables are defined in a map and can be used in the | ||
text file with the following syntax: `{_ variable _}`. Spaces are allowed around the variable name. | ||
|
||
### Example | ||
|
||
Here's an example of how to use: | ||
|
||
```typescript | ||
import { processFiles } from 'library'; | ||
|
||
const variables = new Map<string, string>(); | ||
variables.set('EXAMPLE', 'World'); | ||
variables.set('what', 'Hello'); | ||
|
||
processFiles({ | ||
files: ['readme.prp.md'], | ||
variables: variables, | ||
encodings: 'utf8', | ||
extension: '.prp.md' | ||
}); | ||
``` | ||
|
||
### Greetings | ||
|
||
{_ what _}, {_ EXAMPLE _}! {_what _} {_ EXAMPLE_}{_what_} | ||
|
||
### Complex Variables | ||
|
||
This section includes variables with more complex names to test the robustness of the regular expression in | ||
the `replaceVariables` function. | ||
|
||
{_ variable with spaces _} | ||
{_ variable_with_underscores _} | ||
{_ variable-with-dashes _} | ||
{_ variable.with.dots _} |