Skip to content
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

Introduce DESCRIPTION_MORE attribute #378

Merged
merged 2 commits into from
Apr 10, 2018

Conversation

acehreli
Copy link
Contributor

@acehreli acehreli commented Mar 13, 2018

This change adds a new attribute to be printed between DESCRIPTION and USAGE.

Paragraphs are determined by empty lines inside DESCRIPTION_MORE. Paragraph indentations are preserved and lines are wrapped. Additionally, extra spaces are removed from text.

Instead of relying on a general purpose markup language package, this change brings a minor markup feature: It recognizes lists from their first character so that the whole list does not become one large paragraph. * and - are visible bullet characters and appear as such:

  * One
  * Two

/ is bullet as well, but it is not printed on the output. This:

/ one: 111
/ two: 222

becomes this:

 one: 111
 two: 222

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 81.439% when pulling e4cb7db on acehreli:description_more into 68dc43e on tomerfiliba:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 81.439% when pulling e4cb7db on acehreli:description_more into 68dc43e on tomerfiliba:master.

@coveralls
Copy link

coveralls commented Mar 13, 2018

Coverage Status

Coverage increased (+0.2%) to 82.083% when pulling b738842 on acehreli:description_more into 6662633 on tomerfiliba:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 81.439% when pulling e4cb7db on acehreli:description_more into 68dc43e on tomerfiliba:master.

@acehreli acehreli force-pushed the description_more branch 2 times, most recently from 56a816b to 7bd9e77 Compare March 13, 2018 05:55
@acehreli
Copy link
Contributor Author

Closing this one as I'm not happy with how paragraphs and wrapping are handled.

@acehreli acehreli closed this Mar 13, 2018
@acehreli acehreli reopened this Apr 2, 2018
@acehreli
Copy link
Contributor Author

acehreli commented Apr 2, 2018

We've been using this change in production for about three weeks now.

Copy link
Collaborator

@henryiii henryiii left a comment

Choose a reason for hiding this comment

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

Needs a few cosmetic changes to support Python 2.

# Add to current paragraph
paragraph = paragraph + ' ' + line

yield from current()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your production must not use Python 2 (must be nice...). This yield from should be very easy to convert to:

for item in current()
    yield item

Since it is an iterator and not a generator.


if len(line) == 0:
# Starting a new paragraph
yield from current()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here as below.

@acehreli
Copy link
Contributor Author

acehreli commented Apr 9, 2018

Thanks, henryiii...

@henryiii henryiii merged commit 88fc98d into tomerfiliba:master Apr 10, 2018
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.

3 participants