Pete,

I may be a bit off on this, but I think the error is coming out during the 
resolving phase not the writing phase.  See 
http://www.sphinx-doc.org/en/stable/extdev/tutorial.html

I believe the HTML builder works mostly in phase 4 and it may be some other 
process trying to do the resolving in phase 3 that is generating the 
error.  If that is the case, the resolver can still see the :ref: and tries 
to resolve it since it can see the only node, but the html builder should 
skip it when visit_node is called.

--Peter

On Tuesday, March 14, 2017 at 10:18:12 AM UTC-7, Pete wrote:
>
> I only want to include the text with :ref:`installation` when building a 
> latex (or latexpdf) document.  So, when "make html" is run, this code::
>
>     .. only:: latex
>
>        See the section called :ref:`installation`.
>
> generates this warning::
>
>     C:\Users\...\Introduction.rst:14: WARNING: undefined label: 
> installation (if the link has no caption the label must precede a section 
> header)
>
> When using the "html" builder, this line should not produce any output or 
> warnings or ... since it is inside the only directive that specifies a 
> different builder.  In truth, the installation label is *not* present.  
> That *would* be brought in to a the document under the same type of "only" 
> directive elsewhere.
>
> What have I misunderstood about the "only" directive?
> http://www.sphinx-doc.org/en/stable/markup/misc.html#directive-only
>
> Here is another user who has the same assumption, that content within the 
> only directive will not be processed.
> https://trello.com/c/84v7OWVz/1335-sphinx-improve-only-directive-2150
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to