Is there an easy way to create individual snippets in spring-restdocs? - spring-restdocs

I just dived into spring-restdocs and i really like the way how to document my API. Now I would like to extend the generated examples by python. Means I want snippets like the curl ones just for python.
this is what I found out so far:
I will have to create my own template like default-curl-request.snippet. Is it right that is followed by extending my own implementation by org.springframework.restdocs.snippet.TemplatedSnippet?

If you want to use a template to generate the snippet then what you have described is the right approach to take.
Note that you don't have to use a template. You could opt to implement the Snippet interface directly and you're then free to generate a snippet using any means you like. Here's a snippet implementation from a third-party extensions that takes this approach.

Related

Confluence Macro: How to include content

There are these two macros available in Confluence: Excerpt Macro and Excerpt Include Macro, but these are somewhat limited.
I created my own User Macro to extend the existing Excerpt Macro in a way that I can add some parameters to the excerpt, like ID, etc.
I am also able to get the content from my macro via the REST api in my code, which is cool.
BUT, I am unable to find a way to get the content and include it into another page via another macro.
In other words, I am trying to figure out a way to create my own User Macro to extend the existing Excerpt Include Macro.
Is there a way to see the Template content for these existing Confluence Macros, or is there a way to have a User Macro include some content from some other page?
This is not your exact answer, but there is a plug-in multiexcerpt which probably does exactly what you are looking for.

How to add a template in to Symphony projects

I am new in Symphony and would like to add a new design. Here I have attached the file which I want to integrate in the user side. How is this possible?!
You'll need to use templates. Make sure you read through that page.
Chapter 2 of the Say Hello to Symphony tutorial deals with templates, and is a nice way of getting to grips with how it works.
Hopefully this will give the basic idea of how to control the HTML output using XSLT. You will then need to create your CSS to style your HTML.

How to extract labels from Symfony forms I18n Extract Task

I am quite aware that the extract task accepts application as a parameter, and thus one can't expect it too look into the forms folder.
However, I referred the link (below) and tried a couple of ways:
1. defining my proxy __() method
2. including the I18n helper in App Configuration
However, both aren't working.
Can anyone tell me how to extract these from the form classes?
Thanks
http://groups.google.com/group/symfony-devs/browse_thread/thread/1d034f5f7367fe0c
You need to use the i18n helper and add the translated strings manually to your XML/XLIFF files. The translations themselves work, it's just the i18n:extract task that doesn't look inside form classes so it has to be done manually. I hope they add this feature in Symfony 2.0.
See the first few paragraphs here: http://www.symfony-project.org/forms/1_4/en/08-Internationalisation-and-Localisation
There's a way to extract it altough it's not recommended by the developers:
In lib/i18n/extract/sfI18nApplicationExtract.class.php add:
$this->extractFromPhpFiles(sfConfig::get('sf_lib_dir').'/form');
to function extract()
In your form class's configure method add:
sfLoader::loadHelpers('I18N');
This way you can use the __() function in your form class.
I'm currently testing it. Will share my findings.

Xcode/iPhone Code templates

Is there some tool in Xcode that allows me to store snippets of code I often reuse in various applications so I do not have to retype it each time? I am talking about things like all the code that goes into defining Table Delegate Methods and Table Source Methods, UIAlertViews code and such. I just would like to have my own private repository where I can put snippets of code I think I may need in the future in other apps. Is there anything like that? Thanks for any help.
I guess the answer to your need is discussed in this page http://www.turkeysheartrhinos.com/?p=8. Look at the "Custom TextMate – Like Macros" section.
In Interface Builder you can drag and drop components you've built into the library under the Custom Objects list. These can be reused in other XIBs you build later.
I'm not sure about code snippets in Xcode itself, I would find that useful too. If you are talking reuse though, can you put alot of your generic stuff in superclasses that you can inherit from when appropriate?
Try "Edit User Scripts..." under the script menu in Xcode. Look at the scripts under the "HeaderDoc" header to see some examples of inserting templates into code. You'll have to reformat your snippets into blocks of Perl like these, but this approach also gives you those neat tab-through-able input areas like you see when you autocomplete method calls.
How about using the tool "sinppets" ?

GOLD Parse, how do you actually implement your code?

I am not quite sure how to implement my the code after generating the skeleton. I didnt use const only, i do have main files and i tried several c(++) versions along with c# and still i dont understand. I dont think any of them can load a file and parse test files (i know gold builder can parse my test files).
The Kessels C skeleton looks complete. Buts not, it uses a struct and members (Token->Reduction->TokenStack) yet when i search TokenStack i cant find a place where it is defined, only used. I feel like i am missing something. I cant find Kessels other code anywhere.
My question is how do i implement my body? (is there another skeleton you prefer), are there any other downloads i overlooked? i tried looking at these downloads but i didnt understand what to do with them. It also looked more like example source code then a template http://www.devincook.com/goldparser/engine/c/index.htm
PS: I wouldnt mind doing a C# implementation, i am better with c(++).
I've used the Calitha C# Engine. Let me know (by posting a comment to this answer) if you still want an answer, which I can answer using my knowledge of this C# engine.
My question is how do i implement my body? (is there another skeleton you prefer), are there any other downloads i overlooked?
The Calitha Engine download includes source for the Engine, and a sample program (named "TextCalc") which illustrates using it.