Replies: 1 comment
-
|
As a little proof-of-concept, this money-patch does roughly what I want, at least for HTML and PDF export from def transform_node(
traceability_index: TraceabilityIndex, node: SDocNode, content_field: SDocNodeField
) -> SDocNodeField:
if node.node_type == "TRACETABLE":
return SDocNodeField.create_from_string(node, content_field.field_name, "EDITED", True)
return content_field
def install_node_transform_patch(
callback: Callable[[TraceabilityIndex, SDocNode, SDocNodeField], SDocNodeField]
) -> None:
original = MarkupRenderer.render_node_field
def render_node_field(
self, document_type: DocumentType, node_field: SDocNodeField
) -> Markup:
node = node_field.parent
if node is not None and node_field == node.get_content_field():
node_field = callback(self.traceability_index, node, node_field)
return original(self, document_type, node_field)
setattr(MarkupRenderer, "render_node_field", render_node_field)
def main() -> None:
install_node_transform_patch(transform_node)
# Defer import so the patch is installed before command execution starts.
from strictdoc.cli.main import _main
_main()
if __name__ == "__main__":
main() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm evaluating StrictDoc for use within my company, and one of the pieces we're missing is the ability to create various custom traceability / coverage tables, embedded into documents (along with other content).
My ideal end result would be:
TRACE_TABLE.CONTENTcontains an e.g. YAML description of the trace table I want: parent doc, child doc, any intermediate docs, fields to show, etc etc.The sorts of tables we need can be quite custom, and it wouldn't make sense to bake their logic into StrictDoc itself.
Therefore, a nice approach might be to use the existing plugin architecture. I was imagining something like either:
TraceabilityIndex, and can make edits to individualSDocNodes, or:SDocNode/SDocNodeField, is passed theTraceabilityIndexand thatSDocNode, and can return a replacementSDocNode/SDocNodeFieldto render.In both of these cases, the plugin would be able to locate and parse my custom elements, and transform the content into whatever ReST I want to render.
Do you think this would be a viable approach which you would be prepared to accept? I'd be happy to implement it.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions