From 25d14f5078495f20085c22f82a2b98e6fd39b739 Mon Sep 17 00:00:00 2001 From: Marek Paśnikowski Date: Sat, 20 Jan 2024 11:52:47 +0100 Subject: Fix misunderstood instancing of publishing-object The recently introduced test suite uncovered a fatal error in my understanding of how to correctly manage instances of objects. --- www/build-site.el | 19 ++++++++++--------- www/www-test-data.el | 26 +++++++++++++++----------- www/www.org | 45 +++++++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 40 deletions(-) diff --git a/www/build-site.el b/www/build-site.el index 3e88b9a..af692e7 100644 --- a/www/build-site.el +++ b/www/build-site.el @@ -23,17 +23,18 @@ ( print success-report ) ( ) ) ) ) ) -( setq publication-instance ( publication-object ) ) +( defun object-compose ( publication-instance ) + ( plist-get publication-instance :object-compose ) ) -( setq object-compose ( plist-get publication-instance :object-compose ) ) +( defun object-projects ( publication-instance ) + ( plist-get publication-instance :object-get-projects ) ) -( setq object-projects ( plist-get publication-instance :object-get-projects ) ) +( defun object-report ( publication-instance ) + ( plist-get publication-instance :object-report ) ) -( setq object-report ( plist-get publication-instance :object-report ) ) - -( defun publish ( &rest project-data ) +( defun publish ( publication-instance &rest project-data ) ( let ( ( data-projects ( plist-get project-data :data-projects ) ) ) - ( funcall object-projects data-projects ) - ( funcall object-compose ) - ( funcall object-report ) + ( funcall ( object-projects publication-instance ) data-projects ) + ( funcall ( object-compose publication-instance ) ) + ( funcall ( object-report publication-instance ) ) ( ) ) ) diff --git a/www/www-test-data.el b/www/www-test-data.el index 19705c7..f6ef8aa 100644 --- a/www/www-test-data.el +++ b/www/www-test-data.el @@ -4,24 +4,28 @@ ( print "publish-test-1" ) -( publish :data-projects ( list "test.pl" "example.org" ) ) +( let ( ( publication-instance ( publication-object ) ) ) + ( publish publication-instance + :data-projects ( list "test.pl" "example.org" ) ) ) ( print "publish-test-2" ) -( publish +( let ( ( publication-instance ( publication-object ) ) ) + ( publish publication-instance - :data-projects - ( list "test.pl" + :data-projects + ( list "test.pl" - :property1 - "value1" + :property1 + "value1" - :property2 - "value2" ) ) + :property2 + "value2" ) ) ) ( print "publish-test-3" ) -( publish "test.pl" +( let ( ( publication-instance ( publication-object ) ) ) + ( publish publication-instance "test.pl" - :components - ( list "example.pl" "example.org" ) ) + :components + ( list "example.pl" "example.org" ) ) ) diff --git a/www/www.org b/www/www.org index c51bf76..55b2441 100644 --- a/www/www.org +++ b/www/www.org @@ -25,27 +25,31 @@ many other properties of a project. ( print "publish-test-1" ) - ( publish :data-projects ( list "test.pl" "example.org" ) ) + ( let ( ( publication-instance ( publication-object ) ) ) + ( publish publication-instance + :data-projects ( list "test.pl" "example.org" ) ) ) ( print "publish-test-2" ) - ( publish + ( let ( ( publication-instance ( publication-object ) ) ) + ( publish publication-instance - :data-projects - ( list "test.pl" + :data-projects + ( list "test.pl" - :property1 - "value1" + :property1 + "value1" - :property2 - "value2" ) ) + :property2 + "value2" ) ) ) ( print "publish-test-3" ) - ( publish "test.pl" + ( let ( ( publication-instance ( publication-object ) ) ) + ( publish publication-instance "test.pl" - :components - ( list "example.pl" "example.org" ) ) + :components + ( list "example.pl" "example.org" ) ) ) #+END_SRC *** [[https://orgmode.org/manual/Project-alist.html][The variable =org-publish-project-alist=]] @@ -99,19 +103,20 @@ are also published, in the sequence given. ( print success-report ) ( ) ) ) ) ) - ( setq publication-instance ( publication-object ) ) + ( defun object-compose ( publication-instance ) + ( plist-get publication-instance :object-compose ) ) - ( setq object-compose ( plist-get publication-instance :object-compose ) ) + ( defun object-projects ( publication-instance ) + ( plist-get publication-instance :object-get-projects ) ) - ( setq object-projects ( plist-get publication-instance :object-get-projects ) ) + ( defun object-report ( publication-instance ) + ( plist-get publication-instance :object-report ) ) - ( setq object-report ( plist-get publication-instance :object-report ) ) - - ( defun publish ( &rest project-data ) + ( defun publish ( publication-instance &rest project-data ) ( let ( ( data-projects ( plist-get project-data :data-projects ) ) ) - ( funcall object-projects data-projects ) - ( funcall object-compose ) - ( funcall object-report ) + ( funcall ( object-projects publication-instance ) data-projects ) + ( funcall ( object-compose publication-instance ) ) + ( funcall ( object-report publication-instance ) ) ( ) ) ) #+END_SRC -- cgit v1.2.3