From caa815ef3c1dbab9a8c745569e64fea3791f10e9 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Thu, 8 Aug 2019 12:51:35 +0200 Subject: [PATCH 1/3] A proposal to make algotithms easier to read using foldable sections. --- index.html | 51 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index 42d3995e..d863db90 100644 --- a/index.html +++ b/index.html @@ -264,6 +264,24 @@ text-decoration: none; color: #666; } + + .algorithm summary::before { + content: "// "; + } + + .algorithm summary { + padding-left: 2em; + font-style: italic; + } + + /* required if we chose to put OLs *outside* the details, + to force them visible when printing */ + @media screen { + .algorithm details:not([open]) + ol { + display: none; + } + } + @@ -1073,6 +1091,7 @@

Algorithm

For each item context in local context:
  1. If context is null: +
    clear context (unless protected)
    1. If override protected is false and active context contains any protected term definitions, @@ -1086,10 +1105,10 @@

      Algorithm

      In [[[JSON-LD]]], the base IRI was given a default value here; this is now described conditionally in .
    2. -
    +
-
  • If context is a string, -
      +
    1. If context is a string: +
      dereference and process
      1. Set context to the result of resolving value against the base IRI which is established as specified in section 5.1 Establishing a Base URI @@ -1129,14 +1148,14 @@

        Algorithm

        passing result for active context, context for local context, and a copy of remote contexts.
      2. Continue with the next context.
      3. -
      +
  • If context is not a map, an invalid local context error has been detected and processing is aborted.
  • Otherwise, context is a context definition.
  • If context has an @version entry: -
      +
      set processing mode
      1. If the associated value is not 1.1, an invalid @version value has been detected, and processing is aborted.
      2. @@ -1146,10 +1165,10 @@

        Algorithm

        error has been detected and processing is aborted.
      3. Set processing mode, to json-ld-1.1, if not already set.
      4. -
      +
  • If context has an @import entry: -
      +
      merge imported context
      1. If processing mode is json-ld-1.0, an invalid context entry error has been detected and processing is aborted.
      2. @@ -1191,11 +1210,11 @@

        Algorithm

      3. Set context to the result of merging context into import context, replacing common entries with those from context.
      4. -
      +
  • If context has an @base entry and remote contexts is empty, i.e., the currently being processed context is not a remote context: -
      +
      reset base IRI
      1. Initialize value to the value associated with the @base entry.
      2. If value is null, remove the @@ -1210,10 +1229,10 @@

        Algorithm

      3. Otherwise, an invalid base IRI error has been detected and processing is aborted.
      4. -
      +
  • If context has an @vocab entry: -
      +
      reset vocabulary mapping
      1. Initialize value to the value associated with the @vocab entry.
      2. If value is null, remove @@ -1234,10 +1253,10 @@

        Algorithm

        error has been detected and processing is aborted.
        The use of blank node identifiers to value for @vocab is obsolete, and may be removed in a future version of JSON-LD.
      3. -
      +
  • If context has an @language entry: -
      +
      reset default language
      1. Initialize value to the value associated with the @language entry.
      2. If value is null, remove @@ -1247,10 +1266,10 @@

        Algorithm

        lowercased value. If it is not a string, an invalid default language error has been detected and processing is aborted.
      3. -
      +
  • If context has an @propagate entry: -
      +
      check its validity
      1. If processing mode is json-ld-1.0, an invalid context entry error has been detected and processing is aborted.
      2. @@ -1259,7 +1278,7 @@

        Algorithm

        error has been detected and processing is aborted.
      3. Otherwise, previous context was determined before, and no further processing is necessary.
      4. -
      +
  • Create a map defined to keep track of whether or not a term has already been defined From b21884ccea68d1485995552740e2d2c0c3e4a316 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Thu, 8 Aug 2019 16:06:01 +0200 Subject: [PATCH 2/3] replaced CSS hack by JS solution I tested it with Firefox 68.0.1 and Chromium 76.0.3809.87 on Linux. --- index.html | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index d863db90..c0af24f5 100644 --- a/index.html +++ b/index.html @@ -273,16 +273,51 @@ padding-left: 2em; font-style: italic; } + + @@ -1091,8 +1126,7 @@

    Algorithm

    For each item context in local context:
    1. If context is null: -
      clear context (unless protected)
      -
        +
        clear context (unless protected)
        1. If override protected is false and active context contains any protected term definitions, an invalid context nullification @@ -1105,7 +1139,7 @@

          Algorithm

          In [[[JSON-LD]]], the base IRI was given a default value here; this is now described conditionally in .
        2. -
        +
    2. If context is a string:
      dereference and process
        From 07f27133b9b8b5f0f6385c05f5b10c6890ff2276 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Mon, 2 Sep 2019 15:07:25 +0200 Subject: [PATCH 3/3] added intro section with buttons to fold/unfold all --- index.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/index.html b/index.html index c0af24f5..2de8e37e 100644 --- a/index.html +++ b/index.html @@ -275,6 +275,8 @@ } @@ -396,6 +416,20 @@

        Contributing

        Typographical conventions

        + +
        +

        Summarized algorithm sections

        +

        In order to make the algorithms easier to read, + some parts of them are initially hidden and replaced by a short summary. + Clicking on that summary will toggle between detailed and summarised view. + Using the buttons below, you can display or hide the details in all algorithms at once. + Note that, when printing, all details are always shown. +

        +

        + + +

        +