Skip to content

mdBook preprocessor for variable interpolation using the Fluent language

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
Notifications You must be signed in to change notification settings

JakubKoralewski/mdbook-fluent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdbook-fluent

Build Status crates.io Crates.io

A simple WIP preprocessor for mdBook. It uses the Fluent language to interpolate variables inside your book.

Building on the shoulders of giants via the fluent-rs Rust implementation of the Fluent Project.

DISCLAIMER:
This preprocessor is not currently designed to be used to translate books! This is because mdBook itself is not designed this way!

Getting started

Check out the ./examples/example folder for a working example.

Install

cargo install mdbook-fluent

book.toml

Add this to your book.toml:

[preprocessor.fluent]

Fluent files

In the fluent directory create files with the .ftl extension containing your variables. The name of each file will be used to group the variables into logical chunks.

You can use the dir key in the config to change the name of the directory containing your .ftl files.

Example Fluent File:

# fluent/example.ftl
Hello-world = Hello, world!
some-variable =
    .some-attribute = xd
multi-line =
    This is a multi-line Fluent value.
    The spaces before these lines will be automatically
    removed!

Syntax:

In your books use the {{#fluent FILE_NAME.TAG}} or {{#fluent FILE_NAME.TAG.ATTRIBUTE}} syntax, like so:

# Chapter 1

```
{{#fluent ch01.Hello-world}}
```

```rust,include
{{#include ../listing/example.rs}}
```

As you can see above, you can put the same {{#fluent ...}} tags inside other files that will be included using the built-in links preprocessor.

Build

Now simply build your book like you would normally:

mdbook build

Contributions

I welcome any contributions, whether they would be issues, feature requests, pull requests or questions.

License

MIT or APACHE

About

mdBook preprocessor for variable interpolation using the Fluent language

Topics

Resources

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages