You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by "TheRetroRoot (via GitHub)" <gi...@apache.org> on 2024/08/19 14:09:38 UTC

[PR] Change sort order of ATOM Feed [groovy-website]

TheRetroRoot opened a new pull request, #52:
URL: https://github.com/apache/groovy-website/pull/52

   Reversed the sort order to have most recent post first. This lets us integrate this feed into common RSS readers as well as tools such as N8N and Zapier.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "Silvrbckw (via GitHub)" <gi...@apache.org>.
Silvrbckw commented on PR #52:
URL: https://github.com/apache/groovy-website/pull/52#issuecomment-2325640623

   Merge


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #52:
URL: https://github.com/apache/groovy-website/pull/52#issuecomment-2325676394

   The ".reverse()" should be outside the closure. I'll merge and then tweak.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "sbglasius (via GitHub)" <gi...@apache.org>.
sbglasius commented on code in PR #52:
URL: https://github.com/apache/groovy-website/pull/52#discussion_r1741550808


##########
generator/src/main/groovy/generator/SiteGenerator.groovy:
##########
@@ -287,7 +287,7 @@ class SiteGenerator {
 
     @CompileDynamic
     private void renderBlogFeed(Map<String, Document> blogList, String baseDir) {
-        def sorted = blogList.sort { e -> e.value.revisionInfo.date }
+        def sorted = blogList.sort { e -> e.value.revisionInfo.date.reverse() }

Review Comment:
   Instead of using reverse (which should be outside the closure), this can easily be done using the other variant of sort:
   
   ```
   def sorted = blogList.sort { a, b -> 
      b.value.revisionInfo.date <=> a.value.revisionInfo.date 
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on code in PR #52:
URL: https://github.com/apache/groovy-website/pull/52#discussion_r1741565393


##########
generator/src/main/groovy/generator/SiteGenerator.groovy:
##########
@@ -287,7 +287,7 @@ class SiteGenerator {
 
     @CompileDynamic
     private void renderBlogFeed(Map<String, Document> blogList, String baseDir) {
-        def sorted = blogList.sort { e -> e.value.revisionInfo.date }
+        def sorted = blogList.sort { e -> e.value.revisionInfo.date.reverse() }

Review Comment:
   reverse() isn't currently available for Map's.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert merged PR #52:
URL: https://github.com/apache/groovy-website/pull/52


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #52:
URL: https://github.com/apache/groovy-website/pull/52#issuecomment-2325771161

   I ended up sorting in reverse in situ and it seems to work fine. Thanks for the suggestion!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Change sort order of ATOM Feed [groovy-website]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on code in PR #52:
URL: https://github.com/apache/groovy-website/pull/52#discussion_r1741563897


##########
generator/src/main/groovy/generator/SiteGenerator.groovy:
##########
@@ -287,7 +287,7 @@ class SiteGenerator {
 
     @CompileDynamic
     private void renderBlogFeed(Map<String, Document> blogList, String baseDir) {
-        def sorted = blogList.sort { e -> e.value.revisionInfo.date }
+        def sorted = blogList.sort { e -> e.value.revisionInfo.date.reverse() }

Review Comment:
   👍 Yes, that's what I ended up going with.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org