Skip to content

Commit

Permalink
Merge pull request #4 from metanorma/rt-iso-10303-issue-65
Browse files Browse the repository at this point in the history
Rt iso 10303 issue 65
  • Loading branch information
opoudjis authored Jun 12, 2024
2 parents 5535980 + 25ae99a commit 2a35575
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/suma/collection_manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 8 additions & 2 deletions lib/suma/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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|
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 2 additions & 0 deletions lib/suma/schema_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a35575

Please sign in to comment.