Giter VIP home page Giter VIP logo

closure-templates's People

Contributors

cgdecker avatar concavelenz avatar davidcphillips avatar gk5885 avatar kluever avatar lindner avatar lukesandberg avatar martinkretzschmar avatar mknichel avatar nanaze avatar nathancomstock avatar nicks avatar oujesky avatar smkarwa avatar szabodabo avatar ubehebe avatar viridia avatar vrana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

closure-templates's Issues

New line character problem within {literal} block

When I create a {literal} block which has a multiline content, then the generated HTML contains \n characters.

SOY source:

{template .test}
    {literal}
        /* some
           multiline
           string */
    {/literal}
{/template}

Generated PHP source:

  public static function test($opt_data = null, $opt_ijData = null) {
    $output = '\n        /* some\n           multiline\n           string */\n    ';
    return new \Goog\Soy\SanitizedHtml($output);
  }

Rendered HTML source:

\n        /* some\n           multiline\n           string */\n    

So the problem is when setting the value of $output, the value is surrounded by single quotes, so the new line character will be treated as text instead of as a special character. Changing single quotes to double quotes or replacing \n with PHP_EOL can fix this issue.

[FEATURE-REQUEST] Inherit Soy annotations

It would be nice if there was an extra option in the Soy compiler which can copy the annotations from the Soy templates to the generated PHP functions.

For example:

Soy source:

/**
 * Test template
 * @annotation custom annotation
 */
{template .test}
    test
{/template}

PHP source:

  /**
   * Test template
   * @annotation custom annotation
   * @param array|null $opt_data
   * @param array|null $opt_ijData
   * @return \Goog\Soy\SanitizedContent
   */
  public static function test($opt_data = null, $opt_ijData = null) {
    $output = 'test';
    return new \Goog\Soy\SanitizedHtml($output);
  }

But of course this output is just an example/idea, the format can be changed if it is necessary. Also, it would nice to keep the original @param annotations as @soyparam or something like this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.