Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jason-fox/fox.jason.extend.css

DITA-OT Plug-in to extend HTML processing and allow additional plug-ins to add an extra CSS stylesheet to the <header> of each HTML page.
https://github.com/jason-fox/fox.jason.extend.css

css dita-ot dita-ot-html-plugin dita-ot-plugin html-css

Last synced: about 12 hours ago
JSON representation

DITA-OT Plug-in to extend HTML processing and allow additional plug-ins to add an extra CSS stylesheet to the <header> of each HTML page.

Awesome Lists containing this project

README

        

# Extended CSS Plugin for DITA-OT [](https://extend-cssdita-ot.rtfd.io/)

[![license](https://img.shields.io/github/license/jason-fox/fox.jason.extend.css.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![DITA-OT 4.2](https://img.shields.io/badge/DITA--OT-4.2-green.svg)](http://www.dita-ot.org/4.2)
[![CI](https://github.com/jason-fox/fox.jason.extend.css/workflows/CI/badge.svg)](https://github.com/jason-fox/fox.jason.extend.css/actions?query=workflow%3ACI)

This is an abstract base [DITA-OT Plug-in](https://www.dita-ot.org/plugins) to extend HTML processing and allow
additional plug-ins to add an extra CSS stylesheet to the `` of each HTML page. By default the plug-in does
nothing appart from creating a temporary file `extend.css.file` - it is designed to be extended so other plugins can add
CSS to the blank file.

It offers three extension-points for further CSS processing.

Table of Contents

- [Install](#install)
- [Installing DITA-OT](#installing-dita-ot)
- [Installing the Plug-in](#installing-the-plug-in)
- [Usage](#usage)
- [Extension points](#extension-points)
- [Example](#example)
- [License](#license)

## Install

The DITA-OT Extended CSS plug-in has been tested against [DITA-OT 3.x](http://www.dita-ot.org/download). It is
recommended that you upgrade to the latest version.

### Installing DITA-OT

The DITA-OT Extended CSS plug-in is an extension for the DITA Open Toolkit.

- Full installation instructions for downloading DITA-OT can be found
[here](https://www.dita-ot.org/4.0/topics/installing-client.html).

1. Download the `dita-ot-4.2.zip` package from the project website at
[dita-ot.org/download](https://www.dita-ot.org/download)
2. Extract the contents of the package to the directory where you want to install DITA-OT.
3. **Optional**: Add the absolute path for the `bin` directory to the _PATH_ system variable.

This defines the necessary environment variable to run the `dita` command from the command line.

```console
curl -LO https://github.com/dita-ot/dita-ot/releases/download/4.2/dita-ot-4.2.zip
unzip -q dita-ot-4.2.zip
rm dita-ot-4.2.zip
```

### Installing the Plug-in

- Run the plug-in installation commands:

```console
dita install https://github.com/jason-fox/jason.fox.extend.css/archive/master.zip
```

The `dita` command line tool requires no additional configuration.

---

## Usage

Run any HTML dita transform e.g.:

```console
PATH_TO_DITA_OT/bin/dita -f html5 -o out -i document.ditamap
```

Each HTML output file will include an additional line in the ``

```html

...

```

The file `common-extended.css` will include any CSS added via the extension points described below.

### Extension points

CSS rules are always position dependent - the rule defined last in a file will supercede previous definitions. This
plug-in is offers three extension points where CSS can be appended to a file so that CSS rules can be added in order.

- `extend.css.process.pre` - Runs an additional Ant target before the extended css processing stage.

- `extend.css.process` - Runs an additional Ant target as part of the extended css processing stage.

- `extend.css.process.post` - Runs an additional Ant target after the extended css processing.

#### Example

The following `plugin.xml` will invoke an extension point and append additional CSS to `extend.css.file` which is copied
to the output

##### `plugin.xml` Configuration

```xml



```

##### ANT build file: `build.xml`

```xml




```

Working examples can be found in the
[DITA-OT Swagger plug-in](https://github.com/jason-fox/fox.jason.passthrough.swagger) and
[DITA-OT Prism-JS plug-in](https://github.com/jason-fox/fox.jason.prismjs) repositories.

## License

[Apache 2.0](LICENSE) © 2019 - 2024 Jason Fox