Difference between revisions of "DiffWML"

From The Battle for Wesnoth Wiki
(Add note about the =x convention for deleted keys)
m (wikify)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The DiffWML is a special WML format used to describe changes to a WML config.
+
The DiffWML is a special [[WML]] format used to describe changes to a WML config.
  
 
A diff consists of the following keys and tags:
 
A diff consists of the following keys and tags:
Line 7: Line 7:
 
* '''[change_child]''': Indicates a change to an existing subtag.
 
* '''[change_child]''': Indicates a change to an existing subtag.
 
** '''index''': Specifies the index of the tag that changed. The index is 0-based and counts through all tags, not just those of the same name.
 
** '''index''': Specifies the index of the tag that changed. The index is 0-based and counts through all tags, not just those of the same name.
** '''DiffWML''' keys and tags
+
** All subtags take '''DiffWML''' keys and tags
 
* '''[insert_child]''': Indicates the insertion of one or more new tags in the config.
 
* '''[insert_child]''': Indicates the insertion of one or more new tags in the config.
 
** '''index''': Specifies the index of the tag before which these new tags were inserted. The index is 0-based and counts through all tags, not just those of the same name.
 
** '''index''': Specifies the index of the tag before which these new tags were inserted. The index is 0-based and counts through all tags, not just those of the same name.

Latest revision as of 03:53, 8 May 2023

The DiffWML is a special WML format used to describe changes to a WML config.

A diff consists of the following keys and tags:

  • [insert]: Contains keys that were added to the config, or that changed value.
  • [delete]: Contains keys that were removed from the config. The value is ignored, but is conventionally set to "x".
  • [change_child]: Indicates a change to an existing subtag.
    • index: Specifies the index of the tag that changed. The index is 0-based and counts through all tags, not just those of the same name.
    • All subtags take DiffWML keys and tags
  • [insert_child]: Indicates the insertion of one or more new tags in the config.
    • index: Specifies the index of the tag before which these new tags were inserted. The index is 0-based and counts through all tags, not just those of the same name.
    • All other subtags are the actual tags that were inserted into the config at this position.
  • [delete_child]: Indicates the deletion of one or more tags from the config.
    • index: The index of the tag to delete. The index is 0-based and counts through all tags, not just those of the same name.
    • An empty tag with the same name as each of the deleted tags to remove from that location.

Diffs generated by Wesnoth only use a single tag in each [insert_child], [delete_child], and [change_child]. However, multiple children will be handled when applying a diff to a config.

This page was last edited on 8 May 2023, at 03:53.