-
Notifications
You must be signed in to change notification settings - Fork 77
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
API doc directives: accept full character range in package names #431
Conversation
At least one pull request committer is not linked to a user. See https://help.github.com/en/articles/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user |
Stupid question, is there anything I have to do in order to pass the check? I don't understand why "the committer (me) should not linked to a user"... |
Hi @poWer4aiX, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement: |
CLA signed and replied by email... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK to accept non-ASCII chars in package and class names, but that should be applied for both @javadoc
and @scaladoc
.
Your CLA signature somehow didn't make it into our system yet. That's probably a problem on our side - how did you submit it? |
Hi,
second try by using "reply all". Simply replying, resulted i a mail send
to "notifications@github.com", which seems to be wrong.
Thanks,
Christian
Am 21.04.2020 um 20:21 schrieb Lightbend CLA Validator:
…
Hi @poWer4aiX <https://github.com/poWer4aiX>,
Thank you for your contribution! We really value the time you've taken
to put this together.
Before we proceed with reviewing this pull request, please sign the
Lightbend Contributors License Agreement:
http://www.lightbend.com/contribute/cla
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#431 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACTO6JCPOAA366PJMHYUJNDRNXPZVANCNFSM4MNK5PWA>.
|
@raboof, I simply filled out the PDF and attached it by replying to the email I received. Just noticed that this was addressed to Resent it some minutes ago to |
Hi @poWer4aiX, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement: |
Your CLA still hasn't shown up in our system, I'm sorry. |
Can you please explain how to "sign it with the Github integration" or provide me a link with a description? BTW, I just sent it to "cla@lightbend.com". |
Sorry for all this trouble, on https://www.lightbend.com/contribute/cla you'll find the "Confirm with your GitHub account" link. |
Ok, all good now. I checked the CLA manually. |
Thanks for your support. Well in the latest version I have applied the change for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc needs a tweak, otherwise seems OK to me
* Converts package dot notation to a path, separated by '/' | ||
* Allow all valid java characters and java numbers to be used, according to the java lang spec. In order to | ||
* be allow to convert `package.Outer.Inner` in scala to the `packge/Outer$$Inner`, `strictPackageIdent` has | ||
* be set to `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is no longer accurate. Good to give an example: startWithLowercase
will get it wrong when a package name starts with an uppercase letter or when an inner class starts with a lowercase character, while startWithAnycase
will derive the wrong path whenever an inner class is encountered. Does that summarize the trade-off correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's the old style of setting. Will shorten this block and add your description to the @param
description.
* be set to `true`. | |
* Converts package dot notation to a path, separated by '/' | |
* Allow all valid java characters and java numbers to be used, according to the java lang spec. | |
* | |
* @param s package or full qualified class name to be converted. | |
* @param packageNameStyle Setting `startWithLowercase`` will get it wrong when a package name | |
* starts with an uppercase letter or when an inner class starts with | |
* a lowercase character, while `startWithAnycase` will derive the wrong | |
* path whenever an inner class is encountered. |
core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala
Outdated
Show resolved
Hide resolved
} | ||
|
||
case class ScaladocDirective(ctx: Writer.Context) | ||
extends ApiDocDirective("scaladoc") { | ||
|
||
import ScaladocDirective._ | ||
|
||
val defaultPackageNameStyle = variables.getOrElse("scaladoc.package_name_style", "startWithLowercase") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 to keep the default
If you think the change in general is fine, I will also update the documentation. |
@raboof in
are not addressed so far. I have implemented it and added the corresponding tests as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of weird to introduce yet another notation with the $$
, but OK
|
||
private[markdown] def url(link: String, baseUrl: Url, linkStyle: LinkStyle, packageNameStyle: String): Url = { | ||
val url = Url(link).base | ||
val path = dollarDollarToClassDot(ApiDocDirective.packageDotsToSlash(url.getPath, packageNameStyle)) + ".html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So any names actually containing $$
are now broken - I suppose that should be exotic enough that this is OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I also think that this might be a very theoretical case. If we want to get rid of it, we can also think of using a non java character, e.g. a ..
(two dots) instead of $$
. If I', right then this is invalid for any full qualified name.
Is there a plan to merge this PR? This is mainly in relation to #515 but in general its been approved but sitting here unmerged for 2 years. |
f8a96ed
to
6f49d2b
Compare
I guess it was because it conflicted with master and wasn't a trivial merge/rebase ;). I squashed and rebased now, kept the old commits for future reference in https://github.com/raboof/paradox/pull/new/strictPackageIdent-bak . |
According to the [Java Language Specification](https://docs.oracle.com/javase/specs/jls/se8/html/index.html) member of packages, e.g. subpackages are identifiers. Identifiers itself is ...an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter. As a `Java letter` includes more than what is expressed by the regex `\b[a-z][a-z0-9_]*)\.`, package names which include uppercase or non ASCII characters cannot be processed. I know that there are some _naming conventions_ flying around but something like `aBc.DE.fg` is still a valid package name in my opinion. I have changed the regex in `packageDotsToSlash()` to `(\b\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*)\.`. Unfortunately this breaks with the changes applied for issue lightbend#397, lightbend#395, lightbend#98, lightbend#86 to handle inner classes. In order to support this notation, the regex can be relaxed to `(\b\p{javaLowerCase}\p{javaJavaIdentifierPart}*)\.`. I have added the variable 'scaladoc.strictPackageIdent' (which defaults to `false`) by which you can switch between the two regexp. Once set to true, the package name can conform to an identifier now.
6f49d2b
to
76946fb
Compare
Perfect, thank you! |
According to the Java Language Specification member of packages, e.g. subpackages are identifiers. Identifiers itself is
As a
Java letter
includes more than what is expressed by the regex\b[a-z][a-z0-9_]*)\.
, package names which include uppercase or non ASCII characters cannot be processed. I know that there are some naming conventions flying around but something likeaBc.DE.fg
is still a valid package name in my opinion.I have changed the regex in
packageDotsToSlash()
to(\b\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*)\.
. Unfortunately this breaks with the changes applied for issue #397, #395, #98, #86 to handle inner classes. In order to support this notation, the regex can be relaxed to(\b\p{javaLowerCase}\p{javaJavaIdentifierPart}*)\.
.I have added the variable 'scaladoc.strictPackageIdent' (which defaults to
false
) by which you can switch between the two regexp. Once set to true, the package name can conform to an identifier now.