Snipper

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Snipper

Postby Parahead » Tue Jul 12, 2005 8:30 am

The amount of threads with questions regarding different ways to snip a text field when (for example) doing a headline teaser with a read more link indicated to me that there was a demand for a more generic solution than all the different PerlCode solutions currently available.

So I looked around the forum and picked up different requests and created this addon. Most of the requests has been fulfilled, but I am certain there are some special cases that the addon doesn't cover. Anyway, this addon allows you to snip a field in a more advanced way than the basic snip method provided with Coranto.

You have two ways of snipping a field, either by counting characters and snip after the desired number of characters has been reached. Or snip a field based on the amount of words, so that after the desired number of words and when your other desired criterias (like respecting HTML) are fullfilled, the text is snipped.

Some features:
  • Snip by number of characters or words
  • Exact length snip or wait for the word to end (for character snipping)
  • Respect HTML tags when snipping (wait for opened ones to be closed)
  • Respect sentances when snipping (wait for . ! or ? before snipping)
  • Strip HTML tags or not
  • Choose to add dots or not to the snipped string

If you have any additional requests for how to snip a text, please post your ideas in this thread. Any feedback on what you think about it in general is much appreciated as well... Is the documentation OK?

Please note that I have done some testing, but the number of different scenarios for how to use this addon and the available options is quite extensive, so I wouldn´t be that surprised if I get some bugreport or 'strange' behaviour. If you think something is in error, please make a detailed report on your settings, the exact sniptag you use and the original text, the snipped text and what the desired/expected snip would be.

Download here!
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Esstee » Tue Jul 12, 2005 12:34 pm

FANTASTIC!

I feel kinda bad after all that work but I am very happy to see this.
will definatetly install and use.
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby bozoka45 » Wed Jul 13, 2005 1:28 am

This sounds pretty awesome. Just want to throw out there that it would be even better if you could snip by x amount of paragraphs (determined \n\n or <br><br>).
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Parahead » Wed Jul 13, 2005 6:35 am

Esstee wrote:I feel kinda bad after all that work but I am very happy to see this.
will definatetly install and use.
I can assure you, it really was not my intention to make you feel bad... ;-)

bozoka45 wrote:This sounds pretty awesome. Just want to throw out there that it would be even better if you could snip by x amount of paragraphs (determined \n\n or <br><br>).
Yes, a good suggestion and I would say that a paragraph is also determined with pairs of <p></p>. Maybe I could create a new snip for that called "ParaSnip"... :roll:
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby LoneOwl » Wed Jul 13, 2005 12:11 pm

Hmmm.... Parahead....Parasnip.....Paraheadsnip...... Seems someone forgot to tip his executioner.

Anyway, I think somewhere in the forums(and I'm not too eager to search(which by the way, is there a way to search for all posts by someone that includes code tags?)), I posted something to do just that, snip by paragraphs. Or it had something to do with paragraphs...

Also, most people probably either use <p>, <br><br> or \n\n, and rarely a single <br> or \n, so you could just use split with all four options, and just split it easily. Probably be the simplest one of the snips.
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Parahead » Wed Jul 13, 2005 12:46 pm

LoneOwl wrote:Hmmm.... Parahead....Parasnip.....Paraheadsnip...... Seems someone forgot to tip his executioner.
Chop, chop, headchop?

LoneOwl wrote:Anyway, I think somewhere in the forums(and I'm not too eager to search(which by the way, is there a way to search for all posts by someone that includes code tags?)), I posted something to do just that, snip by paragraphs. Or it had something to do with paragraphs...
I guess it is this one you think about. Will check it out and see if it can be tweaked...

LoneOwl wrote:Also, most people probably either use <p>, <br><br> or \n\n, and rarely a single <br> or \n, so you could just use split with all four options, and just split it easily. Probably be the simplest one of the snips.
I will do some testing with this, maybe one should have it optional to define "what is a paragraph"...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby bozoka45 » Wed Jul 13, 2005 6:20 pm

I had a few more ideas while you're in there messing with the code. Do it all at once, eh? ;)

Split by a user-defined character. That way I can tell users to just use [split] Or something like that, sometimes paragraphs are too short and will show up odd on a page because the "teaser" is too short. And, there could be checkbox (on off) to validate that the user has entered the [split] tag. If its on and the user hasn't used the user-defined character, then the user should get an error (Look at the required-if addon).
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Parahead » Wed Jul 13, 2005 8:21 pm

bozoka45 wrote:Split by a user-defined character. That way I can tell users to just use [split] Or something like that, sometimes paragraphs are too short and will show up odd on a page because the "teaser" is too short.
Yes, this could be implemented. Do you think it would render a tag of its own, somthing like <CustomSplit Field: Text SplitBy: [split]> (just from the top of my head), or do you have some other suggestion for how it would work from a users perspective?

bozoka45 wrote:And, there could be checkbox (on off) to validate that the user has entered the [split] tag. If its on and the user hasn't used the user-defined character, then the user should get an error (Look at the required-if addon).
Check out the field validation feature in the CustomFields addon, you can achive this with that addon already. Not the exact same way as you describe with a checkbox but the result would be the same.
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby bozoka45 » Thu Jul 14, 2005 3:24 am

Thats true, a CustomFields regex could due the validation trick, eh? Might make a good note in documentation.

I was thinking something in the settings, where a user would just specify what the split delimiter is (more user-friendly), but <CustomSplit Field: Text SplitBy: [split]> is more flexible.

I'd go with the User-friendly approach, personally.

BTW, this addon should work great with Maginot when a teaser is needed that isn't an original teaser, but a "split" of the news item.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Parahead » Thu Jul 14, 2005 5:54 am

bozoka45 wrote:Thats true, a CustomFields regex could due the validation trick, eh? Might make a good note in documentation.
The documentation already contains an regex example for how to test if a field contains a first and last name. I thought it kind of obvious that anything you can do in Perl can be done to test what field contains since it is done through a sub. As a more advanced example, you can first validate that a URL is correct in syntax using regex and then validate the actual link using the LWP::UserAgent module.

bozoka45 wrote:I was thinking something in the settings, where a user would just specify what the split delimiter is (more user-friendly), but <CustomSplit Field: Text SplitBy: [split]> is more flexible.

I'd go with the User-friendly approach, personally.
Have you installed the addon? For the current sniptags it contains both a settings page where you can define the default values if none is provided when used in the actual style. A similar approach would be done for this then, being both user-friendly and flexible...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby bozoka45 » Thu Jul 14, 2005 10:15 pm

I meant I thought it would be a good idea to include in the Snipper docs that CustomFields validation can be used. Thats what I meant.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Parahead » Fri Jul 15, 2005 2:07 pm

bozoka45 wrote:I meant I thought it would be a good idea to include in the Snipper docs that CustomFields validation can be used. Thats what I meant.
Aha, sorry. :oops: Well, when I include the CustomSnip tag a small note about this could be added, no problem...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Parahead » Fri Jan 06, 2006 8:38 am

Version 1.0.1 is released of this addon which is a bugfix version that takes care of the problem reported in this thread. Same download link as previously...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

<SNIP>

Postby diogenes2100 » Sat Apr 15, 2006 7:50 am

Hi,

Snipping by number of words or characters seems complicated.

Is there any way to just add a simple tag like <SNIP> at the point I want the text to end on the front page, with an automatically created link to the full story which would be a Maginot static page?
User avatar
diogenes2100
 
Posts: 21
Joined: Mon Mar 14, 2005 6:33 pm
Location: Florida

Re: <SNIP>

Postby Parahead » Sat Apr 15, 2006 5:40 pm

diogenes2100 wrote:Is there any way to just add a simple tag like <SNIP> at the point I want the text to end on the front page, with an automatically created link to the full story which would be a Maginot static page?
Have you searched the forum? The ins and outs of snipping has been covered many times before, take a look at this thread and also the threads linked to in that thread for example...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Next

Return to Addon Release and Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron