Unverified Commit 6916f115 authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

added news, strict, improved htaccess generation, two small bugs in checks

parent d541c6da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ class Checker(BaseGraphDocumentChecker):
    @filter_clause
    def check_clause(self):
        self.prefixes = {
            prefix: str(namespace) for prefix, namespace in self.document.namespaces
            str(prefix): str(namespace) for prefix, namespace in self.document.namespaces
        }

        # Check prefixes in the ontology
+4 −1
Original line number Diff line number Diff line
@@ -154,7 +154,10 @@ class Checker(BaseGraphDocumentChecker):
                graph_with_imports = self.pipeline.dataset.graph(
                    self.document.version_iri_with_imports
                )
                graph_with_imports.serialize(
                to_serialize = Graph()
                to_serialize += graph_with_imports
                to_serialize.remove((None, OWL.imports, None))
                to_serialize.serialize(
                    destination=temp_file.name, format="ttl", encoding="utf-8"
                )

+19 −7
Original line number Diff line number Diff line
@@ -308,6 +308,10 @@ class SAREFPipeline:
            for project_version in source.versions:
                if not self.filter_version(project_version):
                    continue
                if self.strict:
                    v = project_version.version
                    if v.major == 0 or v.minor == 0 or v.micro == 0:
                        continue
                self.load_version(project_version)

        # feature-gated imports
@@ -334,7 +338,7 @@ class SAREFPipeline:

        if self.mode is PipelineMode.WEBSITE:
            self.site_manager = SiteManager(self)
            self.generate_static_files()
            self.site_manager.generate_static_files()

        for source in self.projects_fetched:
            if not self.filter_project(source):
@@ -342,6 +346,10 @@ class SAREFPipeline:
            for project_version in source.versions:
                if not self.filter_version(project_version):
                    continue
                if self.strict:
                    v = project_version.version
                    if v.major == 0 or v.minor == 0 or v.micro == 0:
                        continue
                source.repo.git.checkout(project_version.branch_name)
                if self.mode == PipelineMode.CHECK:
                    TS103673_Checker(self, project_version).check_clause()
@@ -364,6 +372,10 @@ class SAREFPipeline:
                    for project_version in source.versions:
                        if not self.filter_version(project_version):
                            continue
                        if self.strict:
                            v = project_version.version
                            if v.major == 0 or v.minor == 0 or v.micro == 0:
                                continue
                        self.site_manager.generate_terms_pages(project_version)

    def run_on_project(self, basename):
@@ -518,12 +530,12 @@ class SAREFPipeline:
        versions.sort(key=lambda x: x.version)

        # Filter versions if strict
        if self.strict:
            versions = [
                v
                for v in versions
                if v.branch_type in [BranchType.WORKING_DIRECTORY, BranchType.RELEASE]
            ]
        # if self.strict:
        #     versions = [
        #         v
        #         for v in versions
        #         if v.branch_type in [BranchType.WORKING_DIRECTORY, BranchType.RELEASE]
        #     ]

        logger.debug(
            f"{project.name} versions: {" < ".join([f"{version.version} ({version.branch_type})" for version in versions])}"
+1 −0
Original line number Diff line number Diff line
NAME_SOURCES_PORTAL = "portal"
NAME_SITE = "site"
HTACCESS_PATH = "RewriteCond %{REQUEST_URI} ^(.*/)?[^/]*$\n"
HTACCESS_PATH_GRAPH = "RewriteCond %{REQUEST_URI} ^(.*)?/[^/]*$\n"
SAREF_PORTAL_STATIC_GIT = "https://labs.etsi.org/rep/saref/saref-portal.git"
 No newline at end of file
+41 −0
Original line number Diff line number Diff line
document.addEventListener('DOMContentLoaded', function () {
    const toasts = document.querySelectorAll('.toast');

    function hashString(str) {
        let hash = 5381;
        for (let i = 0; i < str.length; i++) {
            hash = ((hash << 5) + hash) + str.charCodeAt(i); // hash * 33 + c
        }
        return hash >>> 0; // force unsigned
    }

    let dismissed = [];
    try {
        dismissed = JSON.parse(localStorage.getItem('dismissedToasts')) || [];
    } catch (e) {
        dismissed = [];
    }

    toasts.forEach((toastEl, index) => {
        let toastId;
        if (toastEl.id) {
            toastId = toastEl.id;
        } else {
            const txt = toastEl.innerText.trim();
            toastId = `hash_${hashString(txt)}`;
        }

        const bsToast = new bootstrap.Toast(toastEl, { autohide: false });

        if (!dismissed.includes(toastId)) {
            bsToast.show();
        }

        toastEl.addEventListener('hidden.bs.toast', () => {
            if (!dismissed.includes(toastId)) {
                dismissed.push(toastId);
                localStorage.setItem('dismissedToasts', JSON.stringify(dismissed));
            }
        });
    });
});
 No newline at end of file
Loading