skipping reference to missing attribute

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

skipping reference to missing attribute

halol
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

David Jencks
This works for me:

:attribute: attr

[source,shell,subs=attributes]
----
ATTR=asciidoctor

echo {attribute} $\{ATTR}
----

David Jencks

> On Feb 27, 2020, at 1:54 AM, halol [via Asciidoctor :: Discussion] <[hidden email]> wrote:
>
> Hello,
>
> Is there a way to process a document such as the one below, without getting a warning?
>
> The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.
>
> # Test :attribute-missing: warn :ADOC_ATTR: asciidoctor [subs="attributes"] ---- SHELL_VAR="shell" echo {ADOC_ATTR} ${SHELL_VAR} ----
>
> In this case, the output is:
> asciidoctor: WARNING: skipping reference to missing attribute: shell_var
>
> Thanks.
>
> If you reply to this email, your message will be added to the discussion below:
> https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
> To start a new topic under Asciidoctor :: Discussion, email [hidden email]
> To unsubscribe from Asciidoctor :: Discussion, click here.
> NAML

Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

mojavelinux
Administrator
In reply to this post by halol
The warning is controlled by the attribute-missing attribute. By default, the value is "skip", which produces no warning for a missing attribute (and leaves it as typed). To get a warning, you must set attribute-missing to "warn". So check your settings to see what value is being used and adjust accordingly.


Best,

-Dan

On Thu, Feb 27, 2020 at 2:54 AM halol [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

David Jencks
I think the point is that he wants ${foo} to be the shell literal, not a (missing) asciidoc attribute reference.  So escaping the ${ as $\{ prevents asciidoc from interpreting the { in ${ as the start of an attribute.

David Jencks

On Feb 27, 2020, at 10:19 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

The warning is controlled by the attribute-missing attribute. By default, the value is "skip", which produces no warning for a missing attribute (and leaves it as typed). To get a warning, you must set attribute-missing to "warn". So check your settings to see what value is being used and adjust accordingly.


Best,

-Dan

On Thu, Feb 27, 2020 at 2:54 AM halol [via Asciidoctor :: Discussion] <<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
To start a new topic under Asciidoctor :: Discussion, email <a href="x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7691.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

mojavelinux
Administrator
Yes, both are valid options. You can either escape it or disable the warnings.

-Dan

On Thu, Feb 27, 2020, 12:14 David Jencks [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I think the point is that he wants ${foo} to be the shell literal, not a (missing) asciidoc attribute reference.  So escaping the ${ as $\{ prevents asciidoc from interpreting the { in ${ as the start of an attribute.

David Jencks

On Feb 27, 2020, at 10:19 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

The warning is controlled by the attribute-missing attribute. By default, the value is "skip", which produces no warning for a missing attribute (and leaves it as typed). To get a warning, you must set attribute-missing to "warn". So check your settings to see what value is being used and adjust accordingly.


Best,

-Dan

On Thu, Feb 27, 2020 at 2:54 AM halol [via Asciidoctor :: Discussion] <<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
To start a new topic under Asciidoctor :: Discussion, email <a href="x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7691.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7692.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

mojavelinux
Administrator
In reply to this post by David Jencks
Btw, never use subs=attributes

It should be subs=attributes+. Otherwise, special characters won't be escaped and it will produce broken HTML.

On Thu, Feb 27, 2020, 12:17 Dan Allen <[hidden email]> wrote:
Yes, both are valid options. You can either escape it or disable the warnings.

-Dan

On Thu, Feb 27, 2020, 12:14 David Jencks [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I think the point is that he wants ${foo} to be the shell literal, not a (missing) asciidoc attribute reference.  So escaping the ${ as $\{ prevents asciidoc from interpreting the { in ${ as the start of an attribute.

David Jencks

On Feb 27, 2020, at 10:19 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

The warning is controlled by the attribute-missing attribute. By default, the value is "skip", which produces no warning for a missing attribute (and leaves it as typed). To get a warning, you must set attribute-missing to "warn". So check your settings to see what value is being used and adjust accordingly.


Best,

-Dan

On Thu, Feb 27, 2020 at 2:54 AM halol [via Asciidoctor :: Discussion] <<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
To start a new topic under Asciidoctor :: Discussion, email <a href="x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7691.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7692.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

David Jencks
In reply to this post by mojavelinux
They have really different effects.  Consider:

:ambiguous: asciidoctor

[source,shell,subs=attributes+]
----
ambiguous=shell

echo {ambiguous} ${ambiguous}
——

not that this is a good idea…. but what if in his example someone later edited the .adoc to define,

:SHELL_VAR: now an asciidoc attribute!

David Jencks

On Feb 27, 2020, at 11:17 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Yes, both are valid options. You can either escape it or disable the warnings.

-Dan

On Thu, Feb 27, 2020, 12:14 David Jencks [via Asciidoctor :: Discussion] <<a href="x-msg://43/user/SendEmail.jtp?type=node&amp;node=7693&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
I think the point is that he wants ${foo} to be the shell literal, not a (missing) asciidoc attribute reference.  So escaping the ${ as $\{ prevents asciidoc from interpreting the { in ${ as the start of an attribute.

David Jencks

On Feb 27, 2020, at 10:19 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

The warning is controlled by the attribute-missing attribute. By default, the value is "skip", which produces no warning for a missing attribute (and leaves it as typed). To get a warning, you must set attribute-missing to "warn". So check your settings to see what value is being used and adjust accordingly.


Best,

-Dan

On Thu, Feb 27, 2020 at 2:54 AM halol [via Asciidoctor :: Discussion] <<a href="<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;amp;node=7691&amp;amp;i=0" class="">x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
To start a new topic under Asciidoctor :: Discussion, email <a href="<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;amp;node=7691&amp;amp;i=1" class="">x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7691.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7692.html
To start a new topic under Asciidoctor :: Discussion, email <a href="x-msg://43/user/SendEmail.jtp?type=node&amp;node=7693&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7693.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

mojavelinux
Administrator
I agree they're different. I expect the writer to know which one is best for them. I'm just offering the options.

-Dan

On Thu, Feb 27, 2020 at 12:26 PM David Jencks [via Asciidoctor :: Discussion] <[hidden email]> wrote:
They have really different effects.  Consider:

:ambiguous: asciidoctor

[source,shell,subs=attributes+]
----
ambiguous=shell

echo {ambiguous} ${ambiguous}
——

not that this is a good idea…. but what if in his example someone later edited the .adoc to define,

:SHELL_VAR: now an asciidoc attribute!

David Jencks

On Feb 27, 2020, at 11:17 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Yes, both are valid options. You can either escape it or disable the warnings.

-Dan

On Thu, Feb 27, 2020, 12:14 David Jencks [via Asciidoctor :: Discussion] <<a href="x-msg://43/user/SendEmail.jtp?type=node&amp;node=7693&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
I think the point is that he wants ${foo} to be the shell literal, not a (missing) asciidoc attribute reference.  So escaping the ${ as $\{ prevents asciidoc from interpreting the { in ${ as the start of an attribute.

David Jencks

On Feb 27, 2020, at 10:19 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

The warning is controlled by the attribute-missing attribute. By default, the value is "skip", which produces no warning for a missing attribute (and leaves it as typed). To get a warning, you must set attribute-missing to "warn". So check your settings to see what value is being used and adjust accordingly.


Best,

-Dan

On Thu, Feb 27, 2020 at 2:54 AM halol [via Asciidoctor :: Discussion] <<a href="<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;amp;node=7691&amp;amp;i=0" class="">x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
Hello,

Is there a way to process a document such as the one below, without getting a warning?

The difficulty here is to mix shell variables (using the ${var} notation is a requirement) with asciidoctor attributes in the same block. The final output is fine, but I am getting a lot of warnings and sorting out which ones matter (actually missing asciidoctor attributes) and which one don't (shell variables) is not always easy.

# Test

:attribute-missing: warn

:ADOC_ATTR:      asciidoctor

[subs="attributes"]
----
SHELL_VAR="shell"

echo {ADOC_ATTR} ${SHELL_VAR}
----

In this case, the output is:
asciidoctor: WARNING: skipping reference to missing attribute: shell_var

Thanks.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687.html
To start a new topic under Asciidoctor :: Discussion, email <a href="<a href="x-msg://41/user/SendEmail.jtp?type=node&amp;amp;node=7691&amp;amp;i=1" class="">x-msg://41/user/SendEmail.jtp?type=node&amp;node=7691&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7691.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7692.html
To start a new topic under Asciidoctor :: Discussion, email <a href="x-msg://43/user/SendEmail.jtp?type=node&amp;node=7693&amp;i=1" target="_top" rel="nofollow" link="external" class="">[hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7693.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7695.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

halol
Thank you both for your replies.

Escaping the shell variable is indeed what I need, and I now feel a bit dumb for not thinking about it before. Specially since I have been struggling with the opposite problem: attributes being escaped when I don't want them to be.

For example:
:folder_name:  Path
[source,shell,subs=attributes+]
----
D:\Windows\{folder_name}
----
Which very obviously doesn't produce the expected results. That should have given me the solution to my current problem!

And I take good note of the comment regarding subs=attributes.

Thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: skipping reference to missing attribute

David Jencks
In case you haven’t discovered this already….

:folder_name:  Path
[source,shell,subs=attributes+]
----
D:\Windows{backslash}{folder_name}
----


David Jencks

On Feb 28, 2020, at 12:41 AM, halol [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Thank you both for your replies.

Escaping the shell variable is indeed what I need, and I now feel a bit dumb for not thinking about it before. Specially since I have been struggling with the opposite problem: attributes being escaped when I don't want them to be.

For example:
:folder_name:  Path
[source,shell,subs=attributes+]
----
D:\Windows\{folder_name}
----
Which very obviously doesn't produce the expected results. That should have given me the solution to my current problem!

And I take good note of the comment regarding subs=attributes.

Thanks again.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/skipping-reference-to-missing-attribute-tp7687p7700.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML