You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by dz...@apache.org on 2021/09/14 13:25:18 UTC

[drill-site] branch master updated: Clean up in create_data_docs.rb

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

dzamo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill-site.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e2a31f  Clean up in create_data_docs.rb
5e2a31f is described below

commit 5e2a31f287c6352a13d6f454a26fc1b13253c298
Author: James Turton <ja...@somecomputer.xyz>
AuthorDate: Tue Sep 14 15:25:03 2021 +0200

    Clean up in create_data_docs.rb
---
 _plugins/create_data_docs.rb | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/_plugins/create_data_docs.rb b/_plugins/create_data_docs.rb
index 95e0f73..848ad0d 100644
--- a/_plugins/create_data_docs.rb
+++ b/_plugins/create_data_docs.rb
@@ -41,11 +41,11 @@ Jekyll::Hooks.register :site, :pre_render do |site|
 		
 	    docs_by_title[doc_md[:title]] = doc_md
 	    prev_doc_md = doc_md
-	# end
 
-	# docs_by_title.each_value { |doc_md|
-		# Note the (valid) assumption that parents always precede their children
-		# in site.collections['docs'] in the code that follows.
+		# Note the assumption that parents always precede their children
+		# in site.collections['docs'] in the code that follows.  For this to hold,
+		# authors must use a file number+name convention that puts parents first
+		# lexicographically.
 	    if doc_md[:parent].nil?
 		    top_level_docs << doc_md
 		else
@@ -74,11 +74,7 @@ Jekyll::Hooks.register :site, :pre_render do |site|
     	by_title: docs_by_title,
     	hierarchy: top_level_docs
     }
-    
-    # puts JSON.pretty_generate(docs_by_title)
 
-	File.open(out_path, 'a') { |f|
-		f.flock(File::LOCK_EX)
-	    f.write(JSON.pretty_generate(docs_md))
-	}
+    File.write(out_path, JSON.pretty_generate(docs_md))
+    puts 'INFO: pre-render hook has finished creating ' + out_path
 end