Skip to content

Commit

Permalink
fix: Sphinx generated incorrect type references for display
Browse files Browse the repository at this point in the history
When rendering a type reference link, the trailing backtick must be followed by
a non-word character; however the code generated array and union references that
followed this backtick directly with `[` or `)` respectively. This caused a lot
of warnings to be emitted by `sphinx-build`, and resulted in incorrect output.

This adds an escaped space (`\ `) after the backticks, which `sphinx-build`
correctly interprets as a non-word character, but results in no character being
emitted to the output - thus generating the desired output.
  • Loading branch information
RomainMuller committed Sep 17, 2018
1 parent 845cc48 commit 6980b97
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/targets/sphinx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class SphinxDocsGenerator extends Generator {
if (spec.isNamedTypeReference(type)) {
const fqn = this.toNativeFqn(type.fqn);
result = {
ref: `:py:class:\`${type.fqn.startsWith(`${this.assembly.name}.`) ? '~' : ''}${fqn}\``,
ref: `:py:class:\`${type.fqn.startsWith(`${this.assembly.name}.`) ? '~' : ''}${fqn}\`\\ `,
display: fqn
};
} else if (spec.isPrimitiveTypeReference(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ BaseProps (interface)



:extends: :py:class:`@scope/jsii-calc-base-of-base.VeryBaseProps`
:extends: :py:class:`@scope/jsii-calc-base-of-base.VeryBaseProps`\


.. py:attribute:: bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ Number
Represents a concrete number.


:extends: :py:class:`~@scope/jsii-calc-lib.Value`
:extends: :py:class:`~@scope/jsii-calc-lib.Value`\
:param value: The number.
:type value: number

Expand Down Expand Up @@ -332,7 +332,7 @@ Operation
Represents an operation on values.


:extends: :py:class:`~@scope/jsii-calc-lib.Value`
:extends: :py:class:`~@scope/jsii-calc-lib.Value`\
:abstract: Yes

.. py:method:: toString() -> string
Expand Down Expand Up @@ -424,7 +424,7 @@ Value
Abstract class which represents a numeric value.


:extends: :py:class:`@scope/jsii-calc-base.Base`
:extends: :py:class:`@scope/jsii-calc-base.Base`\
:abstract: Yes

.. py:method:: toString() -> string
Expand Down
Loading

0 comments on commit 6980b97

Please sign in to comment.