Skip to content

Handle the case where there is no empty line before the argument block#324

Merged
gante merged 2 commits into
mainfrom
do_not_move_arg_to_top
Nov 15, 2022
Merged

Handle the case where there is no empty line before the argument block#324
gante merged 2 commits into
mainfrom
do_not_move_arg_to_top

Conversation

@gante

@gante gante commented Nov 15, 2022

Copy link
Copy Markdown
Contributor

As the title says, handles the case where there is no empty line before the argument block, which was causing weird patterns to pop up in other libraries (like transformers).

For instance,

Some description
Args:
    - foo

was being converted to

Args:
Some description
    - foo

This was because the paragraph was not seen as completed (no blank line), and the Args: line was appended as soon as it was seen. After this PR, the example above is converted to

Some description

Args:
    - foo

i.e. an empty line before Args: is added when it is missing.

@gante gante requested a review from sgugger November 15, 2022 15:43
@gante

gante commented Nov 15, 2022

Copy link
Copy Markdown
Contributor Author

(@sgugger not sure who else to tag in the PR review :) )

@sgugger sgugger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Could you also add a test for it?

@gante gante merged commit 407b598 into main Nov 15, 2022
@gante gante deleted the do_not_move_arg_to_top branch November 15, 2022 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants