Browse Source

modif des notes

Valentin 1 month ago
parent
commit
f9d6d916b5

+ 5 - 0
README.md

@@ -49,7 +49,10 @@ saut de ligne dans texte libre (à la fin de chaque ligne) : `<br>`
 
 `[citation]`
 
+`[note]`
+
 ### SOUS-TITRE
+
 `[moment]`
 
 ### ENCADRÉS
@@ -71,6 +74,8 @@ saut de ligne dans texte libre (à la fin de chaque ligne) : `<br>`
 `[imgsmallsmall]`
 ![imgsmall](screenshots/smallimg.png)
 
+`[screenshot]`
+
 `[fullpage2imgs]`
 ![fullpage2imgs](screenshots/fullpage2imgs.png)
 

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

@@ -1,25 +1,25 @@
-last_checked: 1707326193
+last_checked: 1711015441
 data:
   -
     title: 'macOS 14.0 Sonoma Apache Setup: Upgrading Homebrew'
     url: 'https://getgrav.org/blog/macos-ventura-apache-upgrade-homebrew'
     date: 1697803200
-    nicetime: '4 months ago'
+    nicetime: '5 months ago'
   -
     title: 'macOS 14.0 Sonoma Apache Setup: LetsEncrypt SSL'
     url: 'https://getgrav.org/blog/macos-sonoma-apache-ssl'
     date: 1697799780
-    nicetime: '4 months ago'
+    nicetime: '5 months ago'
   -
     title: 'macOS 14.0 Sonoma Apache Setup: MySQL, Xdebug & More...'
     url: 'https://getgrav.org/blog/macos-sonoma-apache-mysql-vhost-apc'
     date: 1697799600
-    nicetime: '4 months ago'
+    nicetime: '5 months ago'
   -
     title: 'macOS 14.0 Sonoma Apache Setup: Multiple PHP Versions'
     url: 'https://getgrav.org/blog/macos-sonoma-apache-multiple-php-versions'
     date: 1697796000
-    nicetime: '4 months ago'
+    nicetime: '5 months ago'
   -
     title: 'Big changes for Email plugin'
     url: 'https://getgrav.org/blog/new-email-plugin'

File diff suppressed because it is too large
+ 0 - 0
user/data/flex/indexes/pages.json


File diff suppressed because it is too large
+ 23 - 47
user/data/notifications/3a6d0284e743dc4a9b86f97d6dd1a3bf.yaml


+ 5 - 0
user/themes/carnet-atterrissage/css/mep/imgs.css

@@ -10,6 +10,11 @@ img {
 .imgsmallsmall {
     padding-left: calc((var(--pagedjs-pagebox-width) / var(--cols)) + 10mm);
 }
+
+.screenshot {
+    padding-left: calc((var(--pagedjs-pagebox-width) / var(--cols)) + 6mm);
+    padding-right: 16mm;
+}
   
 .imgsmall_bottom {
     break-after: page;

+ 4 - 3
user/themes/carnet-atterrissage/css/mep/inserts.css

@@ -2,7 +2,7 @@
 .latour_nohead, .lampe_nohead {
   font-family: 'Novel';
   font-weight: normal;
-  margin-top: 5mm !important;
+  margin-top: 5mm;
   margin-left: calc(var(--pagedjs-pagebox-width) / var(--cols));
   margin-right: -16mm;
   margin-bottom: 5mm;
@@ -17,8 +17,9 @@
   max-height: 198mm;
 }
 
-.pagedjs_page_content section div div div div:first-child:is(.latour),
-.pagedjs_page_content section div div div div:nth-child(2):is(.latour[data-split-from]) {
+.pagedjs_page_content section div div div div:first-child:is(.latour, .lampe, .latour_nohead, .lampe_nohead),
+.pagedjs_page_content section div div div div:nth-child(2):is(
+  .latour[data-split-from], .latour_nohead[data-split-from], .lampe[data-split-from], .lampe_nohead[data-split-from]) {
   margin-top: 0mm !important;
 }
 

+ 5 - 1
user/themes/carnet-atterrissage/css/mep/notes-biblios.css

@@ -24,10 +24,14 @@
     column-fill: auto;
     line-height: 12pt;
     font-size: 9pt;
-    font-weight: bold;
+    font-weight: normal;
     z-index: 1;
     position: relative;
 }
+
+.bibliographie em {
+    font-weight: bold;
+}
   
 .bibliographie a {
     word-break: break-all;

+ 2 - 1
user/themes/carnet-atterrissage/css/mep/typographie.css

@@ -71,7 +71,8 @@ a {
     padding-right: 16mm;
     hyphens: auto;
     font-style: italic;
-    margin-top: 4mm;
+    margin-top: 10mm;
+    margin-bottom: 10mm;
 }
 
 .citation .guillement_ouvrant {

+ 6 - 18
user/themes/carnet-atterrissage/js/layout/colors.js

@@ -87,21 +87,10 @@ if (debug) console.log('start colors');
         if (bibliographie) {
             bibliographie.style.color = atelierColor;
             // set bg et sprays
-            let bibliographiePage = bibliographie.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; // désolé
+            let bibliographiePage = bibliographie.closest('.pagedjs_page');
             bibliographiePage.style.backgroundColor = bgColor;
 
-            let nextPage;
-            if (bibliographiePage.parentElement.classList.contains('pagedjs_sheet')) {
-                nextPage = bibliographiePage.parentElement?.parentElement?.nextElementSibling?.firstElementChild;
-            } else {
-                nextPage = bibliographiePage.parentElement?.nextElementSibling?.firstElementChild;
-            }
-
-            if (!bibliographie.closest('.pagedjs_page').previousElementSibling.querySelector('.bibliographie')) {
-                if (nextPage) {
-                    nextPage.style.backgroundColor = bgColor;
-                }
-
+            if (bibliographiePage.classList.contains('pagedjs_left_page')) {
                 let sprayImg = document.createElement('img');
                 sprayImg.setAttribute('src', sprays[atelierIndex - 1]);
                 sprayImg.style.height = "242mm";
@@ -110,13 +99,12 @@ if (debug) console.log('start colors');
                 sprayImg.style.top = "-22mm";
                 sprayImg.style.right = "-20mm";
                 sprayImg.style.mixBlendMode = "multiply";
+                sprayImg.style.opacity = "0.75";
 
-                let nextBiblioPageEl = bibliographiePage.parentElement.nextElementSibling?.querySelector('.bibliographie');
-                if (nextBiblioPageEl) {
-                    bibliographiePage.parentElement.nextElementSibling?.querySelector('.bibliographie').insertAdjacentElement("afterend", sprayImg);
-                } else {
-                    bibliographiePage.parentElement.parentElement.nextElementSibling?.querySelector('.pagedjs_page_content').appendChild(sprayImg);
+                if (!bibliographiePage.nextElementSibling.querySelector('.bibliographie')) {
+                    bibliographiePage.nextElementSibling.style.backgroundColor = bgColor;
                 }
+                bibliographiePage.nextElementSibling.querySelector('.pagedjs_page_content').appendChild(sprayImg);
             }
         }
 

+ 2 - 2
user/themes/carnet-atterrissage/js/layout/imgsFullspread.js

@@ -48,8 +48,8 @@ if (debug) console.log('start imgsFullspread');
         }
         if (fullspreadEl.classList.contains('doublepage_bigleft')
         || fullspreadEl.classList.contains('doublepage_bigright')) {
-            let smallImgSrc = fullspreadEl.lastElementChild?.getAttribute('src');
-            fullspreadEl.lastElementChild?.remove();
+            let smallImgSrc = fullspreadEl.querySelector('img:last-of-type')?.getAttribute('src');
+            fullspreadEl.querySelector('img:last-of-type')?.remove();
             let smallImg = document.createElement('img');
             smallImg.setAttribute('src', smallImgSrc);
             let smallImgEl = document.createElement('div');

+ 4 - 0
user/themes/carnet-atterrissage/js/layout/inserts.js

@@ -32,6 +32,10 @@ if (debug) console.log('start inserts');
                     plainColor.style.top = "-22mm";
                     encart.parentNode.prepend(plainColor);
                 }
+
+                if (encart.previousElementSibling?.classList.contains('breakbefore')) {
+                    encart.style.marginTop = "0mm";
+                }
             }
     
 })();

+ 30 - 26
user/themes/carnet-atterrissage/js/parsing/addInsertIcons.js

@@ -6,33 +6,37 @@ if (debug) console.log('start addInsertIcons');
   let encarts = document.querySelectorAll('.latour, .latour_nohead, .lampe, .lampe_nohead');
   
   for(let encart of encarts) {
-      let headContent = encart.firstChild
-      let headerEl = document.createElement('div');
-      headerEl.setAttribute('class', 'encart-header')
-      let iconImg = document.createElement('img');
-      let imgFile = encart.classList.contains('latour') || encart.classList.contains('latour_nohead') ? 'map' : 'lampe';
-      iconImg.setAttribute('src', `/user/themes/carnet-atterrissage/assets/${ imgFile }.png`);
-  
-      if (encart.classList.contains('latour_nohead') || encart.classList.contains('lampe_nohead')) {
-        headerEl.style.flexDirection = 'column';
-        headerEl.style.alignItems = 'flex-start';
-        headerEl.style.fontWeight = 'normal';
-        encart.style.paddingTop = '5mm';
-        encart.style.paddingBottom = '5mm';
-        iconImg.style.marginBottom = '2mm';
-        iconImg.style.margin = '0';
-        iconImg.style.marginBottom = '2.5mm';
-      }
-  
-      headerEl.append(iconImg);
-      headerEl.append(headContent);
-  
-      encart.firstChild?.remove();
-      encart.prepend(headerEl);
-  
-      if (encart.querySelector('.encart-header').nextElementSibling == null) {
-        encart.querySelector('.encart-header').style.marginBottom = '0';
+    if (encart.innerHTML.indexOf("<") === -1) {
+      encart.innerHTML = '<p>' + encart.innerHTML;
+      encart.innerHTML = encart.innerHTML + '</p>';
+    } else {
+      // to check if the first tag is a span
+      if (encart.innerHTML, encart.innerHTML[encart.innerHTML.indexOf("<") + 1] === 's') {
+        encart.innerHTML = encart.innerHTML.substring(0, encart.innerHTML.indexOf('</span>') + 7) + '</p>' + encart.innerHTML.substring(encart.innerHTML.indexOf('</span>') + 7);
+      } else {
+        encart.innerHTML = encart.innerHTML.substring(0, encart.innerHTML.indexOf('<')) + '</p>' + encart.innerHTML.substring(encart.innerHTML.indexOf('<'));
       }
+      encart.innerHTML = '<p>' + encart.innerHTML;
+    }
+
+    let headContent = encart.firstElementChild;
+    let iconImg = document.createElement('img');
+    let imgFile = encart.classList.contains('latour') || encart.classList.contains('latour_nohead') ? 'map' : 'lampe';
+    iconImg.setAttribute('src', `/user/themes/carnet-atterrissage/assets/${ imgFile }.png`);
+    
+    if (encart.classList.contains('latour_nohead') || encart.classList.contains('lampe_nohead')) {
+      encart.prepend(iconImg);
+      iconImg.style.marginTop = '3mm';
+      iconImg.style.width = '8mm';
+    } else {
+      headContent.prepend(iconImg);
+      headContent.classList.add('encart-header');
+    }
+
+    if (encart.querySelector('.encart-header')
+      && encart.querySelector('.encart-header')?.nextElementSibling == null) {
+      encart.querySelector('.encart-header').style.marginBottom = '0';
+    }
   }
   
 })();

+ 17 - 13
user/themes/carnet-atterrissage/js/parsing/footnotes.js

@@ -67,7 +67,7 @@ if (debug) console.log('start footnotes');
     let partie = 0;
     let notes = document.querySelectorAll('.note');
     let noteTitleNextEl;
-    let prevNoteContent;
+    let notesContent = [];
     
     for (let note of notes) {
         let currentPartie = findH3InAncestorsAndSiblings(note, false);
@@ -82,31 +82,35 @@ if (debug) console.log('start footnotes');
             // insert before the next partie page
             findH3InAncestorsAndSiblings(note, true).parentNode.insertBefore(notePageTitle, findH3InAncestorsAndSiblings(note, true));
             noteNumber = 1;
+            notesContent = [];
             partie++;
             notePageTitle.setAttribute('id', 'note_page_title_' + partie);
             noteTitleNextEl = document.getElementById(`note_page_title_${partie}`).nextElementSibling;
             let notesContentEl = document.createElement('div');
             notesContentEl.setAttribute('id', `notes_content_${partie}`);
+            notesContentEl.classList.add('note_text');
             noteTitleNextEl.parentNode.insertBefore(notesContentEl, noteTitleNextEl);
         }
-    
-        if (noteContent != prevNoteContent) {
+
+        if (!notesContent.includes(noteContent)) {
+            notesContent.push(noteContent);
             let noteTextEl = document.createElement('p');
             noteTextEl.setAttribute('class', 'note_text');
-            noteTextEl.innerHTML = '<span class="note_texte_number">' + noteNumber + '</span><span> ' + noteContent + '</span>';
+            noteTextEl.innerHTML = `<p class="note_content_${ notesContent.length }"><span class="note_texte_number">` + noteNumber + '</span><span> ' + noteContent + '</span></p>';
             let notesContentEl = document.getElementById(`notes_content_${partie}`);
             notesContentEl.append(noteTextEl);
         } else {
-            // si les notes qui se suivent ont le même contenu
-            let notesContentEl = document.getElementById(`notes_content_${partie}`);
-            let lastSpan = notesContentEl.querySelector('p:last-of-type span:last-of-type');
-            let numberToAdd = document.createElement('span');
-            numberToAdd.setAttribute('class', 'note_texte_number');
-            numberToAdd.innerText = `, ${noteNumber}`;
-            notesContentEl.querySelector('p:last-of-type').insertBefore(numberToAdd, lastSpan);
+            let notesPageEl = document.querySelector(`#notes_content_${partie}`);
+            let noteContentEl = notesPageEl.querySelector(`.note_content_${notesContent.indexOf(noteContent) + 1}`);
+            console.log(noteContentEl);
+            let spanToAdd = document.createElement('span');
+            spanToAdd.classList.add('note_texte_number');
+            spanToAdd.innerText = `, ${ noteNumber }`;
+            let lastSpan = noteContentEl.lastElementChild.previousElementSibling;
+            console.log(lastSpan, spanToAdd, noteContent);
+            lastSpan.append(spanToAdd);
         }
-    
-        prevNoteContent = noteContent;
+
         prevPartie = currentPartie;
     
         if (isImgNote(note)) {

+ 13 - 31
user/themes/carnet-atterrissage/js/parsing/nonBreakingSpaces.js

@@ -2,39 +2,21 @@
 if (debug) console.log('start nonBreakingSpaces');
 
 (function() {
-  let contentsToClean = document.querySelectorAll('.labeur, .free, .latour, .latour_nohead, .lampe, .lampe_nohead, .bibliographie');
+  let contentsToClean = document.querySelectorAll('.labeur, .free, .latour, .latour_nohead, .lampe, .lampe_nohead, .bibliographie, .citation');
   
   for (let content of contentsToClean) {
-      content.innerHTML = content.innerHTML.replaceAll(' :', '&nbsp;:');
-      content.innerHTML = content.innerHTML.replaceAll(' ?', '&nbsp;?');
-      content.innerHTML = content.innerHTML.replaceAll(' !', '&nbsp;!');
-      content.innerHTML = content.innerHTML.replaceAll('« ', '«&nbsp;');
-      content.innerHTML = content.innerHTML.replaceAll(' »', '&nbsp;»');
-      content.innerHTML = content.innerHTML.replaceAll('(« ', '(«&nbsp;');
-      content.innerHTML = content.innerHTML.replaceAll(' »)', '&nbsp;»)');
-      content.innerHTML = content.innerHTML.replaceAll('“', '«&nbsp;');
-      content.innerHTML = content.innerHTML.replaceAll('”', '&nbsp;»');
-      content.innerHTML = content.innerHTML.replaceAll(' min', '&nbsp;min');
+    content.innerHTML = content.innerHTML.replaceAll(' ;', '&nbsp;;');
+    content.innerHTML = content.innerHTML.replaceAll(' :', '&nbsp;:');
+    content.innerHTML = content.innerHTML.replaceAll(' ?', '&nbsp;?');
+    content.innerHTML = content.innerHTML.replaceAll(' !', '&nbsp;!');
+    content.innerHTML = content.innerHTML.replaceAll('« ', '«&nbsp;');
+    content.innerHTML = content.innerHTML.replaceAll(' »', '&nbsp;»');
+    content.innerHTML = content.innerHTML.replaceAll('(« ', '(«&nbsp;');
+    content.innerHTML = content.innerHTML.replaceAll(' »)', '&nbsp;»)');
+    content.innerHTML = content.innerHTML.replaceAll('“', '«&nbsp;');
+    content.innerHTML = content.innerHTML.replaceAll('”', '&nbsp;»');
+    content.innerHTML = content.innerHTML.replaceAll(' min', '&nbsp;min');
   }
 })();
 
-if (debug) console.log('end nonBreakingSpaces');
-
-
-/* 
-      // micro-typo
-      for(let j = 0; j < contentToParse[i].childNodes.length; j++) {
-        let contentHTML = contentToParse[i].childNodes[j].innerHTML;
-        if (contentHTML != undefined) {
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' :', '&nbsp;:');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', '&nbsp;?');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', '&nbsp;!');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '«&nbsp;');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', '&nbsp;»');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('(« ', '(«&nbsp;');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »)', '&nbsp;»)');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '«&nbsp;');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', '&nbsp;»');
-          contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', '&nbsp;min');
-      }
-    } */
+if (debug) console.log('end nonBreakingSpaces');

+ 2 - 1
user/themes/carnet-atterrissage/js/parsing/tagsToClasses.js

@@ -34,7 +34,8 @@ if (debug) console.log('start tagToClass');
       'breakbefore',
       'breakafter',
       `doublepage_bigright`,
-      `doublepage_bigleft`
+      `doublepage_bigleft`,
+      `screenshot`,
   ];
   
   let bodyContent = $('#body').html();

+ 2 - 0
user/themes/carnet-atterrissage/js/ui/pagesToDisplay.js

@@ -45,6 +45,8 @@ if (debug) console.log('start pagesToDisplay');
     uiContent.append(pagesToDisplayContainer);
 
     function displayPagesRange(start, end) {
+        start = parseInt(start);
+        end = parseInt(end);
         let pages = document.querySelectorAll('.pagedjs_page');
 
         if (/^\d+$/.test(start) && /^\d+$/.test(end) && start <= pages.length && end <= pages.length && start < end) {

+ 3 - 3
user/themes/carnet-atterrissage/js/ui/toggleUiWhenPrinting.js

@@ -8,9 +8,9 @@ if (debug) console.log('start toggleUiWhenPrinting');
         uiContainer.style.display = "none";
       });
 
-      window.addEventListener("afterprint", (event) => {
-        uiContainer.style.display = "block";
-      });
+    window.addEventListener("afterprint", (event) => {
+      uiContainer.style.display = "block";
+    });
       
 })();
 

+ 7 - 7
user/themes/carnet-atterrissage/templates/partials/base.html.twig

@@ -34,13 +34,13 @@
 {% endblock %}
 </head>
 <body id="top" class="{{ page.header.body_classes|e }}">
-        {% block body %}
-            <section id="body">
-                <div>
-                {% block content %}{% endblock %}
-                </div>
-            </section>
-        {% endblock %}
+    {% block body %}
+        <section id="body">
+            <div>
+            {% block content %}{% endblock %}
+            </div>
+        </section>
+    {% endblock %}
 
 
 {% block bottom %}

Some files were not shown because too many files changed in this diff