-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the bot work with rst files #300
Comments
I'm aware you may not be good in JavaScript (which I assumed is what you meant instead of Java) so I'm wondering if you have pseudo code / Python implementation of the solution you have in mind (given that you seem to know how to resolve this issue)? |
So assuming that the variable # get the indetation of the tag
tagToLookFor = `<!-- ALL-CONTRIBUTORS-LIST:`
# split the previous content with `\n` character
split_content = previousContent.split('\n')
for l in split_content:
if tagToLookFor in l:
indent = ' '*(len(l) - len(l.lstrip()))
break
# now i can start every line written by the tool with indent |
any news ? |
I saw your PR, I was going to have a proper look but had a lot of things thrown my way and didn't get the chance to do that. I'll try to look into it ASAP. |
Thnaks a lot and take your time, I just wanted to make sure that the project was still maintained ;-) |
@tenshiAMD it is still not working, as suggested in #301, I used the bot in one of my repository and the bot deindented the file making it incompatible with .rst https://github.com/openforis/sepal-doc/pull/230/files Could you please reopen this issue ? |
@12rambau looks like there are also issues in configuration and some lines, check my forked repo https://github.com/tenshiAMD/sepal-doc/blob/main/AUTHORS.rst The only missing here is detecting if the file type is RST then add a tab at beginning of each lines |
why not add the tab for all file type? It's harmless for .md and compulsory for .rst |
Is your feature request related to a problem? Please describe.
I use the following json file to pilot he all-contributor bot :
and I created the following AUTHOR.rst file to specify the placement of the final table elements :
But when I launch the bot, the indentation change and the file is broken. In short, .rst files are snesible to indentation inside the
raw
directive and the bot is always rewritting from to very left without identation ending up breaking the rst file.Describe the solution you'd like
So the problem is indentation, and it would be nothing to change :
in the CLI tools (https://github.com/all-contributors/all-contributors-cli/blob/e9c1f55beb2c18391a5d5f0c9e8243dc3f89ebe3/src/generate/index.js#L7) we parse the text and search for the starting point of the table.
To be working with RST, the code should detect the indentation of this message (
<!-- ALL-CONTRIBUTORS-LIST:
) and apply it to every line it write afterward. By doing so the .rst users should only right down the "tag" with the correct indentation for the tool to work.I'm not good at java and I open a SO question on this very matter : https://stackoverflow.com/questions/67069748/how-to-get-the-indent-of-a-searched-item-in-javascript so if anyone can show me ow I think I could make a PR.
Additional context
I don't know if I should post this issue here or in the all-contributor CLI as I don't knwo if the two of them are linked in any way. Feel free to move my issue from here to there if this is more appropriate.
It is the exact same problem (and solution) for the badge.
The text was updated successfully, but these errors were encountered: