In one of my Sphinx files, I have this :
.. _pyjnius:
Pyjnius
=======
When running on Android, a version of the `Pyjnius <https://pyjnius.readthedocs.io/en/stable/>`_
library is available. This allows advanced creators to call into the Android
libraries.
It seems to compile just how I want it to, but I get a warning saying that WARNING: Duplicate explicit target name: "pyjnius". I got to this issue, advising to end the link with two underscores rather than one, and that it's called an anonymous link. It's not the exact same problem: in the issue there's two links with the same name, and in my case there's only one link, but I tried the solution and it works.
What are the differences between `this <link>`_ and `that <link>`__, aka between anonymous and non-anonymous links ? What would happen if I convert all my external hyperlinks to the double-underscore syntax ?
What are the differences between (...) between anonymous and non-anonymous link
A reference name is created when you declare a hyperlink target. But if the target is anonymous the name isn't used to match the reference to its target. The following quote from the docs sums it up:
Anonymous Hyperlinks
The reference name of the reference is not used to match the reference to its target. Instead, the order of anonymous hyperlink references and targets within the document is significant: the first anonymous reference will link to the first anonymous target. The number of anonymous hyperlink references in a document must match the number of anonymous targets.
Now the second part of the question that was embedded in the same sentence:
What are the differences between `this <link>`_ and `that <link>`__
If you read the reStructuredText specification carefully, no clear example of the concise `Title <Link>`_ syntax is given, but it's an external hyperlink target (because the URL points to the exterior of your documentation). What happens is that the Title acts as the reference name for the target, hence the verbatim error: "Duplicate explicit target name".
Making the declaration of the hyperlink target anonymous by using the double underscore __ causes Title not to be used as the target name, thus there's no longer a duplicate target name because order of declaration is used to match the anonymous target to the link.
In conclusion:
and in my case there's only one link
Yes, but what the error message is saying is that there's a "Duplicate explicit target name" the problem is that Pyjnius is declared as a target once above the section, and again explicitly as the title (acting as target name) in the link using the shortened syntax.
Also note that the reference names (the target, or title) is normalized and thus case insensitive. Thus in your example the name Pyjnius <URL> ends up being normalized to pyjnius which is the same target name above the section.
Reference Names
case is normalized (all alphabetic characters are converted to lowercase).
Related
I'm using :class: and getting a lot of warnings
WARNING: py:class reference target not found: mypkg.submodule.class.
I can't find anywhere in the documentation what exactly the requirements are for a correct cross-reference.
This is currently an incomplete list of requirements I think there are:
The module of the object needs to be importable
The object needs to exist inside of the module
The object needs to be documented somewhere else in the build with a :py:class::, :py:func:: or similar directive
This directive can be generated by the autodoc extension, in which case the object needs to have a docstring associated to it.
For something to be cross-referenced it has to first be "declared".
The Python domain (name py) provides the following directives for module declarations:
There are 2 cases to consider:
domain directives (.. domain:directive_name::) and
roles (:domain:role_name:).
The case of :class: you specify is actually the shortened syntax of writing the role :py:class: not to be confused with the directive declaration .. py:class::.
This directive can be generated by the autodoc extension, in which case the object needs to have a docstring associated to it.
The directive declarations are done implicitly by autodoc, but for objects without docstrings to be declared by autodoc you must use :undoc-members: option with the autodoc directives.
Members without docstrings will be left out, unless you give the undoc-members flag option:
.. automodule:: noodle
:members:
:undoc-members:
One effect of declaring an object is that it is inserted in the index. So you can check the index to make sure it has been declared and inserted. (However note that labels used in referencing arbitrary locations are not inserted in the index.)
I am busy making a sublime text plugin/package that will ease development of lua scripts in my workplace.
We have several lua files with different extensions depending on their purpose. I want ST3 to give the proper lua syntax to these files.
I know you can set ST3 to remember syntax for a specific file extension and this is saved as a (in my case) Lua.sublime-settings file in AppData\Roaming\Sublime Text 3\Packages\User
However, if I put this file in my new plugin's folder, it's ignored.
Am I doing something wrong or is what I want not possible?
This doesn't work because syntax specific settings are only loaded from the package that defines the syntax and from the User package (so the user can customize them).
The following is a quote from the official documentation on settings:
Settings files are consulted in this order:
1. Packages/Default/Preferences.sublime-settings
2. Packages/Default/Preferences (<platform>).sublime-settings
3. Packages/User/Preferences.sublime-settings
4. <Project Settings>
5. Packages/<syntax>/<syntax>.sublime-settings
6. Packages/User/<syntax>.sublime-settings
7. <Buffer Specific Settings>
The only places where <syntax> is referenced is from the package itself and from the user package.
If I had to guess, I would say that this is because outside of the original package author that defined the syntax, all other settings would be considered user customizations, and those settings need to be in the User package (specifically in the root of it) to ensure that they're loaded last.
A simple (but undesirable) solution would be to document for the user that they have to take this step manually.
Another approach would be to add some plugin code that extends the settings when your plugin is loaded:
def plugin_loaded():
settings = sublime.load_settings("Lua.sublime-settings")
extensions = settings.get("extensions", [])
if "blarb" not in extensions:
extensions.append("blarb")
settings.set("extensions", extensions)
sublime.save_settings("Lua.sublime-settings")
If you go this route you may want to include an extra sentinel setting somewhere (in settings specific to your package or some such) that says if you did this or not instead of just forcing the setting in as the example above does.
In practice you would then check if you've set that sentinel or not instead of forcing the extension in, so that if the user decides to use some other syntax for your files you're not forcing them into the Lua syntax.
It's also possible to define your own syntax that just embeds the standard Lua syntax, which allows this to Just Work⢠without having to write any code or have the user do anything:
%YAML 1.2
---
name: Blarb
scope: source.lua
file_extensions:
- blarb
contexts:
main:
- include: scope:source.lua
When you do this, the scope in the file will still be source.lua because that's what the scope in the syntax file says. and the status line will set the syntax name to Blarb. You could modify either of those to change the top level scope or displayed name, if desired.
An example would be to change the scope to source.blarb so that you could create key bindings/snippets that only apply to Lua files of your specific variant.
A potential downside/feature of this is that since the name of the syntax specific settings comes from the name of the file that provides the syntax, if the user has any Lua specific settings, they won't apply to your Blarb files by default.
Similarly anything that's specific to Lua by checking for a scope of source.lua won't work in Blarb files for same reasons, which may or may not be an issue.
I tried creating 2 forms with the same class name in 2 different namespaces
FirstNameSpace.ExampleFormName.TExampleFormName
SecondNameSpace.ExampleFormName.TExampleFormName
although this compiles, I get the following hint
[dcc32 Hint] H2161 Warning: Duplicate resource: Type 10 (RCDATA), ID
TEXAMPLEFORMNAME; File
FirstNameSpace.ExampleFormName.TExampleFormName.DFM resource kept;
file SecondNameSpace.ExampleFormName.TExampleFormName.dfm resource
discarded.
and the program crashes when referencing TExampleFormName.
It looks like there isn't enough information for the linker to work correctly.
Is there any way to make this work?
No. As is indicated in the nature and content of the error, the class-name reference in the associated form files (.dfm) is not namespace qualified and neither are the corresponding resource ID's.
Form class-names must be unique within/across an application.
Similarly, class names of components referenced in a DFM (including controls placed on the form) must also be unique since these also are not namespace qualified.
To promote/ensure unique component/control classnames, a system of prefixes has been adopted by vendors and component developers. That is, Every class produced by a vendor or in a suite of components etc will share a common prefix in addition to their usual name.
For example, if a company called ACME were to provide a library of enhanced, standard UI controls, they might name them:
TAcmeEdit
TAcmeButton
TAcmeListbox
etc
In order to distinguish them from the standard (non-prefixed) VCL controls or from other vendor controls (using a different prefix).
The Delphi Prefix Registry is a community run/supported web site maintains a list of these prefixes (of most use to developers of control/component libraries to ensure they pick a prefix that is not already in use).
I'm not sure how FMX application resources are handled and it may be possible in that case. But just because I don't know that it doesn't work doesn't mean that it does.
I'm trying to follow the instructions for deploying a database via TFS build listed here:
http://www.mytechfinds.com/articles/software-testing/6-test-automation/64-db-deployment-tfs
The instructions include notes about how to configure a ConvertWorkspaceItem element. I've followed the directions, but TFS remains unhappy with my setting for 'Result' and 'Workspace'. For now, I simply entered the text from the directions ('dbproj' and 'Workspace', respectively). TFS complains about my values:
Compiler error(s) encountered processing expression "dbproj". 'dbproj' is not declared. It may be inaccessible due to its production level.
I'm trying to find basic tutorial information on the ConvertWorkspaceItem element, but other than the MSDN reference page there isn't a lot of info. Does anyone know much about configuring this element?
You need to specify valid variable names for both of these properties. there should already be a variable declared in the workflow called workspace, You will need to declare a variable of type string that you wish to receive the result of this activity and specify it's name as the Result property. It looks like in your linked article the author must have already created a variable called dbproj. At the bottom of the workflow designer is a variables tab where you can define your own variables.
I am using D2007 and am trying to document my source code, using the HelpInsight feature (provided since D2005). I am mainly interested in getting the HelpInsight tool-tips working. From various Web-surfing and experimentation I have found the following:
Using the triple slash (///) comment style works more often than the other documented comment styles. i.e.: {*! comment *} and {! comment }
The comments must precede the declaration that they are for. For most cases this will mean placing them in the interface section of the code. (The obvious exception is for types and functions that are not accessible from outside the current unit and are therefore declared in the implementation block.)
The first comment cannot be for a function. (i.e. it must be for a type - or at least it appears the parser must have seen the "type" keyword before the HelpInsight feature works)
Despite following these "rules", sometimes the Help-insight just doesn't find the comments I've written. One file does not produce the correct HelpInsight tool-tips, but if I include this file in a different dummy project, it works properly.
Does anyone have any other pointers / tricks for getting HelpInsight to work?
I have discovered another caveat (which in my case was what was "wrong")
It appears that the unit with the HelpInsight comments must be explicitly added to the project. It is not sufficient to simply have the unit in a path that is searched when compiling the project.
In other words, the unit must be included in the Project's .dpr / .dproj file. (Using the Project | "Add to Project" menu option)