@@ -50,29 +50,34 @@ public NGElement parse() throws NGDeclarationFormatException, NGHTMLFormatExcept
5050
5151 private static NGElement toDynamicElement ( final PNode node ) {
5252 return switch ( node ) {
53- case PBasicNode n -> toDynamicElement ( n . tag () );
53+ case PBasicNode n -> toDynamicElement ( n );
5454 case PGroupNode n -> toTemplate ( n .children () );
5555 case PHTMLNode n -> new NGHTMLBareString ( n .value () );
5656 case PCommentNode n -> new NGHTMLCommentString ( n .value () );
5757 };
5858 }
5959
60- private static NGElement toDynamicElement ( final NGDynamicHTMLTag tag ) {
60+ private static NGElement toDynamicElement ( final PBasicNode node ) {
61+
62+ final String type = node .type ();
63+ final Map <String , NGAssociation > associations = associationsFromDeclaration ( node .bindings (), node .isInline () );
64+ final NGElement childTemplate = toTemplate ( node .children () );
65+
6166 try {
62- return NGApplication .dynamicElementWithName ( tag . declaration (). type (), associationsFromDeclaration ( tag . declaration () ), toTemplate ( tag . childrenWithStringsProcessedAndCombined () ) , Collections .emptyList () );
67+ return NGApplication .dynamicElementWithName ( type , associations , childTemplate , Collections .emptyList () );
6368 }
6469 catch ( NGElementNotFoundException e ) {
6570 // FIXME: Experimental functionality, probably doesn't belong with the parser part of the framework.
6671 // But since it's definitely something we want, I'm keeping this here for reference until it finds it's final home. // Hugi 2024-10-19
67- return new NGElementNotFoundElement ( tag . declaration (). type () );
72+ return new NGElementNotFoundElement ( type );
6873 }
6974 }
7075
71- private static Map <String , NGAssociation > associationsFromDeclaration ( final NGDeclaration declaration ) {
76+ private static Map <String , NGAssociation > associationsFromDeclaration ( final Map < String , NGBindingValue > bindings , final boolean isInline ) {
7277 final Map <String , NGAssociation > associations = new HashMap <>();
7378
74- for ( Entry <String , NGBindingValue > entry : declaration . bindings () .entrySet () ) {
75- associations .put ( entry .getKey (), NGAssociationFactory .toAssociation ( entry .getValue (), declaration . isInline () ) );
79+ for ( Entry <String , NGBindingValue > entry : bindings .entrySet () ) {
80+ associations .put ( entry .getKey (), NGAssociationFactory .toAssociation ( entry .getValue (), isInline ) );
7681 }
7782
7883 return associations ;
0 commit comments