Skip to content

Commit

Permalink
A little naming cleanup in NGTemplateParserProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
hugithordarson committed Nov 17, 2024
1 parent 9cc7322 commit 532abca
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public NGElement parse() throws NGDeclarationFormatException, NGHTMLFormatExcept
private static NGElement toDynamicElement( final PNode node ) {
return switch( node ) {
case PBasicNode n -> toDynamicElement( n.tag() );
case PGroupNode n -> new NGDynamicGroup( null, null, template( n.children() ) );
case PGroupNode n -> childrenToTemplate( n.children() );
case PHTMLNode n -> new NGHTMLBareString( n.value() );
case PCommentNode n -> new NGHTMLCommentString( n.value() );
};
}

private static NGElement toDynamicElement( final NGDynamicHTMLTag tag ) {
try {
return NGApplication.dynamicElementWithName( tag.declaration().type(), toAssociations( tag.declaration() ), template( tag.childrenWithStringsProcessedAndCombined() ), Collections.emptyList() );
return NGApplication.dynamicElementWithName( tag.declaration().type(), associationsFromDeclaration( tag.declaration() ), childrenToTemplate( tag.childrenWithStringsProcessedAndCombined() ), Collections.emptyList() );
}
catch( NGElementNotFoundException e ) {
// FIXME:
Expand All @@ -63,7 +63,7 @@ private static NGElement toDynamicElement( final NGDynamicHTMLTag tag ) {
}
}

private static Map<String, NGAssociation> toAssociations( final NGDeclaration declaration ) {
private static Map<String, NGAssociation> associationsFromDeclaration( final NGDeclaration declaration ) {
final Map<String, NGAssociation> associations = new HashMap<>();

for( Entry<String, NGBindingValue> entry : declaration.bindings().entrySet() ) {
Expand All @@ -76,7 +76,7 @@ private static Map<String, NGAssociation> toAssociations( final NGDeclaration de
/**
* @return The tag's template
*/
private static NGElement template( final List<PNode> children ) {
private static NGElement childrenToTemplate( final List<PNode> children ) {

// FIXME: Children should never really be null. I'm still hesitant to replace it with an empty list though, since in my mind that represents an empty container tag. Food for thought... // Hugi 2024-11-15
if( children == null ) {
Expand Down

0 comments on commit 532abca

Please sign in to comment.