Skip to content
Snippets Groups Projects
Select Git revision
  • a309a7b23aae4ba798b60d64c771b778a489c2c7
  • main default protected
  • export
  • 28-conversion-tests
  • extraction
  • exploration
  • exploration-old
  • 2-encoding-fix
  • main-old
9 results

activite.rq

Blame
  • eliott's avatar
    Eliott Sammier authored
    - Implement the st:start template to define which nodes to start
      the transformation with. In this case, filter top-level modules.
    - Add a named template mt:module, called for Modules and
      SousParties, which generates the module's index file then
      recurses on its descendants (modules or activities)
    - Activity template is now named and explicitly called instead of
      being the entrypoint
    - New function mt:start_marker helps to generate the file separator
      marker from any template.
    This rework changes the output format and is still in progress;
    Python-side parsing of the STTL output is broken, will be reworked
    as well
    a309a7b2
    History
    activite.rq 1.09 KiB
    PREFIX : <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/>
    PREFIX mt: <http://www.semanticweb.org/eliott/ontologies/2024/4/macao/template/>
    PREFIX st: <http://ns.inria.fr/sparql-template/>
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    
    # Generic Activity template that creates a Markdown page with Hugo front-matter,
    # and calls other specific templates when necessary
    template mt:activite(?act) {
        mt:start_marker(?act) "/index.md" st:nl()
    #     format {
    #         """
    # +++
    # title = "%s"
    # weight = %s0
    # +++
    
    # %s
    # """
    #         ?title
    #         ?weight
    #         ?desc
    #     }
    #     # Insert a Hugo shortcode to load the quiz if this is a quiz activity
    #     if (exists { ?act a :Exercice }, "\n{{< quiz >}}", "")
    #     "%%%%%%%"
    #     st:call-template(mt:quiz,?act)
    }
    where {
        ?act a :Activite .
        ?act :id ?id .
        ?act :titre ?title .
        ?act :description ?desc .
        optional {
            # Turn the page index into a Hugo weight: increment and add a zero, to
            # leave room for adding new pages in-between later
            ?act :index ?index .
            bind(?index + 1 as ?weight)
        }
    }