diff --git a/lib/suma/collection_manifest.rb b/lib/suma/collection_manifest.rb index 8b3cbd3..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 @@ -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..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 @@ -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| @@ -86,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 200c401..99dbadc 100644 --- a/lib/suma/schema_collection.rb +++ b/lib/suma/schema_collection.rb @@ -78,6 +78,8 @@ def compile entry.save_exp 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