@@ -537,7 +537,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
537537 } ,
538538 // 11: Switch (closed → count, open → max(count - 1, 1) as denominator)
539539 DocumentNode {
540- implementation: DocumentNodeImplementation :: ProtoNode ( logic :: switch:: IDENTIFIER ) ,
540+ implementation: DocumentNodeImplementation :: ProtoNode ( math_nodes :: switch:: IDENTIFIER ) ,
541541 inputs: vec![ NodeInput :: node( NodeId ( 10 ) , 0 ) , NodeInput :: node( NodeId ( 17 ) , 0 ) , NodeInput :: node( NodeId ( 18 ) , 0 ) ] ,
542542 ..Default :: default ( )
543543 } ,
@@ -1489,6 +1489,113 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
14891489 description: Cow :: Borrowed ( "TODO" ) ,
14901490 properties: None ,
14911491 } ,
1492+ DocumentNodeDefinition {
1493+ identifier: "Regex Find" ,
1494+ category: "Text: Regex" ,
1495+ node_template: NodeTemplate {
1496+ document_node: DocumentNode {
1497+ implementation: DocumentNodeImplementation :: Network ( NodeNetwork {
1498+ exports: vec![
1499+ // Primary output: the whole match (String)
1500+ NodeInput :: node( NodeId ( 1 ) , 0 ) ,
1501+ // Secondary output: capture groups (Vec<String>)
1502+ NodeInput :: node( NodeId ( 2 ) , 0 ) ,
1503+ ] ,
1504+ nodes: [
1505+ // Node 0: regex_find proto node — returns Vec<String> of [whole_match, ...capture_groups]
1506+ DocumentNode {
1507+ inputs: vec![
1508+ NodeInput :: import( concrete!( String ) , 0 ) ,
1509+ NodeInput :: import( concrete!( String ) , 1 ) ,
1510+ NodeInput :: import( concrete!( f64 ) , 2 ) ,
1511+ NodeInput :: import( concrete!( bool ) , 3 ) ,
1512+ NodeInput :: import( concrete!( bool ) , 4 ) ,
1513+ ] ,
1514+ implementation: DocumentNodeImplementation :: ProtoNode ( text_nodes:: regex:: regex_find:: IDENTIFIER ) ,
1515+ ..Default :: default ( )
1516+ } ,
1517+ // Node 1: index_elements at index 0 — extracts the whole match as a String
1518+ DocumentNode {
1519+ inputs: vec![ NodeInput :: node( NodeId ( 0 ) , 0 ) , NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ] ,
1520+ implementation: DocumentNodeImplementation :: ProtoNode ( graphic:: index_elements:: IDENTIFIER ) ,
1521+ ..Default :: default ( )
1522+ } ,
1523+ // Node 2: omit_element at index 0 — returns capture groups as Vec<String>
1524+ DocumentNode {
1525+ inputs: vec![ NodeInput :: node( NodeId ( 0 ) , 0 ) , NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ] ,
1526+ implementation: DocumentNodeImplementation :: ProtoNode ( graphic:: omit_element:: IDENTIFIER ) ,
1527+ ..Default :: default ( )
1528+ } ,
1529+ ]
1530+ . into_iter( )
1531+ . enumerate( )
1532+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
1533+ . collect( ) ,
1534+ ..Default :: default ( )
1535+ } ) ,
1536+ inputs: vec![
1537+ NodeInput :: value( TaggedValue :: String ( String :: new( ) ) , true ) ,
1538+ NodeInput :: value( TaggedValue :: String ( String :: new( ) ) , false ) ,
1539+ NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ,
1540+ NodeInput :: value( TaggedValue :: Bool ( false ) , false ) ,
1541+ NodeInput :: value( TaggedValue :: Bool ( false ) , false ) ,
1542+ ] ,
1543+ ..Default :: default ( )
1544+ } ,
1545+ persistent_node_metadata: DocumentNodePersistentMetadata {
1546+ input_metadata: vec![
1547+ ( "String" , "The string to search within." ) . into( ) ,
1548+ ( "Pattern" , "The regular expression pattern to search for." ) . into( ) ,
1549+ (
1550+ "Match Index" ,
1551+ "Which non-overlapping occurrence of the pattern to return, starting from 0 for the first match. Negative indices count backwards from the last match." ,
1552+ )
1553+ . into( ) ,
1554+ ( "Case Insensitive" , "Match letters regardless of case." ) . into( ) ,
1555+ ( "Multiline" , "Make `^` and `$` match the start and end of each line, not just the whole string." ) . into( ) ,
1556+ ] ,
1557+ output_names: vec![ "Match" . to_string( ) , "Captures" . to_string( ) ] ,
1558+ network_metadata: Some ( NodeNetworkMetadata {
1559+ persistent_metadata: NodeNetworkPersistentMetadata {
1560+ node_metadata: [
1561+ DocumentNodeMetadata {
1562+ persistent_metadata: DocumentNodePersistentMetadata {
1563+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 0 , 0 ) ) ,
1564+ ..Default :: default ( )
1565+ } ,
1566+ ..Default :: default ( )
1567+ } ,
1568+ DocumentNodeMetadata {
1569+ persistent_metadata: DocumentNodePersistentMetadata {
1570+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 8 , 0 ) ) ,
1571+ ..Default :: default ( )
1572+ } ,
1573+ ..Default :: default ( )
1574+ } ,
1575+ DocumentNodeMetadata {
1576+ persistent_metadata: DocumentNodePersistentMetadata {
1577+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 8 , 2 ) ) ,
1578+ ..Default :: default ( )
1579+ } ,
1580+ ..Default :: default ( )
1581+ } ,
1582+ ]
1583+ . into_iter( )
1584+ . enumerate( )
1585+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
1586+ . collect( ) ,
1587+ ..Default :: default ( )
1588+ } ,
1589+ ..Default :: default ( )
1590+ } ) ,
1591+ ..Default :: default ( )
1592+ } ,
1593+ } ,
1594+ description: Cow :: Borrowed (
1595+ r#"Finds a portion of the string matching a regular expression pattern. With "Match Index" at its default 0, it selects the first non-overlapping occurrence, but others may be selected. Capture groups, if any, are produced as a list in the "Captures" output."# ,
1596+ ) ,
1597+ properties: None ,
1598+ } ,
14921599 // Aims for interoperable compatibility with:
14931600 // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=levl%27%20%3D%20Levels-,%27curv%27%20%3D%20Curves,-%27expA%27%20%3D%20Exposure
14941601 // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Max%20input%20range-,Curves,-Curves%20settings%20files
@@ -2035,6 +2142,8 @@ fn static_node_properties() -> NodeProperties {
20352142 map. insert ( "selective_color_properties" . to_string ( ) , Box :: new ( node_properties:: selective_color_properties) ) ;
20362143 map. insert ( "exposure_properties" . to_string ( ) , Box :: new ( node_properties:: exposure_properties) ) ;
20372144 map. insert ( "math_properties" . to_string ( ) , Box :: new ( node_properties:: math_properties) ) ;
2145+ map. insert ( "format_number_properties" . to_string ( ) , Box :: new ( node_properties:: format_number_properties) ) ;
2146+ map. insert ( "string_capitalization_properties" . to_string ( ) , Box :: new ( node_properties:: string_capitalization_properties) ) ;
20382147 map. insert ( "rectangle_properties" . to_string ( ) , Box :: new ( node_properties:: rectangle_properties) ) ;
20392148 map. insert ( "grid_properties" . to_string ( ) , Box :: new ( node_properties:: grid_properties) ) ;
20402149 map. insert ( "spiral_properties" . to_string ( ) , Box :: new ( node_properties:: spiral_properties) ) ;
0 commit comments