Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Splitting long text for Template

by Bod (Parson)
on Feb 08, 2021 at 17:45 UTC ( [id://11128083]=note: print w/replies, xml ) Need Help??


in reply to Re: Splitting long text for Template
in thread Splitting long text for Template

I have an app where the shortened “preview” can be supplied by the article author or editor

The code in the question was significantly cut down to get to the core of the problem. In the actual implementation, there are two blocks of text. One is a preview and the other is the main text. It is the preview that we need to be able to toggle between just an extract and the full copy. Although even here I missed a bit out. The creator of the text can add a <split> tag to control where the block of text is split. In reality, this is not often used but it will remain in the refactored, templated code.

Thanks for sharing - that gives me more food for thought.

Replies are listed 'Best First'.
Re^3: Splitting long text for Template
by Radiola (Monk) on Feb 08, 2021 at 18:04 UTC

    Cool, that's very much the kind of thing I'm doing too. My logic goes:

    preview = pre-written preview || split-with-tag preview || generated preview

    The preview method (well, _build_preview — it's Moo) figures that all out so the Template only has to call one method and display what it's given.

    – Aaron
    Preliminary operational tests were inconclusive. (The damn thing blew up.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128083]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-19 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found