Bug 94488 - Nested tags embedvar to link do not work
Summary: Nested tags embedvar to link do not work
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
5.1.0.0.alpha0+ Master
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-24 13:20 UTC by tagezi
Modified: 2022-01-13 20:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tagezi 2015-09-24 13:20:44 UTC
If we insert the  embedvar tag in link tag, we do not get a link on a page.

Fro example:
<link href="text/scalc/01/fun_aggregate.xhp"><embedvar href="text/scalc/01/fun_aggregate.xhp#aggregate_head"/></link>

This often does not allow to link pages of documents. It would be great if there is such a possibility.
Comment 1 Regina Henschel 2015-09-24 21:26:41 UTC
What do you try to achieve? The structure in your example makes no sense to me.
Comment 2 tagezi 2015-09-25 08:16:10 UTC
The example that you asked me to be removed from the code.
1)Create a variable from the function header saying that it changes the IDs
<paragraph xml-lang="en-US" id="hd_id3144386" role="heading" level="2" l10n="U"
oldref="361">
<variable id="product_head">PRODUCT</variable>
</paragraph>
2) Now we can insert the name of the function, and translators do not need to translate it.
<embedvar href="text/scalc/01/04060106.xhp#product_head"/>
3)But if we put in a embedvar in a link, we do not see a link, we see just the name of the function.
<link href="text/scalc/01/04060106.xhp#Section26"><embedvar href="text/scalc/01/04060106.xhp#product_head"/></link>
So we have to insert the link as:
<link href="text/scalc/01/04060106.xhp#Section26">PRODUCT</link>
But it increases the number of lexemes for translation.

How can I do that? My way seems logical.
Comment 3 Regina Henschel 2015-09-25 21:25:24 UTC
Make it the other way round. Put the link into the variable. Then the link is shown, when this variable is embedded.

Example:

File text/scalc/guild/filters.xhp defines for the heading the variable 'id="filters"' which contains a link 'href="text/scalc/guide/filters.xhp"'. That is a kind of link to itself, it links to the file, which contains this variable. In that file the link is not shown as link, because the file is already in view. You see this file in the help from Contents > Spreadsheets > Filtering and Sorting > Applying Filters.

This variable is embedded in file text/scalc/guild/main.xhp (see line 86). You see this file in the help from Contents >Spreadsheets > General Information ... > Instructions for Using LibreOffice Calc and therein with the link text 'Applying Filters'.
Comment 4 tagezi 2015-09-25 23:33:07 UTC
I know about this method. I use it in my patch. https://gerrit.libreoffice.org/#/c/18821/

But how I have to make a link to the PRODUCT function? Maybe don't I see anything? Could you explain to me, please?

1) Let's say I do as follows:
<paragraph xml-lang="en-US" id="hd_id3144386" role="heading" level="2" l10n="U"
oldref="361"><variable id="product_head"><link href="text/scalc/01/04060106.xhp">PRODUCT</link></variable></paragraph>
In this case, the link moves to the top of the page, and the user needs to scroll far down to find the PRODUCT function.

2) Let's say I do as follows:
 <paragraph xml-lang="en-US" id="hd_id3144386" role="heading" level="2" l10n="U"
oldref="361"><variable id="product_head"><link href="text/scalc/01/04060106.xhp#product_head">PRODUCT</link></variable></paragraph>
In this case, the name of function look like a link, but moves to itself. It only confuses the user.

3) The same situation happen if the link look like:
text/scalc/01/04060106.xhp#Section26

4) if the link look like:
text/scalc/01/04060106.xhp#hd_id3144386
The name of function look like a link, but moves to the top of the page.

These case is not acceptable for the user. They only can confuse.
Comment 5 Regina Henschel 2015-09-26 15:57:41 UTC
So you get these problems:
Nesting an embedvar-element into a link for to help translators does not work, because no link is generated.
Nesting the link into the variable gives the user a link to the current text, which is confusing for the user.

It is indeed a problem, therefore I set the issue to new.

A solution is not straight forward.

1.
The helpdocument.dtd allows an embedvar-element as child of a link-element. And it allows a link-element as child of a variable-element. I don't know yet, where in case of nesting embedvar-element into link-element, the link is removed or not set. And I do not know, whether this behavior intended and only the doctype definition has not been adapted, or whether it is a bug.

2.
If putting an embedvar-element (which might contain a link-element) into an link-element, it might be, that a link in a link is generated. In the end an html-document is generated where the link-element becomes an anchor-element <a ...> and such anchor-elements may not be nested in html. So somewhere on the way to html such nested links need to be resolved.

3.
The transformation from xhp to html by main_transform.xsl removes for a heading the link to itself. That is in line #265-#267. Extend that to also catch the case of linking to a fragment in the file? How to do that?

4.
For Calc-functions I can think of a solution, where each Calc-functions gets its own file, so that a link can always go to the topmost heading. But changing the existing files would generate a large amount of work for translators.
Comment 6 Rafael Lima 2022-01-13 20:32:49 UTC
I ran a test locally and indeed this does not work. Inserting a <embedvar> inside a <link> tag will not render as a link. This is mainly because a <variable> can contain a <link> inside it, so the example you gave could result in problems because it would result in a link inside a link.

I understand why you would like to write something like the example you gave, however the current practice in writing help pages is something like this:

<h1 id="bm_id781582391760253" xml-lang="en-US"><variable id="ctrls_h1"><link href="text/sbasic/shared/03/sf_dialogcontrol.xhp" name="SFDialogs.DialogControl service"><literal>SFDialogs</literal>.<literal>DialogControl</literal> service</link></variable></h1>

You insert the link inside the variable. Then when you want to embed it anywhere else (using <embed> or <embedvar>), it will include the link.

<embed href="text/sbasic/shared/03/sf_dialogcontrol.xhp#ctrls_h1"/>

or

<paragraph role="paragraph" id="par_id101611112328498">Test link to <embedvar href="text/sbasic/shared/03/sf_dialogcontrol.xhp#ctrls_h1"/></paragraph>

I don't think it is possible to change this behavior now, because it might result in breaking many help pages.

My take is WF... Ilmari, what is your view? Is this possible?
Comment 7 Buovjaga 2022-01-13 20:57:53 UTC
Yep, let's close. Not really worth it to invest in the XSLT much anymore.