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.
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.
Alternatively, you can
usage: yw2xtg.pyw [--silent] Sourcefile
Sourcefile
The path of the yWriter project file.
--silent
suppress error messages and the request to confirm the use of default values
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.
Bold and italics are supported. Other highlighting such as underline and strikethrough are lost.
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.
Place a subfolder named yw2xtg in the yWriter project folder. It contains the configuration file and all template files as listed below to be applied to this project. The best way is to copy the provided sample folder and customize the contained files with a text editor according to your needs.
If there is no configuration data in the project file, data stored in c:\Users\<user name>\.pywriter\yw2xtg\config
is used prior to the script’s default configuration data.
If a template file or a configuration entry is missing, yw2xtg uses the lower priority source as a fallback.
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.
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.
There are two options:
$AuthorBio - Information about the author
$FieldTitle4 - Rating names: field 4
$ChapterNumber - Chapter number (in sort order),
$Desc - Chapter description, html-formatted
$SceneNumber - Scene number (in sort order),
$Desc - Scene description, html-formatted
$LettersTotal - Accumulated letter count including the current scene
$SceneContent - Scene content, html-formatted
$Field4 - Scene rating: field 4
$ScDate - Date or day
$LastsMinutes - Amount of time scene lasts: minutes
Duration - Combination of days and hours and minutes
$Image - Image filename
$Items - Comma-separated list of items assigned to the scene
$Notes - Scene notes
The setup script installs yw2xtg.pyw in the user profile. This is the installation path on Windows:
c:\Users\<user name>\.pywriter\yw2xtg