minetest / contentdb

A content database for Minetest mods, games, and more
https://content.minetest.net
GNU Affero General Public License v3.0
96 stars 47 forks source link

Support `.cdb.md` #315

Open AFCMS opened 3 years ago

AFCMS commented 3 years ago

Problem

using the long_description field isn't possible, because you cant add new lines without using \n making a line of lengh > 200 isn't really good for readability....

Solutions

concatenate the strings in an array

Alternatives

?

Additional context

image image

rubenwardy commented 3 years ago

This will need to be done in the postReleaseCheckUpdate hook here: https://github.com/minetest/contentdb/blob/master/app/tasks/importtasks.py#L115

Perhaps split the cdb reading into a new function such that the code does:

try:
    data = get_edit_data_from_dir(tree.baseDir)
    if data != {}:  # Not sure if this will actually work to check not empty, probably not
        do_edit_package(package.author, package, False, data, "Post release hook")
except LogicError as e:
    raise TaskError(e.message)

Then get_edit_data_from_dir(path) would read {path}/.cdb.json and {path}/.cdb.md. The value of .cdb.md would be set into data["long_description"] before it is returned. Make sure to convert line endings from \r\n to \n, and also handle the case where .cdb.json doesn't exist

Perhaps get_edit_data_from_dir should also support {path}/.cdb/meta.json and {path}/.cdb/long_description.md

appgurueu commented 2 years ago

Not a fan of the array.

rubenwardy commented 2 years ago

Yeah, me neither

dacmot commented 1 year ago

I would love to have a .cdb.md for the long description. It would enable having all the information from the contentdb under revision control.

Lazerbeak12345 commented 1 year ago

Alternatively, we could provide a way to point to the file path of a markdown file from within .cdb.json, but .cdb.md seems simplest to implement.