From 4948dd0a7c7d21ce127108bd377295b77a8d37a4 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 18 Sep 2016 12:53:25 +0100 Subject: [PATCH] Rewrite metadata syntax documentation Rewrite it as reStructuredText so that it can be hosted alongside the API documentation on Read The Docs, which allows linking to WIP syntax documentation. --- CONTRIBUTING.md | 2 +- README.md | 2 +- docs/LOOT Metadata Syntax.html | 682 ------------------ docs/api/index.rst | 12 - docs/api/introduction.rst | 3 +- docs/api/miscellaneous.rst | 4 +- docs/{api => }/conf.py | 24 +- docs/index.rst | 23 + docs/metadata/changelog.rst | 50 ++ docs/metadata/conditions.rst | 137 ++++ docs/metadata/data_structures/cleaning.rst | 61 ++ docs/metadata/data_structures/file.rst | 42 ++ docs/metadata/data_structures/index.rst | 16 + .../data_structures/localised_content.rst | 28 + docs/metadata/data_structures/location.rst | 37 + docs/metadata/data_structures/message.rst | 109 +++ docs/metadata/data_structures/plugin.rst | 136 ++++ docs/metadata/data_structures/tag.rst | 37 + docs/metadata/file_structure.rst | 52 ++ docs/metadata/introduction.rst | 24 + scripts/appveyor/deploy_docs.ps1 | 1 - scripts/archive.js | 1 - scripts/installer.iss | 2 - 23 files changed, 769 insertions(+), 716 deletions(-) delete mode 100644 docs/LOOT Metadata Syntax.html delete mode 100644 docs/api/index.rst rename docs/{api => }/conf.py (94%) create mode 100644 docs/index.rst create mode 100644 docs/metadata/changelog.rst create mode 100644 docs/metadata/conditions.rst create mode 100644 docs/metadata/data_structures/cleaning.rst create mode 100644 docs/metadata/data_structures/file.rst create mode 100644 docs/metadata/data_structures/index.rst create mode 100644 docs/metadata/data_structures/localised_content.rst create mode 100644 docs/metadata/data_structures/location.rst create mode 100644 docs/metadata/data_structures/message.rst create mode 100644 docs/metadata/data_structures/plugin.rst create mode 100644 docs/metadata/data_structures/tag.rst create mode 100644 docs/metadata/file_structure.rst create mode 100644 docs/metadata/introduction.rst diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c60187e7..031800b8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,7 @@ If you're adding a new translation, LOOT's source code must be updated to recogn * Add constants for the language in [api.h](include/loot/api.h) and [api.cpp](src/api/api.cpp). * In [archive.js](scripts/archive.js), add the language folder to the list on line 83. * In [installer.iss](scripts/installer.iss), add an entry for your language's translation file to the `[Files]` section. -* In [LOOT Metadata Syntax.html](docs/LOOT%20Metadata%20Syntax.html), add a row for your language to the Language Codes table. +* In [localised_content.rst](docs/metadata/data_structures/localised_content.rst), add a row for your language to the Language Codes table. ## Code Style diff --git a/README.md b/README.md index eebfaec7..dc9fb219 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ python -m pip install breathe sphinx cd docs/api doxygen cd ../.. -sphinx-build -b html docs/api build/documentation/sphinx +sphinx-build -b html docs build/documentation/sphinx ``` ## Packaging Releases diff --git a/docs/LOOT Metadata Syntax.html b/docs/LOOT Metadata Syntax.html deleted file mode 100644 index 275120b6..00000000 --- a/docs/LOOT Metadata Syntax.html +++ /dev/null @@ -1,682 +0,0 @@ - - -LOOT Metadata Syntax - - - -

LOOT Metadata Syntax

- -

Contents

-
    -
  1. Introduction -
  2. Metadata File Contents -
  3. Data Structures -
      -
    1. Tag Data Structure -
    2. File Data Structure -
    3. Message Data Structure -
    4. Location Data Structure -
    5. Cleaning Data Structure -
    6. Plugin Data Structure -
    -
  4. Condition Strings -
      -
    1. Functions -
    2. The Negator & Junctors -
    3. Order Of Evaluation -
    -
  5. Language Codes -
  6. Version History -
  7. License -
- -

Introduction

-

The metadata syntax is what LOOT's masterlists and userlists are written in. If you know YAML, good news: the syntax is essentially just YAML 1.2. If you don't know YAML, then its Wikipedia page is a good introduction. All you really need to know is: -

-

An important point that is more specific to how LOOT uses YAML: -

-

Some properties of file paths as used by LOOT: -

-

In this document, where a value's type is given as X list, this is equivalent to a YAML sequence of values which are of the data type X. Where a value's type is given as X set, this is equivalent to a YAML sequence of unique values which are of the data type X. Uniqueness is determined using the equality criteria for that data type. All the non-standard data types that LOOT's metadata syntax uses have their equality criteria defined later in this document. - -

Metadata File Contents

-

The root of a metadata file is a key-value map. LOOT will recognise the following keys, none of which are required: - - -
Key NameValue TypeNotes -
bash_tagsstring listA list of Bash Tags that are supported by the masterlist's game. These Bash Tags are used to provide autocomplete suggestions in LOOT's metadata editor. -
globalsmessage listA list of message data structures for messages that are displayed independently of any plugin. -
pluginsplugin list and plugin setThe plugin data structures that hold all the plugin metadata within the file. It is a mixture of a list and a set because no non-regex plugin value may be equal to any other non-regex plugin value, but there may be any number of equal regex plugin values, and non-regex plugin values may be equal to regex plugin values. -

If multiple plugin values match a single plugin, their metadata is merged in the order the values are listed, and as defined later in this document. -

-

Other keys may also be present, but are not processed by LOOT. The message and plugin data structures are detailed in the next section. -

An example metadata file: -

bash_tags:
-  - 'C.Climate'
-  - 'Relev'
-globals:
-  - type: say
-    content: 'You are using the latest version of LOOT.'
-    condition: 'version("LOOT", "0.5.0.0", ==)'
-plugins:
-  - name: 'Armamentarium.esm'
-    tag:
-      - Relev
-  - name: 'ArmamentariumFran.esm'
-    tag:
-      - Relev
-  - name: 'Beautiful People 2ch-Ed.esm'
-    tag:
-      - Eyes
-      - Graphics
-      - Hair
-      - R.Relations
-
- - -

Data Structures

-

LOOT expects metadata to be laid out using a certain set of data structures, described in this section. - -

Tag Data Structure

-

LOOT metadata files can contain suggestions for the addition or removal of Bash Tags, and this is the structure used for them. It has two forms: a key-value map and a scalar string. - -

Map Form

-

All values in the map are strings.

- - -
Key NameRequiredNotes -
nameA Bash Tag, preceded by a minus sign if it is suggested for removal. -
conditionA condition string that is evaluated to determine whether this Bash Tag should be suggested: if it evaluates to true, the Tag is suggested, otherwise it is ignored. See Condition Strings for details. -
- -

Scalar Form

-
tag
-

where tag is equivalent to the value of the name key in the map form. - -

Equality

-

Two tag data structures are equal if the lowercased values of their name keys are identical. - -

Examples

-
Relations
-
name: -Relations
-condition: 'file("Mart''s Monster Mod for OOO.esm") or file("FCOM_Convergence.esm")'
-
- -

File Data Structure

-

Not to be confused with the structure of the metadata file itself, this structure can be used to hold file paths. It has two forms: a key-value map and a scalar string. - -

Map Form

-

All values in the map are strings.

- - -
Key NameRequiredNotes -
nameAn exact (ie. not regex) file path or name. -
displayA substitute string to be displayed instead of the file path in any generated messages, eg. the name of the mod the file belongs to. -
conditionA condition string that is evaluated to determine whether this file data should be used: if it evaluates to true, the data is used, otherwise it is ignored. See Condition Strings for details. -
- -

Scalar Form

-
filepath
-

where filepath is equivalent to the value of the name key in the map form. - -

Equality

-

Two file data structures are equal if the lowercased values of their name keys are identical. - -

Examples

-
'../obse_loader.exe'
-
name: '../obse_loader.exe'
-condition: 'version("../obse_loader.exe", "0.0.18.0", >=)'
-display: 'OBSE v18+'
-
- -

Message Data Structure

-

Messages are given as key-value maps. - - -
Key NameValue TypeRequiredNotes -
typestringThe type string can be one of three keywords, see the table below for their semantics. -
contentstring or localised content listEither simply a string, or a list of localised content data structures. If the latter, one of the structures must be for English. -
conditionstringA condition string that is evaluated to determine whether the message should be displayed: if it evaluates to true, the message is displayed, otherwise it is not. See Condition Strings for details. -
subsstring listA list of strings to be substituted into the message content string. The content string must use numbered specifiers (%1%, %2%, etc.), where the numbers correspond to the position of the substitution string in this list to use, to denote where these strings are to be substituted. -
-

LOOT supports formatting of messages using GitHub Flavored Markdown. Support is provided by the Marked library (v0.3). Strings that get substituted into messages, such as file display names and cleaning data utility strings, also support the same formatting options. -

LOOT handles messages and languages as follows: -

    -
  1. If a message's content value is a string, the message will use the string as its content if displayed. -
  2. If a message's content value is a list of localised content structures, then the first structure with a language that matches LOOT's current language will be used as the message's content if displayed. If there are no matches, then the first structure in English will be used. -
- -

Message Types

- - -
KeywordDescription -
sayA generic message, useful for miscellaneous notes. -
warnA warning message, describing a non-critical issue with the user's mods (eg. dirty mods). -
errorAn error message, decribing a critical installation issue (eg. missing masters, corrupt plugins). -
- -

Localised Content Data Structure

-

The localised content data structure is a key-value map, with all values being strings: - - -
Key NameRequiredNotes -
textThe actual message content string. -
langThe language that text is written in, given as a POSIX language code. The languages LOOT supports are given in Language Codes. -
- -

Equality

-

The equality of two message data structures is determined by comparing the values of their content keys. As the values of the keys can be different types, a comparison value is selected for each message using the following logic: -

-

The two message data structures are then equal if their lowercased comparison values are identical. - -

Examples
(translations by Google)

-
type: say
-condition: 'file("foo.esp")'
-content:
-  - lang: en
-    text: 'An example link: <http://www.example.com>'
-  - lang: ru
-    text: 'Это пример ссылки: <http://www.example.com>'
-
-would be displayed as -
-отмечать: Это пример ссылки: http://www.example.com -
-if the current language was Russian and foo.esp was installed, while -
type: say
-content: 'An alternative [example link](http://www.example.com), with no translations.'
-
-would be displayed as -
-отмечать: An alternative example link, with no translations. -
-In English, -
type: say
-content: 'A newer version of %1% [is available](%2%).
-subs:
-  - 'this plugin'
-  - 'http://www.example.com'
-
-would be displayed as -
-Note: A newer version of this plugin is available. -
- - -

Location Data Structure

-

This data structure is used to hold information on where a plugin is hosted online. It has two forms: a key-value map and a scalar string. - -

Map Form

-

All values in the map are strings.

- - -
Key NameRequiredNotes -
linkA URL at which the plugin is found. -
nameA descriptive name for the URL, which may be used as hyperlink text. -
- -

Scalar Form

-
URL
-

where URL is equivalent to the value of the link key in the map form. - -

Equality

-

Two location data structures are equal if the lowercased values of their link keys are identical. - -

Examples

-
'http://skyrim.nexusmods.com/mods/19/'
-
link: 'https://steamcommunity.com/sharedfiles/filedetails/?id=419668499'
-name: 'Unofficial Skyrim Patch on Steam Workshop'
-
- -

Cleaning Data Structure

-

This structure holds information on which versions of a plugin are dirty or clean, and if dirty, how many identical-to-master records, deleted records and deleted navmeshes (if applicable) it contains. Cleaning data is given as a key-value map. - - -
Key NameValue TypeRequiredNotes -
crchexadecimal integerThe CRC-32 checksum of the plugin. If the plugin is dirty, this needs to be the CRC of the plugin before before cleaning. LOOT displays the CRCs of installed plugins in its report. The 8-character CRC should be preceded by 0x so that it is correctly interpreted. -
utilitystringThe utility that was used to check the plugin for dirty edits. If available, the version of the utility used should also be included (e.g. TES5Edit v3.11). -
infostring or localised content listA message that will be displayed to the user. If a localised content list is provided, one of the structures must be for English. This is only used if the plugin is dirty, and is intended for providing cleaning instructions to the user. -
itmintegerThe number of identical-to-master records reported for the dirty plugin. If the number is unknown or zero, this field should not be supplied. -
udrintegerThe number of undeleted records reported for the dirty plugin. If the number is unknown or zero, this field should not be supplied. -
navintegerThe number of deleted navmeshes reported for the dirty plugin. If the number is unknown or zero, this field should not be supplied. -
- -

Equality

-

Two cleaning data structures are equal if the values of their crc keys are identical. - -

Examples

-

A dirty plugin:

-
crc: 0x3DF62ABC
-utility: '[TES5Edit](http://www.nexusmods.com/skyrim/mods/25859) v3.1.1'
-info: 'A cleaning guide is available [here](http://www.creationkit.com/index.php?title=TES5Edit_Cleaning_Guide_-_TES5Edit).'
-itm: 4
-udr: 160
-
-

A clean plugin:

-
crc: 0x2ABC3DF6
-utility: '[TES5Edit](http://www.nexusmods.com/skyrim/mods/25859) v3.1.1'
-
- - -

Plugin Data Structure

-

This is the structure that brings all the others together, and forms the main component of a metadata file. It is a key-value map. - - -
Key NameValue TypeRequiredNotes -
namestringCan be an exact plugin filename or a regular expression plugin filename. If the filename contains any of the characters :\*?|, the string will be treated as a regular expression, otherwise it will be treated as an exact filename. For example, Example\.esm will be treated as a regular expression, as it contains a \ character. -
enabledbooleanEnables or disables use of the plugin object. Used for user rules, but no reason to use it in the masterlist. If unspecified, defaults to true. -
priorityintegerModifies plugin position relative to others that change one or more of the same records, but which are otherwise unrelated (ie. neither plugin lists the other as a master, requirement, or in its after list). Plugins that don't change any of the same records are not compared, unless one of the plugins contains only a header record. - -

A plugin with a higher priority value will load after a plugin with a lower priority value. The value can be anything in the range -127 to 127 inclusive, and if unspecified defaults to 0. -

global_priorityintegerModifies plugin position relative to all unrelated plugins (ie. neither plugin lists the other as a master, requirement, or in its after list). -

A plugin with a higher global_priority value will load after a plugin with a lower priority value. The value can be anything in the range -127 to 127 inclusive, and if unspecified defaults to 0. -

global_priority takes precedence over priority when comparing two plugins' priorities: the priority value is only compared if the two plugins have the same global_priority value. -

afterfile setAn unordered set of plugins that this plugin must load after, but which are not dependencies. Used for resolving specific compatibility issues and by user rules for specifying custom plugin positions. -
reqfile setAn unordered set of files that this plugin requires to be present. This plugin will load after any plugins listed. If any of these files are missing, an error message will be displayed. Intended for use specifying implicit dependencies, as LOOT will detect a plugin's explicit masters itself. -
incfile setAn unordered set of files that this plugin is incompatible with. If any of these files are present, an error message will be displayed. -
msgmessage listThe messages attached to this plugin. The messages will be displayed in the order that they are listed. -
tagtag setAn unordered set of Bash Tags suggested for this plugin. If a Bash Tag is suggested for both addition and removal, the latter will override the former when the list is evaluated. -
urllocation setAn unordered set of locations for this plugin. If the same version can be found at multiple locations, only one location should be recorded. This metadata is not currently used by LOOT. -
dirtycleaning data setAn unordered set of cleaning data structures for this plugin, identifying dirty plugins. Plugin entries with regular expression filenames must not contain cleaning data. -
cleancleaning data setAn unordered set of cleaning data structures for this plugin, identifying clean plugins. Plugin entries with regular expression filenames must not contain cleaning data. The itm, udr and nav fields are unused in this context, as they're assumed to be zero. -
- -

Equality

-

The equality of two plugin data structures is determined by comparing the values of their name keys. -

- -

Merging Behaviour

- - - -
Key NameMerge Behaviour (merging B into A) -
nameNot merged. -
enabledReplaced by B's value. -
priorityReplaced by B's value, unless that value is 0 and it was not explicitly set. -
global_priorityReplaced by B's value, unless that value is 0 and it was not explicitly set. -
afterMerged. If B's file set contains an item that is equal to one already present in A's file set, B's item is discarded. -
reqMerged. If B's file set contains an item that is equal to one already present in A's file set, B's item is discarded. -
incMerged. If B's file set contains an item that is equal to one already present in A's file set, B's item is discarded. -
msgMerged. If B's message list contains an item that is equal to one already present in A's message list, B's item is discarded. -
tagMerged.If B's tag set contains an item that is equal to one already present in A's tag set, B's item is discarded. -
urlMerged. If B's location set contains an item that is equal to one already present in A's location set, B's item is discarded. -
dirtyMerged.If B's dirty data set contain an item that is equal to one already present in A's dirty data set, B's item is discarded. -
cleanMerged.If B's clean data set contain an item that is equal to one already present in A's clean data set, B's item is discarded. -
- -

Examples

-
name: 'Oscuro''s_Oblivion_Overhaul.esm'
-req:
-  - 'Oblivion.esm'  # Don't do this, Oblivion.esm is a master of Oscuro's_Oblivion_Overhaul.esm, so LOOT already knows it's required.
-  - name: 'example.esp'
-    display: '[Example Mod](http://www.example.com)'
-    condition: 'version("Oscuro''s_Oblivion_Overhaul.esm", "15.0", ==)'
-tag:
-  - Actors.Spells
-  - Graphics
-  - Invent
-  - Relations
-  - Scripts
-  - Stats
-  - name: -Relations
-    condition: 'file("Mart''s Monster Mod for OOO.esm") or file("FCOM_Convergence.esm")'
-msg:
-  - type: say
-    content: 'Do not clean. "Dirty" edits are intentional and required for the mod to function.'
-
- -

Condition Strings

-

Condition strings can be used to ensure that data is only acted on by LOOT under certain circumstances. They are very similar to boolean conditional expressions in programming languages such as Python, though more limited. Their EBNF grammar is: -

[ negator ], function, { junctor, [ negator ], function } ;
-

The [ negator ], function grammar is referred to as a condition, and two conditions joined by an operator, ie. condition, operator, condition is referred to as a compound condition. -

LOOT caches the results of condition evaluations, so performance is not really an issue. A regular expression check will still take longer than a file check though, so use the former only when appropriate to do so. - -

Functions

-

There are several conditions that can be tested for using the functions detailed in the table below. - - -
FunctionSyntaxDescription -
Filefile("filepath"), file("regex")Returns true if filepath is installed or a file matching regex is found, false otherwise. The argument is treated as regex if it contains any of the characters :\*?|. -
Plugin Active Statusactive("filepath"), active("regex")Returns true if filepath is an active plugin, or if an active plugin matching regex is found, false otherwise. The argument is treated as regex if it contains any of the characters :\*?|. -
Manymany("regex")Returns true if more than one file matching regex is found, false otherwise. -
Many Plugins Active Statusmany_active("regex")Returns true if more than one active plugin matching regex is found, false otherwise. -
Checksumchecksum("filepath", checksum)Returns true if the calculated CRC-32 checksum of filepath matches checksum, false otherwise. If filepath does not exist, returns false. -
Versionversion("filepath", "version", comparator)Returns true if the boolean expression (actual version of filepath) comparator version holds true, false otherwise. If filepath does not exist or does not have a version number, its version is assumed to be 0. The comparison is not a straightforward per-character comparison, but instead uses the precedence rules defined by Semantic Versioning, extended to allow leading zeroes, an arbitrary number of release version numbers, case-insensitivity and a wider range of separator characters. -
- -

The different types of variable used in the above functions are described in more detail below. - - -
Variable TypeDescription -
filepathA Windows file path, or LOOT, which references the LOOT executable being run. -
regexA regular expression string to match file paths to. -
checksumA string of hexadecimal digits representing an unsigned integer that is the data checksum of a file. LOOT displays the checksums of plugins in its user interface after running. -
versionA string of characters representing the version of a plugin or executable. LOOT displays the versions of plugins in its user interface after running. -
comparatorA comparison operator, ie. one of ==, !=, <, >, <= or >=, meaning "is equal to", "is not equal to", "is less than", "is greater than", "is less than or equal to" and "is greater than or equal to" respectively. -
- -

The Negator & Junctors

-

The negator, or logical negation operator, inverts the value of the function that follows it. Its inclusion is optional, and its syntax is simply: -

not
-

Below is a truth table for the negator. - - -
Value of functionValue of not function -
falsetrue -
truefalse -
- -

There are two supported junctors, the logical conjunction (logical and operator) and the logical disjunction (logical or operator), that operate on the expressions to their left and right. - - -
JunctorSyntaxDescription -
Logical ConjunctionandBoth conditions must evaluate to true for the compound condition to evaluate to true. If not, the compound condition evaluates to false. -
Logical DisjunctionorOne condition or both conditions must evaluate to true for the compound condition to evaluate to true. If neither condition is true, then the compound condition evaluates to false. -
-

The following is a truth table for the junctors: - - -
Value of condition1Value of condition2Value of condition1 and condition2Value of condition1 or condition2 -
truetruetruetrue -
truefalsefalsetrue -
falsetruefalsetrue -
falsefalsefalsefalse -
- -

Order Of Evaluation

-

When a condition string is evaluated, its constituent parts are evaluated according to the standard precedence rules of operator logic, ie. -

    -
  1. Function -
  2. Negator -
  3. Logical and -
  4. Logical or -
-

Below is a table that lists some combinations of conditions, showing for each the order of evaluation by explicit bracketing. To make it easier to read, the negator function pair is shortened to C after the first example. - - -
String StructureEvaluated As -
negator function( negator ( function ) ) -
C and C( C and C ) -
C or C( C or C ) -
C and C and C( ( C and C ) and C ) -
C or C or C( ( C or C ) or C ) -
C and C or C( ( C and C ) or C ) -
C or C and C( C or ( C and C ) ) -
C and C and C and C( ( ( C and C ) and C ) and C ) -
C and C and C or C( ( ( C and C ) and C ) or C ) -
C and C or C and C( ( C and C ) or ( C and C ) ) -
C and C or C or C( ( ( C and C ) or C ) or C) -
C or C or C or C( ( ( C or C ) or C ) or C ) -
C or C or C and C( ( C or C ) or ( C and C ) ) -
C or C and C or C( ( C or ( C and C ) ) or C ) -
C or C and C and C( C or ( ( C and C ) and C ) ) -
-

You can also explicitly enclose any condition in brackets to override the evaluation order, eg. C and ( C or C ) is evaluated as C and ( C or C ), in contrast to the unbracketed string above. - -

Language Codes

-

LOOT supports the following languages and language codes: - - -
LanguagePOSIX Code -
Brazilian Portuguesept_BR -
Chinesezh_CN -
Danishda -
Englishen -
Finnishfi -
Frenchfr -
Germande -
Koreanko -
Polishpl -
Russianru -
Spanishes -
- -

Version History

- -

Each version of LOOT has a corresponding version of the metadata format, and its version history is given below. - -

0.10

- - -

0.8

- - -

0.7

- - -

0.6

-

No changes.

- -

0.5

-

Initial release.

- -

License

-

This document is part of the LOOT documentation.
-Copyright (C) 2012—2016 WrinklyNinja
-See the file LOOT ReadMe.html for copying conditions. diff --git a/docs/api/index.rst b/docs/api/index.rst deleted file mode 100644 index 90066e3d..00000000 --- a/docs/api/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -######## -LOOT API -######## - -.. toctree:: - - introduction - miscellaneous - sorting - reference - history - credits diff --git a/docs/api/introduction.rst b/docs/api/introduction.rst index a175567a..d2088750 100644 --- a/docs/api/introduction.rst +++ b/docs/api/introduction.rst @@ -1,5 +1,6 @@ +************ Introduction -============ +************ LOOT is a utility that helps users avoid serious conflicts between their mods by setting their plugins in an optimal load order. It also provides tens of diff --git a/docs/api/miscellaneous.rst b/docs/api/miscellaneous.rst index 9a8c3c22..b37ec5a9 100644 --- a/docs/api/miscellaneous.rst +++ b/docs/api/miscellaneous.rst @@ -23,7 +23,7 @@ Metadata Files LOOT stores plugin metadata in YAML files. It distinguishes between *masterlist* and *userlist* files: each game has a single masterlist, which is a public, curated metadata store, and each LOOT user has a private userlist, which can -contain metadata added by the user. The two files use the same `syntax`_, but +contain metadata added by the user. The two files use the same syntax, but metadata in the userlist extends or replaces metadata sourced from the masterlist. @@ -38,8 +38,6 @@ loaded metadata. In doing so it discards any metadata with a condition that evaluates to false, but the pre-evaluation metadata is cached internally so that re-evaluation does not require the lists to be reloaded. -.. _syntax: https://loot.github.io/docs/0.9.2/LOOT%20Metadata%20Syntax.html - Caching ======= diff --git a/docs/api/conf.py b/docs/conf.py similarity index 94% rename from docs/api/conf.py rename to docs/conf.py index 33265cc0..12b84155 100644 --- a/docs/api/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# LOOT API documentation build configuration file, created by +# LOOT documentation build configuration file, created by # sphinx-quickstart on Sat Aug 13 21:09:25 2016. # # This file is execfile()d with the current directory set to its @@ -25,11 +25,11 @@ import subprocess, os read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True' if read_the_docs_build: - output_directory = '../../build/documentation' + output_directory = '../build/documentation' if not os.path.exists(output_directory): os.makedirs(output_directory) - subprocess.call('doxygen', shell=True) + subprocess.call('doxygen', shell=True, cwd='./api') # -- General configuration ------------------------------------------------ @@ -62,7 +62,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'LOOT API' +project = u'LOOT' copyright = u'2016, WrinklyNinja' author = u'WrinklyNinja' @@ -147,7 +147,7 @@ html_theme = 'sphinx_rtd_theme' # The name for this set of Sphinx documents. # " v documentation" by default. # -# html_title = u'LOOT API v0.9.2' +# html_title = u'' # A shorter title for the navigation bar. Default is the same as html_title. # @@ -247,7 +247,7 @@ html_static_path = [] # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'LOOTAPIdoc' +htmlhelp_basename = 'LOOTdoc' # -- Options for LaTeX output --------------------------------------------- @@ -273,7 +273,7 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'LOOTAPI.tex', u'LOOT API Documentation', + (master_doc, 'LOOT.tex', u'LOOT Documentation', u'WrinklyNinja', 'manual'), ] @@ -315,7 +315,7 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'lootapi', u'LOOT API Documentation', + (master_doc, 'loot', u'LOOT Documentation', [author], 1) ] @@ -330,8 +330,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'LOOTAPI', u'LOOT API Documentation', - author, 'LOOTAPI', 'One line description of project.', + (master_doc, 'LOOT', u'LOOT Documentation', + author, 'LOOT', 'One line description of project.', 'Miscellaneous'), ] @@ -353,7 +353,7 @@ texinfo_documents = [ breathe_projects = { -"loot_api":"../../build/documentation/xml/", +"loot":"../build/documentation/xml/", } -breathe_default_project = 'loot_api' +breathe_default_project = 'loot' diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..9ac17f7d --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,23 @@ +#### +LOOT +#### + +.. toctree:: + :caption: API Documentation + + api/introduction + api/miscellaneous + api/sorting + api/reference + api/history + api/credits + +.. toctree:: + :maxdepth: 2 + :caption: Metadata Syntax Documentation + + metadata/introduction + metadata/file_structure + metadata/data_structures/index + metadata/conditions + metadata/changelog diff --git a/docs/metadata/changelog.rst b/docs/metadata/changelog.rst new file mode 100644 index 00000000..fd715817 --- /dev/null +++ b/docs/metadata/changelog.rst @@ -0,0 +1,50 @@ +*************** +Version History +*************** + +Each version of LOOT has a corresponding version of the metadata format, and its version history is given below. + +0.10 (Unreleased) +----------------- + +* Added the ``clean`` key to the plugin data structure. +* Added the ``global_priority`` field to the plugin data structure. +* Renamed the ``str`` key in the message content data structure to ``text`` . +* Changed the ``priority`` field of the plugin data structure to store values between -127 and 127 inclusive. +* Changed regular expressions to no longer accept ``\`` as a directory expression: ``/`` must now be used. +* Added the ``many_active()`` condition function. +* Removed the ``regex()`` condition function and added regular expression support to the ``file()`` condition function. +* Changed the ``active()`` condition function to also accept a regular expression. +* Renamed the dirty info data structure to the cleaning data structure. +* Renamed the ``util`` key in the cleaning data structure to ``utility`` . +* Added the ``info`` key to the cleaning data structure. + +0.8 +--- + + +* Removed support for the ``ver`` key in location data structures. +* Added support for the ``name`` key in location data structures. +* Added support for the ``many("regex")`` condition function. +* Changed detection of regular expression plugin entries. Previously, a plugin entry was treated as having a regular expression filename if the filename ended with ``\.esp`` or ``\.esp`` . Now, a plugin entry is treated as having a regular expression filename if the filename contains one or more of ``:\*?|`` . +* The plugin data structure definition in this document was fixed so that it correctly gives the values of the ``after`` , ``req`` , ``inc`` , ``tag`` , ``url`` and ``dirty`` keys as sets, not lists. +* This document now defines the equality criteria for all of the metadata syntax's non-standard data structures. +* The algorithm used for version comparison has been changed to give better results for a wider variety of version strings. + +0.7 +--- + + +* Changed support for Markdown formatting in messages. Previously, only URL hyperlinking was supported, and only for ``file:`` , ``http:`` and ``https:`` URLs using the ``[label](url)`` or ```` syntaxes. Now, the `Marked `_ library (v0.3) is used to provide support for most of GitHub Flavored Markdown, minus the GitHub-specific features (like @mentions, issue/repo linking and emoji). +* Added support for message string substitution keys, i.e. ``sub`` , in message data structures. +* Added support for YAML merge keys, i.e. ``<<`` . + +0.6 +--- + +*No changes.* + +0.5 +--- + +*Initial release.* diff --git a/docs/metadata/conditions.rst b/docs/metadata/conditions.rst new file mode 100644 index 00000000..83e591ed --- /dev/null +++ b/docs/metadata/conditions.rst @@ -0,0 +1,137 @@ +***************** +Condition Strings +***************** + +Condition strings can be used to ensure that data is only acted on by LOOT under certain circumstances. They are very similar to boolean conditional expressions in programming languages such as Python, though more limited. + +Omitting optional parentheses (see below), their `EBNF`_ grammar is: + +.. productionlist:: + compound_condition: condition, { ( logical_and | logical_or ), condition } + condition: [ logical_not ], function + logical_and: "and" + logical_or: "or" + logical_not: "not" + +.. _EBNF: https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form + +Types +===== + +.. describe:: file_path + + A double-quoted file path, or ``"LOOT"``, which references the LOOT executable being run. + +.. describe:: regular_expression + + A double-quoted regular expression string to match file paths to. + +.. describe:: checksum + + A string of hexadecimal digits representing an unsigned integer that is the data checksum of a file. LOOT displays the checksums of plugins in its user interface after running. + +.. describe:: version + + A double-quoted string of characters representing the version of a plugin or executable. LOOT displays the versions of plugins in its user interface after running. + +.. describe:: comparison_operator + + One of the following comparison operators. + + .. describe:: == + + Is equal to + + .. describe:: != + + Is not equal to + + .. describe:: < + + Is less than + + .. describe:: > + + Is greater than + + .. describe:: <= + + Is less than or equal to + + .. describe:: >= + + Is greater than or equal to + +Functions +========= + +There are several conditions that can be tested for using the functions detailed below. All functions return a boolean. For functions that take a path or regex, the argument is treated as regex if it contains any of the characters ``:\*?|``. + +.. describe:: file(file_path path) + + Returns true if ``path`` is installed, and false otherwise. + +.. describe:: file(regular_expression regex) + + Returns true if a file matching ``regex`` is found, and false otherwise. + +.. describe:: active(file_path path) + + Returns true if ``path`` is an active plugin, and false otherwise. + +.. describe:: active(regular_expression regex) + + Returns true if an active plugin matching ``regex`` is found, and false otherwise. + +.. describe:: many(regular_expression regex) + + Returns true if more than one file matching ``regex`` is found, and false otherwise. + +.. describe:: many_active(regular_expression regex) + + Returns true if more than one active plugin matching ``regex`` is found, and false otherwise. + +.. describe:: checksum(file_path path, checksum expected_checksum) + + Returns true if the calculated CRC-32 checksum of ``path`` matches ``expected_checksum``, and false otherwise. Returns false if ``path`` does not exist. + +.. describe:: version(file_path path, version given_version, comparison_operator comparator) + + Returns true if the boolean expression:: + + actual_version comparator given_version + + (where ``actual version`` is the version read from ``path``) holds true, and false otherwise. If ``path`` does not exist or does not have a version number, its version is assumed to be ``0``. + + The comparison uses the precedence rules defined by `Semantic Versioning `_, extended to allow leading zeroes, an arbitrary number of release version numbers, case-insensitivity and a wider range of separator characters. + +Logical Operators +================= + +The ``and``, ``or`` and ``not`` operators have their usual definitions, except that the ``not`` operator only ever operates on the result of the function immediately following it. + +Order of Evaluation +------------------- + +Condition strings are evaluated according to the usual C-style operator precedence rules, and parentheses can be used to override these rules. For example:: + + function and function or not function + +is evaluated as:: + + ( function and function ) or ( not function ) + +but:: + + function and ( function or not function ) + +is evaluated as:: + + function and ( function or ( not function ) ) + +Parentheses cannot be used between a ``not`` operator and the function following it. + +Performance +=========== + +LOOT caches the results of condition evaluations. A regular expression check will still take longer than a file check though, so use the former only when appropriate to do so. diff --git a/docs/metadata/data_structures/cleaning.rst b/docs/metadata/data_structures/cleaning.rst new file mode 100644 index 00000000..f8dc5ed4 --- /dev/null +++ b/docs/metadata/data_structures/cleaning.rst @@ -0,0 +1,61 @@ +Cleaning Data +============= + +This structure holds information on which versions of a plugin are dirty or clean, and if dirty, how many identical-to-master records, deleted records and deleted navmeshes (if applicable) it contains. Cleaning data is given as a key-value map. + +.. describe:: crc + + ``hexadecimal integer`` + + **Required.** The CRC-32 checksum of the plugin. If the plugin is dirty, this needs to be the CRC of the plugin before before cleaning. LOOT displays the CRCs of installed plugins in its report. The 8-character CRC should be preceded by ``0x`` so that it is interpreted correctly. + +.. describe:: utility + + ``string`` + + **Required.** The utility that was used to check the plugin for dirty edits. If available, the version of the utility used should also be included (e.g. ``TES5Edit v3.11``). + +.. describe:: info + + ``string`` or ``localised content list`` + + A message that will be displayed to the user. If a localised content list is provided, one of the structures must be for English. This is only used if the plugin is dirty, and is intended for providing cleaning instructions to the user. If undefined, defaults to an empty string. + +.. describe:: itm + + ``integer`` + + The number of identical-to-master records reported for the dirty plugin. If undefined, defaults to zero. + +.. describe:: udr + + ``integer`` + + The number of undeleted records reported for the dirty plugin. If undefined, defaults to zero. + +.. describe:: nav + + ``integer`` + + The number of deleted navmeshes reported for the dirty plugin. If undefined, defaults to zero. + +Equality +-------- + +Two cleaning data structures are equal if the values of their ``crc`` keys are identical. + +Examples +-------- + +A dirty plugin:: + + crc: 0x3DF62ABC + utility: '[TES5Edit](http://www.nexusmods.com/skyrim/mods/25859) v3.1.1' + info: 'A cleaning guide is available [here](http://www.creationkit.com/index.php?title=TES5Edit_Cleaning_Guide_-_TES5Edit).' + itm: 4 + udr: 160 + +A clean plugin:: + + crc: 0x2ABC3DF6 + utility: '[TES5Edit](http://www.nexusmods.com/skyrim/mods/25859) v3.1.1' diff --git a/docs/metadata/data_structures/file.rst b/docs/metadata/data_structures/file.rst new file mode 100644 index 00000000..49a15cad --- /dev/null +++ b/docs/metadata/data_structures/file.rst @@ -0,0 +1,42 @@ +File +==== + +This structure can be used to hold file paths. It has two forms: a key-value string map and a scalar string. + +Map Form +-------- + +.. describe:: name + + **Required.** An exact (ie. not regex) file path or name. + +.. describe:: display + + A substitute string to be displayed instead of the file path in any generated messages, eg. the name of the mod the file belongs to. If undefined, the ``name`` key's value is used. + +.. describe:: condition + + A condition string that is evaluated to determine whether this file data should be used: if it evaluates to true, the data is used, otherwise it is ignored. See :doc:`../conditions` for details. + +Scalar Form +----------- + +The scalar form is simply the value of the map form's ``name`` key. Using the scalar form is equivalent to using the map form with undefined ``display`` and ``condition`` keys. + +Equality +-------- + +Two file data structures are equal if the lowercased values of their ``name`` keys are identical. + +Examples +-------- + +Scalar form:: + + '../obse_loader.exe' + +Map form:: + + name: '../obse_loader.exe' + condition: 'version("../obse_loader.exe", "0.0.18.0", >=)' + display: 'OBSE v18+' diff --git a/docs/metadata/data_structures/index.rst b/docs/metadata/data_structures/index.rst new file mode 100644 index 00000000..3c15a97d --- /dev/null +++ b/docs/metadata/data_structures/index.rst @@ -0,0 +1,16 @@ +*************** +Data Structures +*************** + +LOOT expects metadata to be laid out using a certain set of data structures, described in this section. + +.. toctree:: + :maxdepth: 1 + + tag + file + localised_content + message + location + cleaning + plugin diff --git a/docs/metadata/data_structures/localised_content.rst b/docs/metadata/data_structures/localised_content.rst new file mode 100644 index 00000000..c00b909c --- /dev/null +++ b/docs/metadata/data_structures/localised_content.rst @@ -0,0 +1,28 @@ +Localised Content +================= + +The localised content data structure is a key-value string map. + +.. describe:: text + + **Required.** The actual message content string. + +.. describe:: lang + + **Required.** The language that ``text`` is written in, given as a POSIX language code. LOOT supports the following languages and language codes: + + ==================== ========== + Language POSIX Code + ==================== ========== + Brazilian Portuguese pt_BR + Chinese zh_CN + Danish da + English en + Finnish fi + French fr + German de + Korean ko + Polish pl + Russian ru + Spanish es + ==================== ========== diff --git a/docs/metadata/data_structures/location.rst b/docs/metadata/data_structures/location.rst new file mode 100644 index 00000000..97b66065 --- /dev/null +++ b/docs/metadata/data_structures/location.rst @@ -0,0 +1,37 @@ +Location +======== + +This data structure is used to hold information on where a plugin is hosted online. It has two forms: a key-value string map and a scalar string. + +Map Form +-------- + +.. describe:: link + + **Required.** A URL at which the plugin is found. + +.. describe:: name + + A descriptive name for the URL, which may be used as hyperlink text. If undefined, defaults to an empty string. + +Scalar Form +----------- + +The scalar form is simply the value of the map form's ``link`` key. Using the scalar form is equivalent to using the map form with an undefined ``name`` key. + +Equality +-------- + +Two location data structures are equal if the lowercased values of their ``link`` keys are identical. + +Examples +-------- + +Scalar form:: + + 'http://skyrim.nexusmods.com/mods/19/' + +Map form:: + + link: 'https://steamcommunity.com/sharedfiles/filedetails/?id=419668499' + name: 'Unofficial Skyrim Patch on Steam Workshop' diff --git a/docs/metadata/data_structures/message.rst b/docs/metadata/data_structures/message.rst new file mode 100644 index 00000000..3a9e6a36 --- /dev/null +++ b/docs/metadata/data_structures/message.rst @@ -0,0 +1,109 @@ +Message +======= + +Messages are given as key-value maps. + +.. describe:: type + + ``string`` + + **Required.** The type string can be one of three keywords. + + .. describe:: say + + A generic message, useful for miscellaneous notes. + + .. describe:: warn + + A warning message, describing a non-critical issue with the user's mods (eg. dirty mods). + + .. describe:: error + + An error message, decribing a critical installation issue (eg. missing masters, corrupt plugins). + +.. describe:: content + + ``string`` or ``localised content list`` + + **Required.** Either simply a string, or a list of localised content data structures. If the latter, one of the structures must be for English. + +.. describe:: condition + + ``string`` + + A condition string that is evaluated to determine whether the message should be displayed: if it evaluates to true, the message is displayed, otherwise it is not. See :doc:`../conditions` for details. + +.. describe:: subs + + ``string list`` + + A list of strings to be substituted into the message content string. The content string must use numbered specifiers (``%1%``, ``%2%``, etc.), where the numbers correspond to the position of the substitution string in this list to use, to denote where these strings are to be substituted. + +Message Formatting +------------------ + +LOOT supports formatting of messages using `GitHub Flavored Markdown`_. Support is provided by the `Marked`_ library (v0.3). Strings that get substituted into messages, such as file display names and cleaning data utility strings, also support the same formatting options. + +.. _GitHub Flavored Markdown: https://help.github.com/articles/github-flavored-markdown +.. _Marked: https://github.com/chjj/marked + +.. _languages: + +Language Support +---------------- + +If a message's ``content`` value is a string, the message will use the string as its content if displayed. Otherwise, the first localised content structure with a language that matches LOOT's current language will be used as the message's content if displayed. If there are no matches, then the first structure in English will be used. + +Equality +-------- + +The equality of two message data structures is determined by comparing the values of their ``content`` keys. As the values of the keys can be different types, a comparison value is selected for each message using the following logic: + +* If a value's type is a localised content list, then the English content string in that list is selected as the comparison value. +* If a value's type is a string, then that string is selected as the comparison value. + +The two message data structures are then equal if their lowercased comparison values are identical. + +Examples +-------- + +*Translations by Google* + +.. code-block:: yaml + + type: say + condition: 'file("foo.esp")' + content: + - lang: en + text: 'An example link: ' + - lang: ru + text: 'Это пример ссылки: ' + +would be displayed as + + отмечать: Это пример ссылки: http://www.example.com + +if the current language was Russian and ``foo.esp`` was installed, while + +.. code-block:: yaml + + type: say + content: 'An alternative [example link](http://www.example.com), with no translations.' + +would be displayed as + + отмечать: An alternative `example link `_, with no translations. + +In English, + +.. code-block:: yaml + + type: say + content: 'A newer version of %1% [is available](%2%).' + subs: + - 'this plugin' + - 'http://www.example.com' + +would be displayed as + + Note: A newer version of this plugin `is available `_. diff --git a/docs/metadata/data_structures/plugin.rst b/docs/metadata/data_structures/plugin.rst new file mode 100644 index 00000000..8dfb3486 --- /dev/null +++ b/docs/metadata/data_structures/plugin.rst @@ -0,0 +1,136 @@ +Plugin +====== + +This is the structure that brings all the others together, and forms the main component of a metadata file. It is a key-value map. + +.. describe:: name + + ``string`` + + **Required.** Can be an exact plugin filename or a regular expression plugin filename. If the filename contains any of the characters ``:\*?|``, the string will be treated as a regular expression, otherwise it will be treated as an exact filename. For example, ``Example\.esm`` will be treated as a regular expression, as it contains a ``\`` character. + +.. describe:: enabled + + ``boolean`` + + Enables or disables use of the plugin object. Used for user rules, but no reason to use it in the masterlist. If unspecified, defaults to ``true``. + +.. describe:: priority + + ``integer`` + + Modifies plugin position relative to others that change one or more of the same records, but which are otherwise unrelated (ie. neither plugin lists the other as a master, requirement, or in its ``after`` list). Plugins that don't change any of the same records are not compared, unless one of the plugins contains only a header record. + + A plugin with a higher ``priority`` value will load after a plugin with a lower ``priority`` value. The value can be anything in the range ``-127`` to ``127`` inclusive, and if unspecified defaults to ``0``. + +.. describe:: global_priority + + ``integer`` + + Modifies plugin position relative to all unrelated plugins (ie. neither plugin lists the other as a master, requirement, or in its ``after`` list). + + A plugin with a higher ``global_priority`` value will load after a plugin with a lower priority value. The value can be anything in the range ``-127`` to ``127`` inclusive, and if unspecified defaults to ``0``. + + ``global_priority`` takes precedence over ``priority`` when comparing two plugins' priorities: the ``priority`` value is only compared if the two plugins have the same ``global_priority`` value. + +.. describe:: after + + ``file set`` + + Plugins that this plugin must load after, but which are not dependencies. Used to resolve specific compatibility issues. If undefined, the set is empty. + +.. describe:: req + + ``file set`` + + Files that this plugin requires to be present. This plugin will load after any plugins listed. If any of these files are missing, an error message will be displayed. Intended for use specifying implicit dependencies, as LOOT will detect a plugin's explicit masters itself. If undefined, the set is empty. + +.. describe:: inc + + ``file set`` + + Files that this plugin is incompatible with. If any of these files are present, an error message will be displayed. If undefined, the set is empty. + +.. describe:: msg + + ``message list`` + + The messages attached to this plugin. The messages will be displayed in the order that they are listed. If undefined, the list is empty. + +.. describe:: tag + + ``tag set`` + + Bash Tags suggested for this plugin. If a Bash Tag is suggested for both addition and removal, the latter will override the former when the list is evaluated. If undefined, the set is empty. + +.. describe:: url + + ``location set`` + + An unordered set of locations for this plugin. If the same version can be found at multiple locations, only one location should be recorded. If undefined, the set is empty. This metadata is not currently used by LOOT. + +.. describe:: dirty + + ``cleaning data set`` + + Cleaning data for this plugin, identifying dirty plugins. Plugin entries with regular expression filenames **must not** contain cleaning data. + +.. describe:: clean + + ``cleaning data set`` + + An unordered set of cleaning data structures for this plugin, identifying clean plugins. Plugin entries with regular expression filenames **must not** contain cleaning data. The ``itm``, ```udr`` and ``nav`` fields are unused in this context, as they're assumed to be zero. + +Equality +-------- + +The equality of two plugin data structures is determined by comparing the values of their ``name`` keys. + +* If neither or both values are regular expressions, then the plugin data structures are equal if the lowercased values are identical. +* If one value is a regular expression, then the plugin data structures are equal if the other value is an exact match for it. + +.. _plugin-merging: + +Merging Behaviour +----------------- + +=============== ================================== +Key Merge Behaviour (merging B into A) +=============== ================================== +name Not merged. +enabled Replaced by B's value. +priority Replaced by B's value, unless that value is ``0`` and it was not explicitly set. +global_priority Replaced by B's value, unless that value is ``0`` and it was not explicitly set. +after Merged. If B's file set contains an item that is equal to one already present in A's file set, B's item is discarded. +req Merged. If B's file set contains an item that is equal to one already present in A's file set, B's item is discarded. +inc Merged. If B's file set contains an item that is equal to one already present in A's file set, B's item is discarded. +msg Merged. If B's message list contains an item that is equal to one already present in A's message list, B's item is discarded. +tag Merged.If B's tag set contains an item that is equal to one already present in A's tag set, B's item is discarded. +url Merged. If B's location set contains an item that is equal to one already present in A's location set, B's item is discarded. +dirty Merged.If B's dirty data set contain an item that is equal to one already present in A's dirty data set, B's item is discarded. +clean Merged. If B's clean data set contain an item that is equal to one already present in A's clean data set, B's item is discarded. +=============== ================================== + +Examples +-------- + +.. code-block:: yaml + + name: 'Oscuro''s_Oblivion_Overhaul.esm' + req: + - 'Oblivion.esm' # Don't do this, Oblivion.esm is a master of Oscuro's_Oblivion_Overhaul.esm, so LOOT already knows it's required. + - name: 'example.esp' + display: '[Example Mod](http://www.example.com)' + condition: 'version("Oscuro''s_Oblivion_Overhaul.esm", "15.0", ==)' + tag: + - Actors.Spells + - Graphics + - Invent + - Relations + - Scripts + - Stats + - name: -Relations + condition: 'file("Mart''s Monster Mod for OOO.esm") or file("FCOM_Convergence.esm")' + msg: + - type: say + content: 'Do not clean. "Dirty" edits are intentional and required for the mod to function.' diff --git a/docs/metadata/data_structures/tag.rst b/docs/metadata/data_structures/tag.rst new file mode 100644 index 00000000..56d69896 --- /dev/null +++ b/docs/metadata/data_structures/tag.rst @@ -0,0 +1,37 @@ +Tag +=== + +LOOT metadata files can contain suggestions for the addition or removal of Bash Tags, and this is the structure used for them. It has two forms: a key-value string map and a scalar string. + +Map Form +-------- + +.. describe:: name + + **Required.** A Bash Tag, prefixed with a minus sign if it is suggested for removal. + +.. describe:: condition + + A condition string that is evaluated to determine whether this Bash Tag should be suggested: if it evaluates to true, the Tag is suggested, otherwise it is ignored. See :doc:`../conditions` for details. If undefined, defaults to an empty string. + +Scalar Form +----------- + +The scalar form is simply the value of the map form's ``name`` key. Using the scalar form is equivalent to using the map form with an undefined ``condition`` key. + +Equality +-------- + +Two tag data structures are equal if the lowercased values of their ``name`` keys are identical. + +Examples +-------- + +Scalar form:: + + Relations + +Map form:: + + name: -Relations + condition: 'file("Mart''s Monster Mod for OOO.esm") or file("FCOM_Convergence.esm")' diff --git a/docs/metadata/file_structure.rst b/docs/metadata/file_structure.rst new file mode 100644 index 00000000..cf495d3e --- /dev/null +++ b/docs/metadata/file_structure.rst @@ -0,0 +1,52 @@ +*********************** +Metadata File Structure +*********************** + +The root of a metadata file is a key-value map. LOOT will recognise the following keys, none of which are required. Other keys may also be present, but are not processed by LOOT. + +.. describe:: bash_tags + + string list + + A list of Bash Tags that are supported by the masterlist's game. These Bash Tags are used to provide autocomplete suggestions in LOOT's metadata editor. + + +.. describe:: globals + + message list + + A list of message data structures for messages that are displayed independently of any plugin. + +.. describe:: plugins + + plugin list *and* plugin set + + The plugin data structures that hold all the plugin metadata within the file. It is a mixture of a list and a set because **no non-regex plugin value may be equal to any other non-regex plugin value** , but there may be any number of equal regex plugin values, and non-regex plugin values may be equal to regex plugin values.If multiple plugin values match a single plugin, their metadata is merged in the order the values are listed, and as defined in :ref:`plugin-merging`. + +The message and plugin data structures are detailed in the next section. + +Example +======= + +.. code-block:: yaml + + bash_tags: + - 'C.Climate' + - 'Relev' + globals: + - type: say + content: 'You are using the latest version of LOOT.' + condition: 'version("LOOT", "0.5.0.0", ==)' + plugins: + - name: 'Armamentarium.esm' + tag: + - Relev + - name: 'ArmamentariumFran.esm' + tag: + - Relev + - name: 'Beautiful People 2ch-Ed.esm' + tag: + - Eyes + - Graphics + - Hair + - R.Relations diff --git a/docs/metadata/introduction.rst b/docs/metadata/introduction.rst new file mode 100644 index 00000000..92016f44 --- /dev/null +++ b/docs/metadata/introduction.rst @@ -0,0 +1,24 @@ +************ +Introduction +************ + +The metadata syntax is what LOOT's masterlists and userlists are written in. If you know YAML, good news: the syntax is essentially just YAML 1.2. If you don't know YAML, then its `Wikipedia page `_ is a good introduction. All you really need to know is: + +* How lists and associative arrays (key-value maps) are written. +* That whitespace is important, and that only normal spaces (ie. no non-breaking spaces or tabs) count as such. +* That data entries that are siblings must be indented by the same amount, and child data nodes must be indented further than their parents (see the example later in this document if you don't understand). +* That YAML files must be written in a Unicode encoding. +* That each key in a key-value map must only appear once per map object. + +An important point that is more specific to how LOOT uses YAML: + +* Strings are case-sensitive, apart from file paths, regular expressions and checksums. + +Some properties of file paths as used by LOOT: + +* They are evaluated as paths relative to the game's Data folder. +* They cannot reference a path outside of the game's folder structure, ie. they cannot contain the substring ``../../``. +* Regular expression file paths must be written in the `EMCAScript `_ syntax, and they must use ``/`` for directory separators. +* Only the filename of a regex file path may contain non-literal regex syntax, ie. if the filename part of the regex file path is removed, the remainder must be an exact folder path (though with the regex syntax special characters escaped). For example, given the regex file path ``Meshes/Resources(1|2)/(upperclass)?table.nif``, LOOT will look for a file named ``table.nif`` or ``upperclasstable.nif`` in the ``Meshes\Resources(1|2)`` folder, rather than looking in the ``Meshes\Resources1`` and ``Meshes\Resources2`` folders. + +In this document, where a value's type is given as ``X list`` this is equivalent to a YAML sequence of values which are of the data type ``X``. Where a value's type is given as ``X set``, this is equivalent to a YAML sequence of **unique** values which are of the data type ``X``. Uniqueness is determined using the equality criteria for that data type. All the non-standard data types that LOOT's metadata syntax uses have their equality criteria defined later in this document. diff --git a/scripts/appveyor/deploy_docs.ps1 b/scripts/appveyor/deploy_docs.ps1 index 8346cf3e..c2faeb41 100644 --- a/scripts/appveyor/deploy_docs.ps1 +++ b/scripts/appveyor/deploy_docs.ps1 @@ -13,7 +13,6 @@ $replaceSelect = '$1' + "`n" + '