Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rt iso 10303 issue 65 #4

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading