Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMThayer committed Jul 25, 2024
1 parent ac893b1 commit e327933
Show file tree
Hide file tree
Showing 15 changed files with 992 additions and 231 deletions.
41 changes: 39 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
yarn.lock
package-lock.json
### Maven template
target/

### OSX template
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Java template
*.class

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml

## Directory-based project format:
.idea/

## File-based project format:
*.ipr
*.iws
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java temurin-11.0.22+7
328 changes: 99 additions & 229 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,229 +1,99 @@
<div id="top"></div>

<!-- NOTES -->
<!--
*** Individual sections below can be removed if not needed
-->

<!-- PROJECT SHIELDS -->
<!--
*** We are using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]



<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/github_username/repo_name">
<img src="images/logo.png" alt="Logo" width="80" height="80">
</a>

<h3 align="center">project_title</h3>

<p align="center">
project_description
<br />
<a href="https://github.com/github_username/repo_name"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/github_username/repo_name">View Demo</a>
·
<a href="https://github.com/github_username/repo_name/issues">Report Bug</a>
·
<a href="https://github.com/github_username/repo_name/issues">Request Feature</a>
</p>
</div>



<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
</ol>
</details>



<!-- ABOUT THE PROJECT -->
## About The Project

[![Product Name Screen Shot][product-screenshot]](https://example.com)

Here's a blank template to get started: To avoid retyping too much info. Do a search and replace with your text editor for the following: `github_username`, `repo_name`, `twitter_handle`, `linkedin_username`, `email`, `email_client`, `project_title`, `project_description`

<p align="right">(<a href="#top">back to top</a>)</p>



### Built With

* [Next.js](https://nextjs.org/)
* [React.js](https://reactjs.org/)
* [Vue.js](https://vuejs.org/)
* [Angular](https://angular.io/)
* [Svelte](https://svelte.dev/)
* [Laravel](https://laravel.com)
* [Bootstrap](https://getbootstrap.com)
* [JQuery](https://jquery.com)

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- GETTING STARTED -->
## Getting Started

This is an example of how you may give instructions on setting up your project locally.
To get a local copy up and running follow these simple example steps.

### Prerequisites

This is an example of how to list things you need to use the software and how to install them.
* npm
```sh
npm install npm@latest -g
```

### Installation

1. Get a free API Key at [https://example.com](https://example.com)
2. Clone the repo
```sh
git clone https://github.com/github_username/repo_name.git
```
3. Install NPM packages
```sh
npm install
```
4. Enter your API in `config.js`
```js
const API_KEY = 'ENTER YOUR API';
```

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- USAGE EXAMPLES -->
## Usage

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.

_For more examples, please refer to the [Documentation](https://example.com)_

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- ROADMAP -->
## Roadmap

- [] Feature 1
- [] Feature 2
- [] Feature 3
- [] Nested Feature

See the [open issues](https://github.com/github_username/repo_name/issues) for a full list of proposed features (and known issues).

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- CONTRIBUTING -->
## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- LICENSE -->
## License
Distributed under the Apache 2.0 License. See `LICENSE.txt` for more information.
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- MAINTAINERS -->
## Maintainers
- Full Name 1
- GitHub Enterprise: [github_username](https://github.com/username1)
- Email: [email protected]
- Full Name 2
- GitHub Enterprise: [github_username](https://github.com/username2)
- Email: [email protected]
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- ACKNOWLEDGMENTS -->
## Acknowledgments
* []()
* []()
* []()
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/github_username/repo_name.svg?style=for-the-badge
[contributors-url]: https://github.com/github_username/repo_name/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/github_username/repo_name.svg?style=for-the-badge
[forks-url]: https://github.com/github_username/repo_name/network/members
[stars-shield]: https://img.shields.io/github/stars/github_username/repo_name.svg?style=for-the-badge
[stars-url]: https://github.com/github_username/repo_name/stargazers
[issues-shield]: https://img.shields.io/github/issues/github_username/repo_name.svg?style=for-the-badge
[issues-url]: https://github.com/github_username/repo_name/issues
[license-shield]: https://img.shields.io/github/license/github_username/repo_name.svg?style=for-the-badge
[license-url]: https://github.com/github_username/repo_name/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/linkedin_username
[product-screenshot]: images/screenshot.png
# templ

## Easy Handling of Delimiters that Accompany Optional Data

This library provides a simple solution to a common use case in configuration variables:
> _A delimiter is needed to accompany optional data, but must not be present when the optional data is missing._
Traditionally this scenario is solved in one of two ways:
* Treat the delimiter as required, forcing a default value to always be defined and available.
* Embed the optional delimiter in the actual value of the optional data, essentially _corrupting_ the value of the data (`PORT="80"` becomes `PORT=":80"` but clearly the value `:80` is not a valid port number.)

## templ - Is a Primitive Library
Don't expect to use `templ` without writing a little code around it: it is primitive. This library Does One Thing: the substitution processing. You'll need to provide the bindings into your context and use case.

## templ - Solution
The solution pattern provided by `templ` is to include the delimiter(s) inside the double-braces template substitution syntax `{{}}` (as a prefix and/or a suffix).

### Case 1: Undefined value - delimiter is omitted
```
API_HOST="api.example.com"
API_ENDPOINT="{{API_HOST}}{{:API_PORT}}"
```
#### Result: `api.example.com`
(With `API_PORT` undefined, the `:` is excluded from the result.)

### Case 2: Defined value - delimiter is included
```
API_HOST="api.example.com"
API_PORT="8080"
API_ENDPOINT="{{API_HOST}}{{:API_PORT}}"
```
#### Result: `api.example.com:8080`
(With `API_PORT` defined, the `:` is included in the result.)

## Supported Delimiters
There are eighteen supported delimiters:

1. ` <space> `
2. ` , `
3. ` . `
4. ` ; `
5. ` : `
6. ` ? `
7. ` & `
8. ` @ `
9. ` # `
10. ` / `
11. ` ( `
12. ` ) `
13. ` < `
14. ` > `
15. ` _ `
16. ` - `
17. ` \ `
18. ` | `

### Delimiter Rules
* Delimiters can be used as a prefix and/or suffix.
* Any number of delimiters can be used in any combination.

## Nested Evaluation (Dynamic Variables)
Variables can be dynamic.

### Example 1:
```
INSTANCE="3"
HOST_1="devhost1.example.com"
HOST_2="devhost2.example.com"
HOST_3="qa.example.com"
HOST_4="example.com"
SERVICE_ENDPOINT="{{HOST_{{INSTANCE}}}}"
```

This usefulness is compounded when multiple variables are resolved:

### Example 1:
```
INSTANCE="3"
HOST_1="devhost.example.com"
PORT_1="8080"
HOST_2="devhost.example.com"
PORT_2="8081"
HOST_3="qa.example.com"
HOST_4="example.com"
SERVICE_ENDPOINT="{{HOST_{{INSTANCE}}}}{{:PORT_{{INSTANCE}}}}"
```

## UPPERCASE
The value returned by a template evaluation can be converted to uppercase using the `^` character before the variable name.

### Example:
```
ENV="dev"
HOST_DEV="vm123.example.com"
HOST_QA="qa.example.com"
HOST_PROD="example.com"
SERVICE_ENDPOINT="{{HOST_{{^ENV}}}}"
```
> This example shows both the `^` UPPERCASE syntax, and the nested-template resolution to resolve values dynamically.
Binary file removed images/logo.png
Binary file not shown.
Binary file removed images/screenshot.png
Binary file not shown.
Loading

0 comments on commit e327933

Please sign in to comment.