Pārlūkot izejas kodu

remplace les balises des crochets seulement si ça match une liste de mots

Valentin 10 mēneši atpakaļ
vecāks
revīzija
0b8dbccb92

+ 4 - 2
README.md

@@ -54,10 +54,12 @@ saut de ligne dans texte libre (à la fin de chaque ligne) : `<br>`
 
 `[lampe]`
 
+`[bibliographie]`
+
 ### IMAGES
 
-`[smallimg]`
-![smallimg](screenshots/smallimg.png)
+`[imgsmall]`
+![imgsmall](screenshots/smallimg.png)
 
 `[fullpage2imgs]`
 ![fullpage2imgs](screenshots/fullpage2imgs.png)

+ 2 - 1
user/config/versions.yaml

@@ -1,6 +1,6 @@
 core:
   grav:
-    version: 1.7.42.1
+    version: 1.7.42.3
     schema: 1.7.0_2020-11-20_1
     history:
       - { version: 1.7.41.1, date: '2023-05-25 20:58:44' }
@@ -14,3 +14,4 @@ core:
       - { version: 1.7.42.1, date: '2023-06-28 22:41:44' }
       - { version: 1.7.42.1, date: '2023-07-06 22:48:42' }
       - { version: 1.7.42.1, date: '2023-07-06 23:08:22' }
+      - { version: 1.7.42.3, date: '2023-07-18 20:38:16' }

+ 6 - 6
user/data/feed/3a6d0284e743dc4a9b86f97d6dd1a3bf.yaml

@@ -1,25 +1,25 @@
-last_checked: 1688670548
+last_checked: 1689718026
 data:
   -
     title: 'macOS 13.0 Ventura Apache Setup: Upgrading Homebrew'
     url: 'https://getgrav.org/blog/macos-ventura-apache-upgrade-homebrew'
     date: 1671969600
-    nicetime: '6 months ago'
+    nicetime: '7 months ago'
   -
     title: 'macOS 13.0 Ventura Apache Setup: LetsEncrypt SSL'
     url: 'https://getgrav.org/blog/macos-ventura-apache-ssl'
     date: 1671966180
-    nicetime: '6 months ago'
+    nicetime: '7 months ago'
   -
     title: 'macOS 13.0 Ventura Apache Setup: MySQL, Xdebug & More...'
     url: 'https://getgrav.org/blog/macos-ventura-apache-mysql-vhost-apc'
     date: 1671966000
-    nicetime: '6 months ago'
+    nicetime: '7 months ago'
   -
     title: 'macOS 13.0 Ventura Apache Setup: Multiple PHP Versions'
     url: 'https://getgrav.org/blog/macos-ventura-apache-multiple-php-versions'
     date: 1671962400
-    nicetime: '6 months ago'
+    nicetime: '7 months ago'
   -
     title: 'Big changes for Email plugin'
     url: 'https://getgrav.org/blog/new-email-plugin'
@@ -49,4 +49,4 @@ data:
     title: 'Grav Premium Focus: NextGen Editor'
     url: 'https://getgrav.org/blog/premium-focus-nextgen-editor'
     date: 1610713140
-    nicetime: '2 years ago'
+    nicetime: '3 years ago'

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
user/data/flex/indexes/pages.json


+ 1 - 1
user/data/notifications/3a6d0284e743dc4a9b86f97d6dd1a3bf.yaml

@@ -1,4 +1,4 @@
-last_checked: 1689214351
+last_checked: 1689725650
 data:
   feed:
     -

+ 4 - 3
user/themes/carnet-atterrissage/js/layout.js

@@ -19,8 +19,10 @@ class setMarginTexts extends Paged.Handler {
         // cleaner pour que les paragraphes tombent sur la marge haute
         for(let i = 0; i < labeurs.length; i++) {
             if (labeurs[i] == labeurs[i].parentNode.firstElementChild
-                && !labeurs[i].firstElementChild.hasAttribute("data-split-from")) {
-                labeurs[i].firstElementChild.style.marginTop = "0px";
+                && !labeurs[i].firstElementChild?.hasAttribute("data-split-from")) {
+                if (labeurs[i].firstElementChild) {
+                    labeurs[i].firstElementChild.style.marginTop = "0px";
+                }
             }
         }
         // pareil pour les titres temps
@@ -147,7 +149,6 @@ class setMarginTexts extends Paged.Handler {
                 coverImg.firstChild.style.height = "100%";
                 coverImg.firstChild.style.width = "auto";
                 
-                console.log(coverImg);
                 h3.parentElement.append(coverImg);
 
                 let nextImg = document.createElement('img');

+ 47 - 6
user/themes/carnet-atterrissage/js/parsing.js

@@ -1,10 +1,51 @@
 
-// transformer les balises [...] en <div class="...">
-let bodyContent = $('#body').html()
-    .replace(/\[([^\/\]]+)\]/g, '<div class="$1">')
-    .replace(/\[\/([^\]]+)\]/g, '</div>');
+// transformer les balises [...] en <div class="..."> si ça correspond aux classes prédéfinies
+let baliseWords = [
+    'labeur',
+    'free',
+    'temps',
+    'moment',
+    'latour',
+    'lampe',
+    'bibliographie',
+    'imgsmall',
+    'fullpage2imgs',
+    'fullpageimage',
+    'tripleimgs',
+    'tripleimgs_bottom',
+    'tripleimgs2',
+    'tripleimgs2_bottom',
+    'bottomimg',
+    'imgfullspreadleft',
+    'imgfullspreadright',
+    'imgfullspreadright_bleedtop',
+    'imgfullspreadright_bleed',
+    'breakbefore',
+    'breakafter'
+];
+
+// Get the HTML content of the "body" element
+var bodyContent = $('#body').html();
+
+// Replace text between brackets only if it matches one of the words in the list
+bodyContent = bodyContent.replace(/\[([^\/\]]+)\]/g, function(match, word) {
+  if (baliseWords.includes(word)) {
+    return '<div class="' + word + '">';
+  } else {
+    return match; // No replacement if the word is not in the list
+  }
+}).replace(/\[\/([^\]]+)\]/g, function(match, word) {
+  if (baliseWords.includes(word)) {
+    return '</div>';
+  } else {
+    return match; // No replacement if the word is not in the list
+  }
+});
+
+// Update the content of the "body" element
 $('#body').empty().append(bodyContent);
 
+
 // isoler les chiffres des titres
 let moments = document.getElementsByClassName("moment");
 
@@ -32,7 +73,7 @@ for(let i = 0; i < latours.length; i++) {
     headerEl.append(iconImg);
     headerEl.append(headContent);
 
-    latours[i].firstChild.remove();
+    latours[i].firstChild?.remove();
     latours[i].prepend(headerEl);
 }
 
@@ -48,7 +89,7 @@ for(let i = 0; i < lampes.length; i++) {
     headerEl.append(iconImg);
     headerEl.append(headContent);
 
-    lampes[i].firstChild.remove();
+    lampes[i].firstChild?.remove();
     lampes[i].prepend(headerEl);
 }
 

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels