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

doc/rst2html: some few fixes for enumerated and bullet lists #16295

Merged
merged 6 commits into from
Dec 14, 2020

Conversation

a-mr
Copy link
Contributor

@a-mr a-mr commented Dec 8, 2020

First of all, fix #16041 : enumerated lists parsing is re-implemented — now there is no requirement, that it should contain some line after enumerator line, and it does not produce spurious block quotes as in #16041 . Also (1) and (2) were not parsed as enumerated list in nimdoc/rst2html/expected/rst_examples.html, most probably it was the same problem.

Also now rst.nim correctly handles alphabetic characters as enumerators:

a. string1
b. string2

while previously it turned them into 1. string1 2. string2.

According to the spec rst.nim checks that

  • enumerator numbers/letters are in sequence and produces separate lists if they are not
  • items belong to the same kind, and otherwise parses as 2 separate lists:
    1. list1
    a. list2
    

It can now generate auto-enumerator properly:

2. expect2
#. expect3

b. expect b
#. expect c

The first commit addresses a few blank lines problem for enumerated and bullet lists:

* this is c1
* this is c2

* this is c3


* this is c4



* this is c5

was not parsed as a single list, while Multiple successive blank lines are equivalent to a single blank line

cc @narimiran

@timotheecour timotheecour changed the title some few fixes for enumerated and bullet lists doc/rst2html: some few fixes for enumerated and bullet lists Dec 8, 2020
@timotheecour
Copy link
Member

  • great, also seems to fix nim doc; maybe add a doc comment in the test file nimdoc/testproject/testproject.nim that exercises this?

  • this should be documented somewhere after (or in this) PR, maybe manual.rst or doc/docgen.rst

@a-mr a-mr force-pushed the fix-enumerated-and-bullet-lists branch from 555af98 to b73cd7e Compare December 11, 2020 13:27
@a-mr
Copy link
Contributor Author

a-mr commented Dec 11, 2020

@narimiran please review.

@narimiran
Copy link
Member

Looks good!

Since we also support markdown, the following is a valid ordered list:

1. fist
1. second
1. third

(The behaviour is the same as in your #. examples: auto-increment)

Could you add support for that too?

@Araq
Copy link
Member

Araq commented Dec 14, 2020

Could you add support for that too?

Can be done in a followup PR, I'm merging this now.

@Araq Araq merged commit e843492 into nim-lang:devel Dec 14, 2020
@a-mr a-mr mentioned this pull request Dec 17, 2020
mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
…g#16295)

* fix bullet/enumarated lists with many blank lines
* fix enumerated list parsing
* fix parse failure when next line after list empty
* implement arbitrary start of enumerator
* check that enumerators are in order
* remove redundant start=x if x=1 or a
* add some doc on implemented features
* update start in rst_examples.rst
* allow upper-case letters + more docs
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
…g#16295)

* fix bullet/enumarated lists with many blank lines
* fix enumerated list parsing
* fix parse failure when next line after list empty
* implement arbitrary start of enumerator
* check that enumerators are in order
* remove redundant start=x if x=1 or a
* add some doc on implemented features
* update start in rst_examples.rst
* allow upper-case letters + more docs
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.

rst2html list numbering wrong
4 participants