Incorrectly truncated text parsing

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 206,
                    "module": "util:ComposeTransformer",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "value": "[SLUG]ghana-cocoa-supply-shortfall-impacts-traders[/SLUG]\n\n[TITLE]Sweet Trouble: Ghana's Cocoa Shortfall Leaves Traders in a Bitter Spot[/TITLE]\n\n[EXCERPT]Ghana's cocoa bean delivery hiccup has traders facing a whopping $1 billion loss. Here's what happened and why it matters for your morning mocha.[/EXCERPT]\n\n[BODY]\n<p>Hey there, chocolate lovers and market watchers! Grab your favorite cocoa-based snack because we've got some news that might make your wallet feel a little lighter (but hopefully not your candy bar).</p>\n\n<h2>The Scoop on the Cocoa Chaos</h2>\n\n<p>Reuters just dropped an exclusive report that's shaking up the cocoa world. Here's what you need to know:</p>\n\n<ul>\n<li>🍫 Trading houses are staring down the barrel of a $1 billion loss. Ouch!</li>\n<li>🇬🇭 Ghana, a major cocoa producer, couldn't deliver the beans this year. Talk about a supply chain hiccup!</li>\n<li>📉 Traders had to scramble to cover their positions in a market that's been heading up, up, up.</li>\n</ul>\n\n<h2>Why This Matters</h2>\n\n<p>You might be thinking, \"So what? I'm not a cocoa trader.\" But hold on to your chocolate bars, because this could affect more than just the folks in fancy suits:</p>\n\n<ul>\n<li>🍪 Your favorite treats might get pricier. When cocoa costs more, so does everything made with it.</li>\n<li>💼 It's a wake-up call for how vulnerable global supply chains can be.</li>\n<li>🌍 This could impact Ghana's economy and potentially other cocoa-producing nations.</li>\n</ul>\n\n<h2>Market Impact: More Than Just a Hill of Beans</h2>\n\n<p>Let's break down what this cocoa conundrum could mean for the markets:</p>\n\n<ul>\n<li>📈 Cocoa futures are likely to stay volatile. Keep an eye on the iPath Bloomberg Cocoa Subindex Total Return ETN (NIB) if you're into that sort of thing.</li>\n<li>🍫 Big chocolate producers like Hershey (HSY) and Mondelez (MDLZ) might see their costs go up, which could squeeze their profits.</li>\n<li>🚜 Agricultural commodity traders like Archer-Daniels-Midland (ADM) could face some headwinds.</li>\n<li>🌱 This might boost interest in alternative sweeteners and plant-based chocolate substitutes. Companies in this space could see increased attention.</li>\n</ul>\n\n<p>So there you have it, folks. A billion-dollar bean blunder that's got traders sweating and could have us all digging a little deeper for our chocolate fix. Keep your eyes peeled for how this plays out – it's sure to be a wild ride in the world of cocoa!</p>\n[/BODY]\n\n[CATEGORIES]Finance,Commodities,Global Trade[/CATEGORIES]\n\n[TAGS]cocoa,Ghana,commodities,trading,supplychain,chocolate[/TAGS]"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1242,
                            "y": -2940
                        },
                        "restore": {},
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ]
                    }
                },
                {
                    "id": 207,
                    "module": "regexp:Parser",
                    "version": 1,
                    "parameters": {
                        "pattern": "\\[(?<tag>[^\\]]+)]\\s*(?<content>[\\w\\W]+?)\\s*\\[\\/\\1]",
                        "global": true,
                        "sensitive": true,
                        "multiline": false,
                        "singleline": false,
                        "continueWhenNoRes": false,
                        "ignoreInfiniteLoopsWhenGlobal": false
                    },
                    "mapper": {
                        "text": "{{206.value}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1488,
                            "y": -2940
                        },
                        "restore": {
                            "parameters": {
                                "sensitive": {
                                    "collapsed": true
                                },
                                "multiline": {
                                    "collapsed": true
                                },
                                "singleline": {
                                    "collapsed": true
                                },
                                "continueWhenNoRes": {
                                    "collapsed": true
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "pattern",
                                "type": "text",
                                "label": "Pattern",
                                "required": true
                            },
                            {
                                "name": "global",
                                "type": "boolean",
                                "label": "Global match",
                                "required": true
                            },
                            {
                                "name": "sensitive",
                                "type": "boolean",
                                "label": "Case sensitive",
                                "required": true
                            },
                            {
                                "name": "multiline",
                                "type": "boolean",
                                "label": "Multiline",
                                "required": true
                            },
                            {
                                "name": "singleline",
                                "type": "boolean",
                                "label": "Singleline",
                                "required": true
                            },
                            {
                                "name": "continueWhenNoRes",
                                "type": "boolean",
                                "label": "Continue the execution of the route even if the module finds no matches",
                                "required": true
                            },
                            {
                                "name": "ignoreInfiniteLoopsWhenGlobal",
                                "type": "boolean",
                                "label": "Ignore errors when there is an infinite search loop",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "text",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "interface": [
                            {
                                "type": "text",
                                "name": "tag",
                                "label": "tag"
                            },
                            {
                                "type": "text",
                                "name": "content",
                                "label": "content"
                            },
                            {
                                "type": "uinteger",
                                "name": "i",
                                "label": "i"
                            },
                            {
                                "type": "any",
                                "name": "__IMTMATCH__",
                                "label": "Fallback Match"
                            }
                        ]
                    }
                },
                {
                    "id": 208,
                    "module": "builtin:BasicAggregator",
                    "version": 1,
                    "parameters": {
                        "feeder": 207
                    },
                    "mapper": {
                        "tag": "{{207.tag}}",
                        "content": "{{207.content}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1731,
                            "y": -2940
                        },
                        "restore": {
                            "extra": {
                                "feeder": {
                                    "label": "Text parser - Match pattern [207]"
                                },
                                "target": {
                                    "label": "Custom"
                                }
                            }
                        }
                    }
                },
                {
                    "id": 209,
                    "module": "util:SetVariable2",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "name": "variables",
                        "scope": "roundtrip",
                        "value": "{{toCollection(208.array; \"tag\"; \"content\")}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1976,
                            "y": -2941
                        },
                        "restore": {
                            "expect": {
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Variable name",
                                "required": true
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            },
                            {
                                "name": "value",
                                "type": "any",
                                "label": "Variable value"
                            }
                        ],
                        "interface": [
                            {
                                "name": "variables",
                                "label": "variables",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

Hope this helps! Let me know if there are any further questions or issues.

@samliew

1 Like