groue / GRMustache

Flexible and production-ready Mustache templates for MacOS Cocoa and iOS
http://mustache.github.com/
MIT License
1.44k stars 190 forks source link

How to add custom label instand of @"{{" and@ "}}" #96

Closed JokerXu closed 9 years ago

JokerXu commented 9 years ago

I want to define my custom label like . Because the server couldn't deliver me @"{{" or @"}}" because of it will mix the json data。 The server just give me the string like ,I want the GRMustache will repalce it with the string like bdec6160-513f-4f79-87ae-6fe623593933

Please forgive my terrible English.

groue commented 9 years ago

Hello @JokerXu.

Mustache is about injecting named values. For example: inject the number of players here, their names there, and their scores here. And those names must be enclosed in tags: {{playerCount}}, {{name}}, {{score}}.

You can use arbitrary strings for delimiting tags, instead of the default {{ and }}: <% name %>...<% score %>, or BEGIN name END...BEGIN score END.

So you have to ask yourself if this is what you want. Can you express your needs in terms of names and tags delimiters?

I'm not sure you can, because you ask for defining your "custom label".

So I'm wondering if the best tool for the job is -[NSString stringByReplacingOccurrencesOfString:withString:]: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html#//apple_ref/occ/instm/NSString/stringByReplacingOccurrencesOfString:withString:

Please investigate this simple solution.

JokerXu commented 9 years ago

Thank you very much. I know -[NSString stringByReplacingOccurrencesOfString:withString:]: But I think your tools is more efficiency than it at first...Now I figure out.. I am a Chinese .and I join in apple developer family less than two years.And my English is so terrible. Your this project is very efficacious to solve the problem for data and model to generate html string. However,your project lack of Chinese blog to tell us how to use it,in google,I can't find any useful Chinese blog. So I want to write a blog in Chinese language to support your project and help the people who not good at english.Although I am clumsy,but I want try,and tring.. I hope we can become friends.I don't know what's IM you use.My Email:qq386502324@gmail.com. And I want to communicate with you by IM or any methods. And I hope someday,You can visit Beijing,China,My country. And I will improve my English to welcome you. Of course,I'll treat you😄😄

groue commented 9 years ago

It's so kind of you! I'm French, so English is not my mother tongue: beware my English!

I would be very proud if a Chinese blog would talk about GRMustache. Many Chinese people have show interest in the repository. Such a blog would surely be very helpful to them.

When somebody asks a question about GRMustache, I always answer, when I have the time. This is the same for you. So please dare asking questions.