FAForever / fa

Lua code for FAF
221 stars 228 forks source link

Convert a markdown-based changelog file into a Lua-based changelog file #6237

Open Garanas opened 3 weeks ago

Garanas commented 3 weeks ago

Description

Part of https://github.com/FAForever/fa/issues/6236

Create a script, program or some other tool that we can retrieve in a Github Action to convert a markdown file that represents a changelog into a Lua-based template that has the changelog content in it.

As an example, the input could be:

# Game version 3769 (24th of September, 2023)

Please refer to the notes of versions 3765, 3766, 3767 and 3768 for the full patch notes.

With gratitude to all those who took the time to report issues,

Jip

## Bug fixes

- (#5454) Fix a bug that can enable the Seraphim MML to launch an endless barrage of missiles.
- (#5454) Fix a bug where the command queue is stuck on a launch order.

This specifically occurred with the tech 3 strategic submarines and the tech 3 Seraphim battleship. As a result, the unit would be 'stuck' on the launch order, and any other order issued after the launch order would never be executed.

- (#5454) Fix a bug where distributed launch orders would not actually launch a missile.

This occurs when you issue launch orders and then distribute them. The new, distributed orders are processed and removed from the queue even though no missiles have been launched.

## Contributors

With thanks to the following individuals who contributed through coding:

- Jip

And the output would be:

{
    version = 3769, -- based on the file name
    description = { -- based on the content of the file
        "# Game version 3769 (24th of September, 2023)",
        "",
        "Please refer to the notes of versions 3765, 3766, 3767 and 3768 for the full patch notes.",
        "",
        "With gratitude to all those who took the time to report issues,",
        "",
        "Jip",
        "",
        "## Bug fixes",
        "",
        "- (#5454) Fix a bug that can enable the Seraphim MML to launch an endless barrage of missiles.",
        "- (#5454) Fix a bug where the command queue is stuck on a launch order.",
        "",
        "This specifically occurred with the tech 3 strategic submarines and the tech 3 Seraphim battleship. As a result, the unit would be 'stuck' on the ",
        "launch order, and any other order issued after the launch order would never be executed.",
        "",
        "- (#5454) Fix a bug where distributed launch orders would not actually launch a missile.",
        "",
        "This occurs when you issue launch orders and then distribute them. The new, distributed orders are processed and removed from the queue even though ",
        "no missiles have been launched.",
        "",
        "- (#5470) Fix a bug that cause gunships to have a tough time to hit certain units.",
        "",
        "When a projectile experiences multiple collisions in a single tick, the engine does not always return the first collision. This issue frequently occurs with gunships, as they often fire from nearly vertical angles. Consequently, gunships can appear to 'hit' the terrain, even though they clearly hit the intended unit. To resolve this, we now ensure that every collision box of every unit has a minimum length of 0.5 ogrids.",
        "",
        "- (#5470) Fix a bug that allows certain units to evade beams in specific conditions",
        "",
        "Most notable the Brick no longer has the ability to evade beams.",
        "",
        "## Contributors",
        "",
        "With thanks to the following individuals who contributed through coding:",
        "",
        "- Jip",
    }
},

A couple of considerations:

The format of the script, program and tool is up to the implementer. But please, whatever you do - keep it simple and maintainable. It should also be trivial to use it in a Github Action. Personally I think it is possible via a simple bash script that accepts an input file and output file.

Course of action

One could look into using Pandoc or Prettier to format the markdown file before converting it, see also:

The entire process should work in a local environment.