yw2xtg

XPress tagged text export from yWriter projects

This project is maintained by peter88213

Project homepage > Instructions for use


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

Instructions for use

Intended usage

The included installation script prompts you to create a shortcut on the desktop. You can launch the program by dragging a yWriter project file and dropping it on the shortcut icon.

Command line usage

Alternatively, you can

usage: yw2xtg.pyw [--silent] Sourcefile

positional arguments:

Sourcefile

The path of the yWriter project file.

optional arguments:

--silent suppress error messages and the request to confirm the use of default values


General

About XTG

The XTG file format uses the XPress Tags language, the knowledge of which is assumed. You can download the manual A Guide to XPress Tags for your program version from the Quark web site.

yWriter text markup

Bold and italics are supported. Other highlighting such as underline and strikethrough are lost.

Quotation marks and punctuation

It is assumed that quotation marks and punctuation marks are already set correctly; this is best done in advance with a word processor, e.g. via yWriter’s “proof read” function.

Configuration

Configuration file

This is an exapmle configuration file containing the default values mentioned above:

[STYLES]
first_paragraph = @Text body:

# XPress tag for paragraphs preceded by a heading or a blank line.

indented_paragraph = @Text body indent:

# XPress tag for indented paragraphs.

other_paragraph = @First line indent:

# XPress tag for regular paragraphs.

italic = <@Emphasis>

# XPress tag opening italic sections. 

italic0 = <@$p>

# XPress tag closing italic sections.

bold = <@Strong emphasis>

# XPress tag opening bold sections.

bold0 = <@$p>

# XPress tag closing bold sections.

acronym =

# XPress tag opening acronyms.
 
acronym0 = 

# XPress tag closing acronyms.

figure =

# XPress tag opening figure groups.

figure0 = 

# XPress tag closing figure groups.

[OPTIONS]

adjust_digits = Yes

# If True, adjust digit-separating blanks.

space_points = Yes

# If True, space digit-separating points.

per_chapter = No

# If True, create one XTG file for each chapter.
# If False, create one XTG file for the entire document.

Style tags

Options

You can define styles in fileHeader.XTG, but it is preferable to use the names of styles that already exist in the QX book project instead.

List of templates

Project level templates

Chapter level templates

Scene level templates

Placeholders

Syntax

There are two options:

  1. $Placeholder
  2. ${Placeholder}

“Project template” placeholders

“Chapter template” placeholders

“Scene template” placeholders

Installation path

The setup script installs yw2xtg.pyw in the user profile. This is the installation path on Windows:

c:\Users\<user name>\.pywriter\yw2xtg