From 96a4739b688f4155ce5821b20b7acaa991c17b6a Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Mon, 10 Jun 2024 00:16:05 +1000 Subject: [PATCH 1/3] https://github.com/metanorma/iso-10303/issues/41 --- lib/suma/collection_manifest.rb | 7 +++++++ lib/suma/processor.rb | 6 ++++++ lib/suma/schema_collection.rb | 8 +++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/suma/collection_manifest.rb b/lib/suma/collection_manifest.rb index 8b3cbd3..1e0c247 100644 --- a/lib/suma/collection_manifest.rb +++ b/lib/suma/collection_manifest.rb @@ -113,5 +113,12 @@ def expand_schemas_only(schema_output_path) [self, added] end + + def remove_schemas_only_sources + ret = entry.each_with_object([]) do |e, m| + e.schemas_only or m << e + end + self.entry = ret + end end end diff --git a/lib/suma/processor.rb b/lib/suma/processor.rb index fffabf0..e013007 100644 --- a/lib/suma/processor.rb +++ b/lib/suma/processor.rb @@ -32,6 +32,8 @@ def run(metanorma_yaml_path:, schemas_all_path:, compile:, output_directory: "_s exported_schema_config.to_file Utils.log "Done." + # now get rid of the source documents for schema sources + col = Suma::SchemaCollection.new( config_yaml: schemas_all_path, manifest: collection_config.manifest, @@ -46,6 +48,10 @@ def run(metanorma_yaml_path:, schemas_all_path:, compile:, output_directory: "_s Utils.log "No compile option set. Skipping schema compilation." end + new_collection_config_path = "collection-output.yaml" + collection_config.manifest.remove_schemas_only_sources + collection_config.to_file(new_collection_config_path) + # TODO: Do we still need this? # Define Proc to resolve fileref my_fileref_proc = proc do |ref_folder, fileref| diff --git a/lib/suma/schema_collection.rb b/lib/suma/schema_collection.rb index 200c401..ea2212b 100644 --- a/lib/suma/schema_collection.rb +++ b/lib/suma/schema_collection.rb @@ -78,9 +78,11 @@ def compile entry.save_exp end - docs.each_pair do |schema_id, entry| - entry.compile - end + # DISABLING FOLLOWING CODE AS MISCONCEIVED. THE SCHEMA DOCUMENTS + # BELONG IN THE MAIN COLLECTION NOT HERE + #docs.each_pair do |schema_id, entry| + # entry.compile + #end # TODO: make this parallel # Utils.log"Starting Ractor processing" From 10f4d272aa8314ba37c78809439ed1e1e92060e3 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Mon, 10 Jun 2024 00:19:31 +1000 Subject: [PATCH 2/3] https://github.com/metanorma/iso-10303/issues/41 --- lib/suma/processor.rb | 2 +- lib/suma/schema_collection.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/suma/processor.rb b/lib/suma/processor.rb index e013007..295bf66 100644 --- a/lib/suma/processor.rb +++ b/lib/suma/processor.rb @@ -92,7 +92,7 @@ def run(metanorma_yaml_path:, schemas_all_path:, compile:, output_directory: "_s Utils.log "Compiling complete collection..." # TODO: Why will defining a collection immediately compile?? - metanorma_collection = Metanorma::Collection.parse(collection_config_path) + metanorma_collection = Metanorma::Collection.parse(new_collection_config_path) # TODO: Somehow this is no longer used collection_opts = { diff --git a/lib/suma/schema_collection.rb b/lib/suma/schema_collection.rb index ea2212b..99dbadc 100644 --- a/lib/suma/schema_collection.rb +++ b/lib/suma/schema_collection.rb @@ -80,9 +80,9 @@ def compile # DISABLING FOLLOWING CODE AS MISCONCEIVED. THE SCHEMA DOCUMENTS # BELONG IN THE MAIN COLLECTION NOT HERE - #docs.each_pair do |schema_id, entry| - # entry.compile - #end + docs.each_pair do |schema_id, entry| + entry.compile + end # TODO: make this parallel # Utils.log"Starting Ractor processing" From 21f476254d41f53fe91655de0ec3441bec9730a6 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Mon, 10 Jun 2024 00:25:17 +1000 Subject: [PATCH 3/3] https://github.com/metanorma/iso-10303/issues/41 --- lib/suma/collection_manifest.rb | 2 +- lib/suma/processor.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/suma/collection_manifest.rb b/lib/suma/collection_manifest.rb index 1e0c247..8f358d5 100644 --- a/lib/suma/collection_manifest.rb +++ b/lib/suma/collection_manifest.rb @@ -91,7 +91,7 @@ def expand_schemas_only(schema_output_path) CollectionManifest.new( identifier: schema.id, title: schema.id, - file: File.join(schema_output_path, "doc_#{schema.id}", fname), + file: File.join(schema_output_path, schema.id, "doc_#{fname}"), # schema_source: schema.path ) end diff --git a/lib/suma/processor.rb b/lib/suma/processor.rb index 295bf66..1553fc9 100644 --- a/lib/suma/processor.rb +++ b/lib/suma/processor.rb @@ -23,7 +23,7 @@ def run(metanorma_yaml_path:, schemas_all_path:, compile:, output_directory: "_s collection_config_path = site_config.metanorma.source.files.first collection_config = Suma::CollectionConfig.from_file(collection_config_path) collection_config.path = collection_config_path - collection_config.manifest.expand_schemas_only("plain_schemas") + collection_config.manifest.expand_schemas_only("schema_docs") exported_schema_config = collection_config.manifest.export_schema_config(schemas_all_path) exported_schema_config.path = schemas_all_path