The documentation of a Fortran code, being done in org-mode, is intended to be done in such a way that changing the Fortran source code to be documented should be kept at a minimum.
There is the problem that text like "type t_obs", which is a definition, does also occur in comments and is not unique. A naive hyperlink
[[./obs.f90::type t_obs][obs.f90::t_obs definition]]
finds the first occurence in the file, which is not the desired one. Specifying a line number in the link is not acceptable, as the code is under development by a group other than those doing the documentation.
Specifying hyperlinks to match a unique target could be attempted using regular expressions, e.g. of the form [[file:~/xx.org::/regexp/]].
To be specific, I have tried the hyperlink:
[[./obs.f90::/^ *type t_obs/][obs.f90::t_obs definition]]
However, clicking on this link then opens an Occur buffer that shows exactly one match. It then requires to additionally click on the match in order to jump to the link target.
Is there a trick to avoid the need for clicking on the match in the occur buffer and immediately jump to this / the first match?
Furthermore, as my colleagures tell me, the above hyperlink with the regex will not work properly in a PDF generated from the org file when viewed with a PDF viewer.
Do I need to write a specific file-search-function, or is there an easier way?