This is an automated email from the ASF dual-hosted git repository.

skygo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/netbeans-antora.git


The following commit(s) were added to refs/heads/main by this push:
     new 12fd1be  make content for atom feed more compliant
12fd1be is described below

commit 12fd1be2bc51e4622124f3f21933989aed87562e
Author: Eric Barboni <sk...@apache.org>
AuthorDate: Thu Feb 22 13:59:07 2024 +0100

    make content for atom feed more compliant
---
 lib/rssfeed.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/rssfeed.js b/lib/rssfeed.js
index 4893bf4..7691516 100644
--- a/lib/rssfeed.js
+++ b/lib/rssfeed.js
@@ -49,7 +49,9 @@ module.exports.register = function ( { config }) {
       feed += '\n    <link rel="alternate" type="text/html" href="' + 
playbook.site.url + p.url + '"/>'
       feed += '\n    <published>' + rssDate(p.attributes.revdate) + 
'</published>'
       feed += '\n    <updated>' + rssDate(p.attributes.revdate) + '</updated>'
-      feed += '\n    <content type="html">' + 
escape(blogcontent(p.contents.toString())) + '</content>'
+      feed += '\n    <content type="html">'
+      feed += '\n'+ escape(blogcontent(p.contents.toString()))
+      feed += '\n    </content>'
       feed += '\n  </entry>'
     })
     feed += '\n</feed>'
@@ -75,9 +77,14 @@ function sortByDate (a, b) {
 }
 // reduce the page content to approx content, 
 function blogcontent (s) {
-  const endof = s.indexOf("<section class='tools'>")
-  const startof = s.indexOf('<div class="paragraph">')
-  const split = s.substring(startof, endof)
+  // end of content
+  const endof = s.indexOf("</article>")
+  // possible starting point of article,
+  const startofparagraph = s.indexOf('<div class="paragraph">')
+  const startofpreamble = s.indexOf('<div id="preamble">')
+  // take min if defined
+  const startpoint = Math.min( startofparagraph>-1 ? startofparagraph : 
Infinity, startofpreamble >-1 ? startofpreamble: Infinity)
+  const split = s.substring( startpoint, endof)
   return split
 }
 // remove some breaking char for xml 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to