Skip to content

Friendly names for license text in attribution notice? #446

@OctagonHex

Description

@OctagonHex

Hello,
I almost got aboutcode-toolkit to do what I want, but I'm stuck at this point. I want to replace the text (but not the target link) with the license name, instead of the license key.

My input:
complexComponent.ABOUT

about_resource: complexComponent
name: complexComponent
copyright: Copyright (c) 2020 Complex Company Copyright
licenses:
    -   file: LIC1.LICENSE
        key: LIC1
        name: My 1st license name
    -   file: LIC2.LICENSE
        key: LIC2
        name: My 2nd license name
owner: Your Complex Company owner

I have the following output.html:

Software Information
complexComponent 

This component is licensed under: 
My 1st license name 
My 2nd license name 

Full text of LIC1 is available at the end of this document.
Full text of LIC2 is available at the end of this document.

Common Licenses Used in This Product
LIC1
License text 1.

LIC2
Completly different license text 2.
End

The license keys are often very cryptic and should not be shown to the end user, like (GPL-2.0-only WITH Linux-syscall-note), so I want to display a friend name instead. Like this:

OLD:
Full text of LIC1 is available at the end of this document.
Full text of LIC2 is available at the end of this document.
NEW:
Full text of "My 1st license name" is available at the end of this document.
Full text of "My 2nd license name" is available at the end of this document.

My template is:

<!doctype html>
<html>
    <body>
        <h1>Software Information</h1>
		
		    {% for about_object in abouts %}
        <div class="oss-component" id="component_{{ loop.index0 }}">
            <h3 class="component-name">{{ about_object.name.value }}
                {% if about_object.version.value %}{{ about_object.version.value }}{% endif %}
            </h3>
            {% if about_object.license_name.value %}
			<p>This component is licensed under:
				{% for license_name in about_object.license_name.value %}			
					 <br>{{license_name }}
				 {% endfor %}
			</p>				 
            {% endif %}			
			{% for license_key in about_object.license_key.value %}
				<p>Full text of
					<a class="{{ license_key }}" href="#component-license-{{ license_key }}">
					{{ license_key }} <!-- This should change to license_name -->
					</a>
				is available at the end of this document.</p>
			{% endfor %}

        </div>
    {% endfor %}

    <hr/>

    <h3>Common Licenses Used in This Product</h3>

    {% for key in license_key_and_context %}
		<h3 id="component-license-{{ key }}">{{ key }}</h3>
		<pre>{{ license_key_and_context[key]|e }}</pre>
    {% endfor %}

    <h3><a id="End">End</a></h3>

    </body>
</html>

But I don't see how I can mix the two loops in the template language to do that: See the line {{ license_key }} <!-- This should change to license_name -->

LIC2.LICENSE.txt
complexComponent.ABOUT.txt
LIC1.LICENSE.txt

template.html.txt

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions