Snippet Suggestions suggestions

This Forum is for General Issues about Analyzer
Post Reply
NorthEast
Master Propellus Maximus
Posts: 6363
Joined: Mon Mar 05, 2007 8:33 am

Snippet Suggestions suggestions

Post by NorthEast »

I've just been having a look at Analyser trial, and have a few comments on Snippet Suggestions.

1) Although you can insert 'block' or 'text' snippets, the suggestions only include snippets in 'block' mode. For example, if your snippet is in the middle of a paragraph, it won't find it.

2) Is it just me, or does the Snippet Suggestions not do as much as you expected?
The Snippet Suggestions feature seems to be a 'find and replace for snippets'. I was fully expecting this feature to scan my project and find repeated blocks of text that would benefit from the use of a snippet, i.e. actually suggest some new snippets that I could use. I don't know about anyone else, but if I've already set up a snippet, that means I've already identified a need for it in the first place and have started using it in my project.

(And the same applies for Variable Suggestions)
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Snippet Suggestions suggestions

Post by RamonS »

I haven't looked at Analyzer for a while, but I was also under the impression that this feature works the way you expect it. I also figured that this is one of the reasons for using a database. I guess it may be worthwhile the fine print as I doubt that the documentation states that it will generate snippet proposals.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Re: Snippet Suggestions suggestions

Post by Richard Ferrell »

Analyzer will scan your project for snippet suggestions, you may need to adjust the search size for the new snippets.
Richard Ferrell

Certified Madcap Trainer
Image
NealPozner
Propeller Head
Posts: 31
Joined: Wed Nov 22, 2006 3:58 pm
Location: The MadCave

Re: Snippet Suggestions suggestions

Post by NealPozner »

To clarify, to create snippets based on content, you will want to search for Frequent Phrases or Frequent Segments and create the snippets from the content. The Snippet Suggestions will allow you to replace content that is not snippets with snippets after they have been created.
Neal Pozner
Madcap Software
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Snippet Suggestions suggestions

Post by RamonS »

Wouldn't it be beneficial to wed those two features together? Or at least give an option to do so?
NorthEast
Master Propellus Maximus
Posts: 6363
Joined: Mon Mar 05, 2007 8:33 am

Re: Snippet Suggestions suggestions

Post by NorthEast »

Aha, I think I was expecting 'Snippet Suggestions' to include the job that 'Frequent Phrases' does.

For my first point, I'm assuming that not being able to find/replace 'text' snippets is a bug.
Gordo
Jr. Propeller Head
Posts: 7
Joined: Thu Aug 03, 2006 8:38 am

Re: Snippet Suggestions suggestions

Post by Gordo »

One possible reason why you are not getting the Snippet Suggestions that you might expect is that the snippet is more than just the text; it also includes tags. For this reason, there are two types of snippets in Flare: snippetText (inline) and snippetBlock

For example, if you create a new Snippet in Flare by selecting the Add Snippet option from the toolbar, you get the text "This is a snippet" inside of a p tag inside of a body tag (snippetBlock). If you create a sinlge line snippet using this method, and you do not unbind it from the p tag, when Analyzer offers Snippet Suggestions, it will only make suggestions which match existing content exactly. Therefore if the text "This is a snippet" appear inline somewhere (not bound by a p tag), no suggestion will be made.

In other words, Analyzer will only make suggestions for instances of:
<p>This is a snippet</p>
It will not offer a suggestion for:
<p>This is a snippet in my content.</p>
<p>This is a snippet.</p> (because of the period).

On the other hand, if you select some content inside of a paragraph without selecting the actual p tag, and select Create Snippet from the Format menu, Flare will create an inline snippet without a p tag (snippetText). If you create your snippet's with this method, you should get inline snippet suggestions. Alternatively, you could open the snippet with the p tag, select the p tag and Unbind the text from it. This would accomplish the same thing.

Hopefully this helps.

-G
NorthEast
Master Propellus Maximus
Posts: 6363
Joined: Mon Mar 05, 2007 8:33 am

Re: Snippet Suggestions suggestions

Post by NorthEast »

Cheers, that seemed to make sense initially, but after a few tests I'm still not sure I follow why it works this way.

If you create a snippet from the project menu, the default snippet template includes a p tag.
For example, let's say our snippet just contains <p>hello</p>

If you're going to try to insert this in Analyzer using Snippet Suggestions, it'll only work in the way that you mentioned - i.e. it'll only replace the snippet in block mode, so
- it'll replace a line that only has <p>hello</p>
- it won't replace 'hello' in the line <p>hello world</p>

Now, if I go into Flare and place my cursor in the middle of a paragraph and select Insert > Snippet, the same snippet (that can only be inserted in block mode in Analyzer) is inserted in inline mode. So, why can I insert the snippet in inline mode manually, but Analyzer cannot?
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Re: Snippet Suggestions suggestions

Post by Richard Ferrell »

When you insert a body snippet into the middle of a Paragraph the <P> tags will be stripped out. This is done to keep the XML correct as you can't have another <P> tag inside of a existing <P> tag.

If you are using a Block Snippet, Analyzer will not find the match in inline text. Our devlopers are aware of the issue and will see if this can be corrected in a future version of Analyzer.
Richard Ferrell

Certified Madcap Trainer
Image
NorthEast
Master Propellus Maximus
Posts: 6363
Joined: Mon Mar 05, 2007 8:33 am

Re: Snippet Suggestions suggestions

Post by NorthEast »

That's why I don't find it that intuitive.

I can manually replace a chunk of text in the middle of a paragraph with a block or inline snippet, whether the snippet includes <p> tags or not makes no difference to where I can use it.

However, Analyzer can only find/replace the same bit of text with an inline snippet that doesn't have <p> tags. I would expect it to be able to replace a snippet in the same way that I can manually.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Re: Snippet Suggestions suggestions

Post by Richard Ferrell »

edited my above post, on advice from our wonderful Developers!
Richard Ferrell

Certified Madcap Trainer
Image
lcharlesjohnson
Propeller Head
Posts: 39
Joined: Fri Nov 16, 2007 7:16 pm
Location: Northern Virginia
Contact:

Re: Snippet Suggestions suggestions

Post by lcharlesjohnson »

Hey!

Maybe I'm beating a dead horse here - and I apologize in advance if I am.

Here's the thing - I have this project that I imported from RH. It's UGLY and I'm trying to make it less so.

There is this one block (technically a table in a div tag) that came over from RH that I'd like to replace with a snippet....and this block is repeated in the project about 60 times or so. I guess Analyzer isn't finding it because I'm taking the info out of the table and presenting it differently in the snippet. Is that right? According to the Analyzer Help, "you can view content that matches existing snippets in your project..." But since I've changed the block of info from a table in a div tag to a numbered list - Analyzer won't find it?

Also - there are several other sections of text that appear again and again - and Analyzer is not picking up on these at all. I've attached a screenshot of what Analyzer has picked up as potential snippets - essentially empty p tags.

Is there something I'm doing wrong here? It's not making sense.

Laura
You do not have the required permissions to view the files attached to this post.
Laura Charles Johnson
MadCap Certified Advanced Developer and Instructor of Flare
http://flareforhelp.lauracjohnson.com
SteveS
Senior Propellus Maximus
Posts: 2089
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: Snippet Suggestions suggestions

Post by SteveS »

My guess is Analyzer is picking up the repaeating instances of a non-b reaking space and figures because you are using the same string so many times you might want to make it a snippet...

...I'd call it a bug.

You could do a find and replace and convert the non-breaking space to a normal space. Or, delete all the paragraphs that are just a non-breaking space (I'm assuming they're there to create whitespace between actual paragraphs) and adjust the top margin on your paragraph style to give you the lead you're after.

HTH
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Gordo
Jr. Propeller Head
Posts: 7
Joined: Thu Aug 03, 2006 8:38 am

Re: Snippet Suggestions suggestions

Post by Gordo »

What this screenshot is telling me is that you actually have a snippet in your project that contains nothing but a non-breaking space. Analyzer is suggesting that you replace all of the non-breaking spaces throughout your project with this snippet. You should be able to determine which snippet this is by widening the SnippetPath column.

The Snippet Suggestions pane in Analyzer does not suggest Snippets from frequently used phrases or segements. It suggests replacing content which matches (exactly) existing snippets with that snippet. So...

If you want to replace several instances of the same chunk of content with a snippet, you can do one of two things:
1) Use Analyzer's Frequent Phrase or Frequent Segments pane to find such instances and create a new snippet (you may need to adjust the properties for Frequent Phrases and Segements to produce the results you want)
1a) Now that the Snippet exists, the Snippet Suggestions pane will now provide a suggestion

2) In Flare, just find one instance of the content and create a snippet out of it
2a) Let Analyzer find the other instances for you with Snippet Suggestions

Also, keep in mind, that the content must match the snippet EXACTLY to produce a Snippet Suggestion. One problem I ran into was my accidental use of non-breaking spaces.
For example, if this is my snippet: <p>Mickey Mouse</p>
In my content, I have: <p>Mickey Mouse</p> (because I type too fast for my own good and sometimes enter non-breaking spaces where I shouldn't)

This will NOT produce a Snippet Suggestion because it is not an exact match. Any variance (even a single space or character) in the XML code will prevent a Snippet Suggestion from being presented. You may be able to find and clean up any inconsistencies using the Similar Segements tool in Analyzer.

--G
Post Reply