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
number is ignored/replaced by 1 if it is followed by a dot #1464
Comments
This seems to be because of the ordered list regex. If you have one letter or any number of digits followed by a dot and another character, it treats it as an ordered list. There's another issue in that the list always starts at the first number/letter, regardless of what you begin the list at. This contradicts the documentation: http://asciidoctor.org/docs/user-manual/#ordered-lists. Using I would be happy to look at this, but I don't know what the intended behavior is. Option 1 - Only accept Option 2 - Correctly keep track of the starting digit/letter. |
This happens to the expected behavior assuming the goal is alignment with AsciiDoc Python. (Unexpected, perhaps, but still compliant). @AlanDaniels101 correctly points out that an ordered list is detected if the line begins with a letter or number followed by a dot followed by a space (except you missed roman numerals). One workaround you can use today is to put a blank placeholder in front of the number to hide it from the parser:
or
It works, but it's not pretty. @AlanDaniels101 thanks for pointing out that the documentation is wrong. You have identified the alternate options that we have perfectly. Keep in mind that Option 0 is to keep the current behavior and document it. Since AsciiDoc doesn't currently allow the start of the list to be set by the first number used (counter to what the documentation says), it makes sense that we would choose Option 1. However, Option 2 is certainly tempting because it could be a nice time saver when you often need to set the start number of a list. One the other hand, Option 2 doesn't solve the problem at hand. If we think about the problem at hand, should we allow the period to be escaped?
Any other ideas? |
There should be some way to escape making a list. Escaping the period would be good, but it's not intuitive that you would need to do it. Is there an equivalent to Even with Option 0, there are still some bugs. Take this as an example:
I think Option 1 is good because the useful functionality does not change, it is more intuitive, and it should be a simple change. Escaping the period is still another task on top of this. |
Ah, of course! We could make a normal paragraph explicitly by using:
We don't currently do that, but it makes total sense that we could. I think that's another reasonable step forward here. In fact, we probably want to recognize all built-in (and perhaps even registered) block names to suppress launching into a list. |
Moving forward,
|
Implementing In places that look for a list, once you find a list, check the style. If the style is "normal" (or another built-in block name), then veto the match. It's not a list. If we decide to enforce an ordered list start with 1, a, A or I, then the regexp that needs to be modified is AnyListRx. Once that passes, you don't need to worry about checking in the OrderedListRx because you know you are now at a list. In other words, AnyListRx is the main test. I'm still undecided whether we should allow the start to be defined by the first entry in the list. Intuition tells me it should be allowed, especially since we're already catching it...so it's not like the parser is really changing here. I think we should move forward with it. In other words,
is equivalent to
The first step would be to write a failing test, then we can go in there and start getting the code sorted out. |
...I have to say, that's pretty enticing :) |
This is somewhat tangential. I'm new to asciidoctor, so I was wondering if there was a way to build asciidoctor locally. If I use |
Indeed. Asciidoctor is designed so that you can run the script directly out of the cloned repository. Just run:
(or whatever the relative path is to the bin folder). I have the following alias setup on my machine so that I can run
This is something we need to include in the contributing guide. |
I added a section to the CONTRIBUTING file to cover this. See https://github.com/asciidoctor/asciidoctor/blob/master/CONTRIBUTING.adoc#running-asciidoctor-in-development-mode |
Thanks. I think I was able to run the local version. But I'm still unsure of (or having difficulties with) building asciidoctor. Say I want to make regex changes and see what affect it has. |
You should run the tests, which you can do using You should never have to "build" asciidoctor. The only time that's needed is if you are publishing the gem. Otherwise, you just run the tests are run asciidoctor-local. You can check your version of asciidoctor-local using
It should say 1.5.3.dev. |
Can I modify the behavior of asciidoctor-local? I.e. change the result of |
Indeed. Simply change the code in the cloned repository and run If you have other general questions about how to develop Asciidoctor, I recommend asking on the mailing list at http://discuss.asciidoctor.org. That way, you can get help from more people in the community. |
Thanks! I think I'm on top of it now. I'm actually using Windows (sorry), and that has brought up some problems. Although my Command Prompt accepts Unix commands, something like |
Back to the problems at hand. One thing is that roman numerals are detected, but only with a parenthesis at the end. For example, |
I think on Windows you need to use:
I haven't tried it though.
That just seems to be the way that the AsciiDoc syntax was designed. I think this was done so that |
I have a simple change that does
equals
but
does not work. That's a different issue because
gives
not
without my change. See #1509 |
Looks like this exists already, with |
I'd like to point out that we have the same problem with letters. For example, the following is interpreted as a list:
as reported here: http://discuss.asciidoctor.org/weird-translation-td3381.html One proposed solution is to change the syntax for starting a list with a letter from |
Here's another workaround, for those looking for a solution today:
|
Since we've veered off from the original issue, I've opened another issue to track this improvement. Let's continue the discussion in #2218. |
To be clear, I'm moving the discussion related to explicit numbering affecting the start value. This issue can continue on regarding how to escape lists. |
One way to write this is:
That's not pretty, but it does work. |
I still like the idea of using Commonmark defines the following escape for ordered lists*:
Here's how we could build on that citing the examples above:
That's easy to remember. * Commonmark has a similar escape for unordered lists:
|
The result of a document like
is
Note the missing 4 in the second part where the 14 should be followed by a dot.
My assumption is that the parser interprets this as the beginning of a new list and ignores the characters before the dot while the intention is completely different ;-)
I reproduced this with a plain asciidoc based on the current lazybones template, which then uses these dependencies:
The text was updated successfully, but these errors were encountered: