SokRFI - Export Levels to Internet

From Sokoban Wiki

Jump to: navigation, search

Contents

SokRFI - Export Levels to Internet

This is a not yet finished draft for a template-based Sokoban level-export to html/xml format. Feel free to improve it and to elaborate on what is still missing.

An export feature is preferably based on templates with a clean separation of the Sokoban side and the html/xml side. The template writer handles all the formatting with normal html/xml code, and the generator plots in the Sokoban information at well-defined positions in the text.

Template Structure

The structure of the template is:


<#sokDocument>

  <#level>

    <#board {parameters}>

      <#row>

        <#col>

        </#col>

      </#row>

    </#board>

    <#game {parameters}>

    </#game>

  </#level>

</#sokDocument>

A template may contain multiple instances of each of the depicted Sokoban related tag-pairs, in which case the generator fills in each section accordingly.

With the exception of the Sokoban keywords listed below, the contents of the rest of the template is entirely up to the template writer. In particular, the writer is responsible for, and therefore also has the freedom to choose, the "skin" for the visual presentation of the level boards.

Board Tag Parameters

Game Tag Parameters

Sokoban Keywords

The keywords may be inserted anywhere in the template. However, each keyword is typically only meaningful in a specific section of the text. For instance, the cell content keyword "#level.board.cell.asText" is only meaningful when it is enclosed by row-tags and column-tags.

Wrongly placed keywords does not prevent the generator from processing the template, but the keywords show up in the output as normal text, thereby helping the template writer to see that something is wrong.

#collection.fileName

#collection.levels.count

#collection.notes

#collection.notes.<key> where "key" refers to any key/value pair found in the notes.

#level.name

#level.number

#level.notes

#level.notes.<key> where "key" refers to any key/value pair found in the notes.

#level.board.asText

#level.board.cell.asShortText = empty, floor, goal, player, playerOnGoal, box, boxOnGoal, wall.

#level.board.cell.asLongText = empty, floor, goal, player, playerOnGoal, box, boxOnGoal, wall_N_W.
"N" is the set of neighbouring walls, listed as U, D, L, R in that order.
An isolated wall without neighbours is depicted by the word "none".
"W" is the wall top quadrant required to cover the cell. 
The possible values are: none, topLeft, topRight, bottomLeft, bottomRight.
An example: The textual representation of an isolated wall without any
neighbouring walls is "wall_none_none". The rationale for not removing
the "fat" is that it makes it easier to postprocess the generated text
when it adheres to a strict syntax without special cases.

#level.games.count

#game.name

#game.number

#game.notes

#game.notes.<key> where "key" refers to a key/value pair found in the notes.

#game.metrics.moves
#game.metrics.pushes
#game.metrics.boxLines
#game.metrics.boxChanges
#game.metrics.pushingSessions

#game.moves.asText

Personal tools