yw2html

Export html from yWriter 7

This project is maintained by peter88213

Project homepage

The yw2html Python script runs through all chapters and scenes of a yWriter 7 project and fills HTML templates.

Usage

usage: yw_to_html.py [-h] [-t template-dir] [-s suffix] [--silent] Project

positional arguments:

Project yWriter project file

optional arguments:

-h, --help show a help message and exit

-t template-dir template directory

-s suffix suffix to output file name

--silent suppress error messages and the request to confirm overwriting

If no template directory is set, templates are searched for in the yWriter project directory.

If no templates are found, the output file will be empty.

Define templates “internally” in yWriter (optional)

yw2html looks for a unused chapter named html templates. HTML templates can be placed there as scenes. The title of the scene is the same as the name of the template file would be, but without the .html extension. External HTML templates are overridden by internally defined templates, if any.

In the release zipfile, you find a yWriter sample project with internally defined HTML templates in the examples\add-on subdirectory.

Examples

The downloaded zip file includes a directory named examples containing a template directory with example templates for different purposes and some example batch files showing the correct commands. You can launch the batch files by dragging and dropping your yWriter project on the icons. The results will be written to the yWriter project directory.

List of templates

Project level templates

Chapter level templates

Scene level templates

Placeholders

Syntax

There are two options:

  1. $Placeholder
  2. ${Placeholder}

“HTML header” placeholders

“Chapter template” placeholders

“Scene template” placeholders

“Character template” placeholders

“Location template” placeholders

“Item template” placeholders