1. 14 Sep, 2011 5 commits
  2. 13 Sep, 2011 7 commits
    • Mike Samuel's avatar
      exp/template/html: escape {{template}} calls and sets of templates · 4c6454ae
      Mike Samuel authored
      This adds support for {{template "callee"}} calls.
      It recognizes that calls can appear in many contexts.
      
      {{if .ImageURL}}
          <img src="{{.ImageURL}}" alt="{{template "description"}}">
      {{else}}
          <p>{{template "description"}}</p>
      {{end}}
      
      calls a template in two different contexts, first in an HTML attribute
      context, and second in an HTML text context.
      
      Those two contexts aren't very different, but when linking text
      to search terms, the escaping context can be materially different:
      
      <a href="/search?q={{template "tags"}}">{{template "tags"}}</a>
      
      This adds API:
      EscapeSet(*template.Set, names ...string) os.Error
      
      takes a set of templates and the names of those which might be called
      in the default context as starting points.
      
      It changes the escape* functions to be methods of an object which
      maintains a conceptual mapping of
      (template names*input context) -> output context.
      
      The actual mapping uses as key a mangled name which combines the
      template name with the input context.
      
      The mangled name when the input context is the default context is the
      same as the unmangled name.
      
      When a template is called in multiple contexts, we clone the template.
      
      {{define "tagLink"}}
        <a href="/search?q={{template "tags"}}">{{template "tags"}}</a>
      {{end}}
      {{define "tags"}}
        {{range .Tags}}{{.}},{{end}}
      {{end}}
      
      given []string{ "foo", "O'Reilly", "bar" } produces
      
        <a href="/search?q=foo,O%27Reilly,bar">foo,O&#39;Reilly,bar</a>
      
      This involves rewriting the above to something like
      
      {{define "tagLink"}}
        <a href="/search?q={{template "tags$1"}}">{{template "tags"}}</a>
      {{end}}
      {{define "tags"}}
        {{range .Tags}}{{. | html}},{{end}}
      {{end}}
      {{define "tags$1"}}
        {{range .Tags}}{{. | urlquery}},{{end}}
      {{end}}
      
      clone.go provides a mechanism for cloning template "tags" to produce
      "tags$1".
      
      changes to escape.go implement the new API and context propagation
      around the call graph.
      
      context.go includes minor changes to support name mangling and
      context_test.go tests those.
      
      js.go contains a bug-fix.
      
      R=nigeltao, r
      CC=golang-dev
      https://golang.org/cl/4969072
      4c6454ae
    • Ian Lance Taylor's avatar
      http: Alphabetize imports. · 9377b288
      Ian Lance Taylor authored
      R=golang-dev, bradfitz
      CC=golang-dev
      https://golang.org/cl/5002043
      9377b288
    • Ian Lance Taylor's avatar
      os: Fix comment in generated signal_unix.go file. · 096f3a29
      Ian Lance Taylor authored
      R=golang-dev, bradfitz
      CC=golang-dev
      https://golang.org/cl/5013042
      096f3a29
    • Marcel van Lohuizen's avatar
    • Nigel Tao's avatar
      net: add a LookupTXT function. · 40d85fb0
      Nigel Tao authored
      This CL only supports Unix, not Plan 9 or Windows.
      
      R=rsc
      CC=golang-dev
      https://golang.org/cl/4996048
      40d85fb0
    • Alex Brainman's avatar
      time: another attempt to fix windows build · cd269b0c
      Alex Brainman authored
      R=bradfitz
      CC=golang-dev
      https://golang.org/cl/4967067
      cd269b0c
    • Brad Fitzpatrick's avatar
      time: fix Windows build after ceeedb519c4a · 29d5d9a5
      Brad Fitzpatrick authored
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/4983060
      29d5d9a5
  3. 12 Sep, 2011 12 commits
  4. 09 Sep, 2011 6 commits
    • Nigel Tao's avatar
      image/png: don't use a goroutine to decode. This was preventing · a5d0b7ee
      Nigel Tao authored
      decoding during an init function.
      
      Fixes #2224.
      
      R=rsc
      CC=golang-dev
      https://golang.org/cl/4964070
      a5d0b7ee
    • Andrew Gerrand's avatar
      doc: link to notable blog posts · 3bc2d0f2
      Andrew Gerrand authored
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/4996041
      3bc2d0f2
    • Luuk van Dijk's avatar
      ld: grow dwarf includestack on demand. · ac1b9545
      Luuk van Dijk authored
      Fixes #2241
      while not breaking issue 1878 again.
      
      R=rsc
      CC=golang-dev
      https://golang.org/cl/4988048
      ac1b9545
    • Yasuhiro Matsumoto's avatar
      path/filepath: make UNC file names work · 3301e5a4
      Yasuhiro Matsumoto authored
      Fixes #2201
      
      R=golang-dev, r, rsc, alex.brainman, robert.hencke, jp
      CC=golang-dev
      https://golang.org/cl/4950051
      3301e5a4
    • Mike Samuel's avatar
      exp/template/html: Grammar rules for HTML comments and special tags. · 1f13423d
      Mike Samuel authored
      Augments type context and adds grammatical rules to handle special HTML constructs:
          <!-- comments -->
          <script>raw text</script>
          <textarea>no tags here</textarea>
      
      This CL does not elide comment content.  I recommend we do that but
      have not done it in this CL.
      
      I used a codesearch tool over a codebase in another template language.
      
      Based on the below I think we should definitely recognize
        <script>, <style>, <textarea>, and <title>
      as each of these appears frequently enough that there are few
      template using apps that do not use most of them.
      
      Of the other special tags,
        <xmp>, <noscript>
      are used but infrequently, and
        <noframe> and friend, <listing>
      do not appear at all.
      
      We could support <xmp> even though it is obsolete in HTML5
      because we already have the machinery, but I suggest we do not
      support noscript since it is a normal tag in some browser
      configurations.
      
      I suggest recognizing and eliding <!-- comments -->
      (but not escaping text spans) as they are widely used to
      embed comments in template source.  Not eliding them increases
      the size of content sent over the network, and risks leaking
      code and project internal details.
      The template language I tested elides them so there are
      no instance of IE conditional compilation directives in the
      codebase but that could be a source of confusion.
      
      The codesearch does the equivalent of
      $ find . -name \*.file-extension \
        | perl -ne 'print "\L$1\n" while s@<([a-z][a-z0-9])@@i' \
        | sort | uniq -c | sort
      
      The 5 uses of <plaintext> seem to be in tricky code and can be ignored.
      The 2 uses of <xmp> appear in the same tricky code and can be ignored.
      I also ignored end tags to avoid biasing against unary
      elements and threw out some nonsense names since since the
      long tail is dominated by uses of < as a comparison operator
      in the template languages expression language.
      
      I have added asterisks next to abnormal elements.
      
        26765 div
         7432 span
         7414 td
         4233 a
         3730 tr
         3238 input
         2102 br
         1756 li
         1755 img
         1674 table
         1388 p
         1311 th
         1064 option
          992 b
          891 label
          714 script *
          519 ul
          446 tbody
          412 button
          381 form
          377 h2
          358 select
          353 strong
          318 h3
          314 body
          303 html
          266 link
          262 textarea *
          261 head
          258 meta
          225 title *
          189 h1
          176 col
          156 style *
          151 hr
          119 iframe
          103 h4
          101 pre
          100 dt
           98 thead
           90 dd
           83 map
           80 i
           69 object
           66 ol
           65 em
           60 param
           60 font
           57 fieldset
           51 string
           51 field
           51 center
           44 bidi
           37 kbd
           35 legend
           30 nobr
           29 dl
           28 var
           26 small
           21 cite
           21 base
           20 embed
           19 colgroup
           12 u
           12 canvas
           10 sup
           10 rect
           10 optgroup
           10 noscript *
            9 wbr
            9 blockquote
            8 tfoot
            8 code
            8 caption
            8 abbr
            7 msg
            6 tt
            6 text
            6 h5
            5 svg
            5 plaintext *
            5 article
            4 shortquote
            4 number
            4 menu
            4 ins
            3 progress
            3 header
            3 content
            3 bool
            3 audio
            3 attribute
            3 acronym
            2 xmp *
            2 overwrite
            2 objects
            2 nobreak
            2 metadata
            2 description
            2 datasource
            2 category
            2 action
      
      R=nigeltao
      CC=golang-dev
      https://golang.org/cl/4964045
      1f13423d
    • Robert Griesemer's avatar
      godoc: fine tuning of template file · dc9ee812
      Robert Griesemer authored
      R=r, adg
      CC=golang-dev
      https://golang.org/cl/4995041
      dc9ee812
  5. 08 Sep, 2011 10 commits