Skip to content
Snippets Groups Projects
README.md 4.46 KiB
Newer Older
Volker Schukai's avatar
Volker Schukai committed
# Bob

bob is an HTML and HTML fragment builder
Volker Schukai's avatar
Volker Schukai committed

## Documentation
Volker Schukai's avatar
Volker Schukai committed

To check out docs and examples, visit [gitlab.schukai.com/oss/bob](https://gitlab.schukai.com/oss/bob)
Volker Schukai's avatar
Volker Schukai committed

## Installation
Volker Schukai's avatar
Volker Schukai committed

```bash
wget -O ~/.local/bin/bob http://download.schukai.com/tools/bob/bob-$( uname -s | tr [:upper:] [:lower:])-$(echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`) && chmod u+x ~/.local/bin/bob
```
Volker Schukai's avatar
Volker Schukai committed

## Usage
Volker Schukai's avatar
Volker Schukai committed

### Template

#### Prepare

```bash
bob template prepare --input ./templates/ --output ./output/
```

This will create files in the `./output/` directory with all parsed templates from `./templates/` directory.
Also, a data YAML. This data YAML is used to generate the final files.

This command prepares the title, description, keywords, and other metadata for the templates.
Furthermore, it will parse the templates for images, anchors, and text.

| Original                                                                      | Parsed                                                                                                                                          |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `<html lang="en"><head>`                                                      | `<html lang="en" data-attributes="lang path:lang"><head>`                                                                                       |
| `<title>Bob</title>`                                                          | `<title data-attributes="title path:title">Bob</title>`                                                                                         |
| `<meta name="description" content="Bob is a html and html fragment builder">` | `<meta name="description" content="Bob is a html and html fragment builder" data-attributes="description path:meta.description">`               |
| `<img alt="alt text" title="my title" src="..." `                            | `<img alt="alt text" title="my title" src="..." data-attributes="alt path:img.id1003.alt title path:img.id1003.title src path:img.id1003.src">` |
| `<a href="https://gitlab.schukai.com/oss/bob">`                              | `<a href="https://gitlab.schukai.com/oss/bob" data-attributes="href path:a.id1004.href">`                                                       |
| `<p>Bob is a html and html fragment builder</p>`                              | `<p><span data-attributes="text path:p.id1005.text">Bob is a html and html fragment builder</span></p>`                                         |


#### HTML

##### Generate
This will generate HTML files from the prepared templates.

```bash
bob html generate --input ./output/ --output ./output/
```

##### Sync

This will sync HTML nodes from a source to a destination.

```bash
bob html sync --specification ./specification.yaml 
The structure of the specification file is as follows:

```yaml
sync:
  - source:
      path: './source.html'
    destination:
      path: './'
      exclude:
        - ./source.html
With the above specification, the `head` node from `./source.html` will be synced to all files in `./` except `./source.html`.
Furthermore, the `title` node will be kept.
Relative paths are relative to the specification file. Absolute paths are absolute, obviously.

#### Cut

This will cut a node from a source file and save it to a destination template file.

```bash
bob template cut --specification ./specification.yaml 
```

The structure of the specification file is as follows:

```yaml
snippet:
  -
    source: ./test.html
    selector: 'head'
    destination: ./snippets/container.html
    attribute:
      - selector: 'li'
        name: 'class'
        value: 'list-item'
    replacement:
      -
        selector: '#myid'
        content: 'replacement content'
```
Relative paths are relative to the specification file.
Volker Schukai's avatar
Volker Schukai committed

## Questions
Volker Schukai's avatar
Volker Schukai committed

For questions and commercial support, please contact [schukai GmbH](https://www.schukai.com/).
The issue list of this repo is exclusively for bug reports and feature requests.
Volker Schukai's avatar
Volker Schukai committed

## Issues
Volker Schukai's avatar
Volker Schukai committed

Please make sure to read the Issue Reporting Checklist before opening an
issue. Issues not conforming to the guidelines may be closed immediately.
Volker Schukai's avatar
Volker Schukai committed

## License
Volker Schukai's avatar
Volker Schukai committed

© schukai GmbH, released under the AGPL 3.0 License.
Volker Schukai's avatar
Volker Schukai committed

[AGPL](https://www.gnu.org/licenses/agpl-3.0.de.html)
Volker Schukai's avatar
Volker Schukai committed

You can also purchase a commercial license.