Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert assertion ID string to rendered documents #318

Open
k-toumura opened this issue Jun 7, 2022 · 4 comments
Open

Insert assertion ID string to rendered documents #318

k-toumura opened this issue Jun 7, 2022 · 4 comments

Comments

@k-toumura
Copy link
Contributor

@mmccool @egekorkan ,

In Testfest instruction:

Some assertions might be difficult to understand without the surrounding text. Thus, make sure to have the TD specification open and do text searches for two or three words of the assertion. DO NOT do a full text search since formatting might change what the text looks like when rendered. An alternative would be to open index.html on GitHub and do searches for the assertion id.

If you embed the script below to spec document, the assertion ID will be prepended as a string in the rendered HTML only when the query string ?testfest is added. How about embedding this script in each spec document to make it easier to create the manual.csv?

<script>
    // Prepend 'ASSERTION "assertion-id":' to assertion sentence
    document.addEventListener('DOMContentLoaded', () => {
        // let ReSpec do syntax highlighting first
        document.respec.ready.then(() => {
            if (location.search == "?testfest") {
                document.querySelectorAll(".rfc2119-assertion").forEach(n => {
                    let c = document.createElement("code")
                    c.append("ASSERTION \""+n.id+"\":");
                    c.style.color="blue";
                    n.prepend(c);
                });
            }
        });
    });
</script>

Before (or no ?testfest query string):
image

After:
image

@k-toumura
Copy link
Contributor Author

Ah, there are other assertion classes in tables.

Update the script, but it does not display cleanly...

<script>
    // Prepend 'ASSERTION "assertion-id":' to assertion sentence
    document.addEventListener('DOMContentLoaded', () => {
        // let ReSpec do syntax highlighting first
        document.respec.ready.then(() => {
            if (location.search == "?testfest") {
                document.querySelectorAll(".rfc2119-assertion").forEach(n => {
                    let c = document.createElement("code")
                    c.append("ASSERTION \""+n.id+"\":");
                    c.style.color="blue";
                    n.prepend(c);
                });
                document.querySelectorAll(".rfc2119-default-assertion").forEach(n => {
                    let c = document.createElement("code")
                    c.append("ASSERTION \""+n.id+"\":");
                    c.style.color="blue";
                    n.firstElementChild.prepend(c);
                });
                document.querySelectorAll(".rfc2119-table-assertion").forEach(n => {
                    let c = document.createElement("code")
                    c.append("ASSERTION \""+n.id+"\":");
                    c.style.color="blue";
                    n.firstElementChild.prepend(c);
                });
            }
        });
    });
</script>

image

@egekorkan
Copy link
Contributor

This is actually pretty cool and would help a lot with testing. I agree that it does not look good but it is better than nothing and totally ok if we do it only during testing

@mmccool
Copy link
Contributor

mmccool commented Jun 8, 2022

the implementation report does include all the assertions AND links into the document so you can see context. Unfortunately you have to download report.html (for Discovery) and report11.html (for TD) and render it locally to see the links.

@egekorkan
Copy link
Contributor

the implementation report does include all the assertions AND links into the document so you can see context. Unfortunately you have to download report.html (for Discovery) and report11.html (for TD) and render it locally to see the links.

I think this is not needed anymore right? The TD spec has a link to it and it is rendered at https://w3c.github.io/wot-thing-description/testing/report11.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants