numeracja
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 14 Jan 2025 15:15:17 +0000 (16:15 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 14 Jan 2025 15:15:17 +0000 (16:15 +0100)
src/redakcja/static/css/html.scss
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
src/wlxml/templates/wlxml/wl2html.xsl

index 9148210..3819c82 100644 (file)
@@ -556,3 +556,27 @@ div[x-node] > .uwaga {
         }
     }
 }
         }
     }
 }
+
+
+
+div[x-node="numeracja"] {
+    background: lightblue;
+    margin: 2em;
+    padding: 2em;
+    border-radius: 1em;
+    &::before {
+       content: "Reset numeracji";
+    }
+}
+
+*[x-number]::before {
+    display: block;
+    content: attr(x-number);
+    position: absolute;
+    text-align: right;
+    width: 40px;
+    left: -60px;
+    font-size: .9em;
+    opacity: .8;
+    
+}
index c5fa8c1..2e1c28d 100644 (file)
                     callback();
             }
 
                     callback();
             }
 
+           let self = this;
             xml2html({
                 xml: this.doc.text,
                 base: this.doc.getBase(),
             xml2html({
                 xml: this.doc.text,
                 base: this.doc.getBase(),
 
                     var htmlView = $('#html-view');
                     htmlView.html(element);
 
                     var htmlView = $('#html-view');
                     htmlView.html(element);
+                   self.renumber();
                     if ('PropertiesPerspective' in $.wiki.perspectives)
                         $.wiki.perspectives.PropertiesPerspective.enable();
 
                     if ('PropertiesPerspective' in $.wiki.perspectives)
                         $.wiki.perspectives.PropertiesPerspective.enable();
 
                 }
             })
         }
                 }
             })
         }
+
+       renumber() {
+           let number = 0;
+            $('#html-view *').each((i, e) => {
+               let $e = $(e);
+               if ($e.closest('[x-node="abstrakt"]').length) return;
+               if ($e.closest('[x-node="nota_red"]').length) return;
+               let node = $e.attr('x-node');
+               if (node == 'numeracja') {
+                   number = 0;
+               } else if (['werset', 'akap', 'wers'].includes(node)) {
+                   number ++;
+                   $e.attr('x-number', number);
+               }
+           })
+       }
     }
 
     $.wiki.VisualPerspective = VisualPerspective;
     }
 
     $.wiki.VisualPerspective = VisualPerspective;
index fbb66fb..9716e19 100644 (file)
       </div>
     </xsl:template>
 
       </div>
     </xsl:template>
 
+    <xsl:template match="numeracja">
+      <div>
+        <xsl:call-template name="standard-attributes" />
+        <div>
+          <xsl:attribute name="data-start">
+            <xsl:value-of select="@start" />
+          </xsl:attribute>
+          <xsl:attribute name="data-link">
+            <xsl:value-of select="@link" />
+          </xsl:attribute>
+        </div>
+      </div>
+    </xsl:template>
+
     <!--
         ********
         STROFA
     <!--
         ********
         STROFA