-
Notifications
You must be signed in to change notification settings - Fork 172
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
Expose Section's sectnum property #1121
Expose Section's sectnum property #1121
Conversation
78ccb4b
to
4979478
Compare
Awesome, thank you! @abelsromero Can you shed some light on the |
If you look at the documentation in the Ruby implementation, the extra
so, it allows the behaviours:
I personally think (but it's subjective 😄) these options do not add much in terms of features. Any user that requires this level of fine tunning can do so outside of the method with normal String manipulations. And if in the future this is requested, we can always add it based on a real use case. |
faa9cab
to
a48f07c
Compare
Checking the errors in test-upstream, I am not sure the reason. Locallly works fine and the CI logs show the version installed being
|
I guess this behavior might be related to this: |
Yep, I need to switch core back to using dot to separate the prerelease component in the version because, once again, Bundler changed its rules and our workaround no longer works. |
Sorry to be insistent, but:
So , if I understand correctly the gem plugin is doing some extra remote check that is not happenign in my machine, and rubygems returns a different version number? If so, maybe we can disable that check. |
The fix has been applied upstream, so now it should return the version number as entered in version.rb. See https://github.com/asciidoctor/asciidoctor/blob/main/lib/asciidoctor/version.rb. So if you're still seeing 2.1.0-alpha.0, then its being picked up from the cache (that version isn't actually released). |
It appears like there are other problems:
I don't know what the source of this check is, but it is clearly choking on this problem I alluded to in gem versioning. RubyGems doesn't allow the use of a hyphen, but semver doesn't allow a use of the hyphen after the third dot. It might be necessary to put some hacks somewhere in this build to deal with this incompatibility. The quick thing to do would be to change the version in version.rb to |
gem-maven-plugin is doing it. The '-SNAPSHOT' is added to the pom descriptor's I found 3 solutions
I'd say the third option is the secure one, unless we understand why the snapshot is added. PS: tested bumping gem-maven-plugin, and it complains about some encoding issue in the pom I could not correct. Some misterious characters 🤷 |
a48f07c
to
dfd77b7
Compare
dfd77b7
to
c6ce846
Compare
Rebased the fix for upstream tests, we should be seeing 🟢 now |
Thank you! |
Thank you for opening a pull request and contributing to AsciidoctorJ!
Please take a bit of time giving some details about your pull request:
Kind of change
Description
What is the goal of this pull request?
Exposes sectnum to users using the API for extensions, converters, etc.
This property is required to easily obtain the section numbering aligned with other Asciidoctor attributes. The alternative is reimplementing all the logic of level counting, secnumlevel, separators formating, etc.
How does it achieve that?
Adds 2 new methods:
String getSectnum()
String getSectnum(String delimiter)
to the Section interface, those simply call the Asciidoctor Ruby property (I assume property is the right name, it's a method).
Are there any alternative ways to implement this?
While working on a converter I could not find it.
index
returns 0, and there's a lot of reimplementation to do to obtain a similar result.Right now I am using internals
String sectnum = ((SectionImpl) node).getString("sectnum")
, which is not ideal.Are there any implications of this pull request? Anything a user must know?
sectnums
is not set, that is, the delimiters without numbers is returned (see testshould_return_invalid_sectnum_when_sectionNumbers_are_not_enabled
). Is odd and I am tempted to add a check and return empty string, but maybe this should be fixed upstream? //cc @mojavelinuxappend
parameter, to keep things simple, and also adding a suffix is something that API users can just do just outside of the method.Issue
n/a
Release notes
Please add a corresponding entry to the file CHANGELOG.adoc