Skip to content

mtconnect/MtconnectTranspiler.Sinks.ScribanTemplates

Publish to NuGet.org

MtconnectTranspiler.Sinks.ScribanTemplates

Welcome to the MtconnectTranspiler.Sinks.ScribanTemplates repository, an abstract sink implementation designed to facilitate file generation using the MtconnectTranspiler framework and the Scriban templating engine. This library serves as a foundation for developers looking to create custom ITranspilerSink implementations, leveraging the powerful Scriban syntax to generate files from the deserialized SysML model provided by the MtconnectTranspiler library.

Overview

The MtconnectTranspiler framework enables the deserialization of SysML models into a structured, object-oriented format conducive for further processing. The MtconnectTranspiler.Sinks.ScribanTemplates library extends this capability by providing a template-based approach to generating output files, making it an ideal starting point for developers wishing to create custom outputs from the SysML model, such as code files, documentation, or configuration files.

Utilizing Scriban, a fast, powerful, and versatile templating engine (https://github.com/scriban/scriban), this library offers an "Abstract Sink" which developers can reference to complete the implementation of the ITranspilerSink interface defined in the MtconnectTranspiler project.

Key Features

  • Scriban Templating: Leverages Scriban's templating engine to transform the deserialized SysML model into various output formats.
  • Abstract Sink Implementation: Provides a skeletal framework that developers can extend to implement the ITranspilerSink interface, tailored to their specific output requirements.
  • Example-Driven: Illustrated through the MtconnectTranspiler.Sinks.CSharp repository, demonstrating a practical implementation of generating C# code.

Getting Started

To utilize the MtconnectTranspiler.Sinks.ScribanTemplates in your project, follow these steps:

  1. Prerequisites:

    • Familiarity with the MtconnectTranspiler framework and its capabilities.
    • Basic understanding of Scriban's templating syntax.
  2. Installation:

    • Clone this repository into your project.
    • Ensure you have the MtconnectTranspiler library and Scriban installed and configured in your development environment.
  3. Creating Your Custom Sink:

    • Extend the abstract classes provided by this library to implement your own ITranspilerSink.
    • Utilize Scriban templates to define the output structure for your specific use case.
  4. Integration:

    • Integrate your custom sink with the MtconnectTranspiler framework to start generating output from SysML models.

Usage Example

This section would provide a simple example of extending the MtconnectTranspiler.Sinks.ScribanTemplates abstract sink to create a custom implementation. It will demonstrate how to define a Scriban template and use it to generate output files.

(Example code and instructions would go here)

Contributing

Contributions to the MtconnectTranspiler.Sinks.ScribanTemplates library are welcome! Please read our contributing guidelines for more information on how to report issues, submit pull requests, and contribute to the library's development.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

Acknowledgments

  • The MtconnectTranspiler project for providing the framework for deserializing SysML models.
  • The Scriban project for offering a versatile templating engine.