tools/json_schema_compiler/preview.py
def _RenderNavPane(self, path):
    """Renders an HTML nav pane.

    This consists of a select element to set highlight style, and a list of all
    files at |path| with the appropriate onclick handlers to open either
    subdirectories or JSON files.
    """
    html = code.Code()

    # Highlighter chooser.
    html.Append('<select id="highlighters" onChange="updateEverything()">')
    for name, highlighter in self.server.highlighters.items():
      html.Append('<option value="%s">%s</option>' %
          (name, highlighter.DisplayName()))
    html.Append('</select>')

    html.Append('<br/>')

    # Style for each highlighter.
    # The correct highlighting will be shown by Javascript.
    for name, highlighter in self.server.highlighters.items():
      styles = sorted(highlighter.GetStyles())
      if not styles:
        continue

      html.Append('<select class="highlighter_styles" id="%s_styles" '
                  'onChange="updateEverything()">' % name)
      for style in styles:
        html.Append('<option>%s</option>' % style)
      html.Append('</select>')

    html.Append('<br/>')

    # The files, with appropriate handlers.
    html.Append('<ul>')

    # Make path point to a non-empty directory. This can happen if a URL like
    # http://localhost:8000 is navigated to.
    if path == '':
      path = os.curdir

    # Firstly, a .. link if this isn't the root.
    if not os.path.samefile(os.curdir, path):
      normpath = os.path.normpath(os.path.join(path, os.pardir))
      html.Append('<li><a href="/%s">%s/</a>' % (normpath, os.pardir))

    # Each file under path/
    for filename in sorted(os.listdir(path)):
      full_path = os.path.join(path, filename)
      _, file_ext = os.path.splitext(full_path)
      if os.path.isdir(full_path) and not full_path.endswith('.xcodeproj'):
        html.Append('<li><a href="/%s/">%s/</a>' % (full_path, filename))
      elif file_ext in ['.json', '.idl']:
        # cc/h panes will automatically update via the hash change event.
        html.Append('<li><a href="#%s">%s</a>' %
            (filename, filename))

    html.Append('</ul>')

    return html.Render()
Renders an HTML nav pane.

    This consists of a select element to set highlight style, and a list of all
    files at |path| with the appropriate onclick handlers to open either
    subdirectories or JSON files.
    
Renders an HTML nav pane.
This consists of a select element to set highlight style, and a list of all
files at |path| with the appropriate onclick handlers to open either
subdirectories or JSON files.
Renders an HTML nav pane . This consists of a select element to set highlight style and a list of all files at |path| with the appropriate onclick handlers to open either subdirectories or JSON files .
def _RenderNavPane(self, path):
    html = code.Code()
    html.Append('<select id="highlighters" onChange="updateEverything()">')
    for name, highlighter in self.server.highlighters.items():
      html.Append('<option value="%s">%s</option>' %
          (name, highlighter.DisplayName()))
    html.Append('</select>')
    html.Append('<br/>')
    for name, highlighter in self.server.highlighters.items():
      styles = sorted(highlighter.GetStyles())
      if not styles:
        continue
      html.Append('<select class="highlighter_styles" id="%s_styles" '
                  'onChange="updateEverything()">' % name)
      for style in styles:
        html.Append('<option>%s</option>' % style)
      html.Append('</select>')
    html.Append('<br/>')
    html.Append('<ul>')
    if path == '':
      path = os.curdir
    if not os.path.samefile(os.curdir, path):
      normpath = os.path.normpath(os.path.join(path, os.pardir))
      html.Append('<li><a href="/%s">%s/</a>' % (normpath, os.pardir))
    for filename in sorted(os.listdir(path)):
      full_path = os.path.join(path, filename)
      _, file_ext = os.path.splitext(full_path)
      if os.path.isdir(full_path) and not full_path.endswith('.xcodeproj'):
        html.Append('<li><a href="/%s/">%s/</a>' % (full_path, filename))
      elif file_ext in ['.json', '.idl']:
        html.Append('<li><a href="#%s">%s</a>' %
            (filename, filename))
    html.Append('</ul>')
    return html.Render()
def _RenderNavPane ( self , path ) : html = code . Code ( ) html . Append ( '<select id="highlighters" onChange="updateEverything()">' ) for name , highlighter in self . server . highlighters . items ( ) : html . Append ( '<option value="%s">%s</option>' % ( name , highlighter . DisplayName ( ) ) ) html . Append ( '</select>' ) html . Append ( '<br/>' ) for name , highlighter in self . server . highlighters . items ( ) : styles = sorted ( highlighter . GetStyles ( ) ) if not styles : continue html . Append ( '<select class="highlighter_styles" id="%s_styles" ' 'onChange="updateEverything()">' % name ) for style in styles : html . Append ( '<option>%s</option>' % style ) html . Append ( '</select>' ) html . Append ( '<br/>' ) html . Append ( '<ul>' ) if path == '' : path = os . curdir if not os . path . samefile ( os . curdir , path ) : normpath = os . path . normpath ( os . path . join ( path , os . pardir ) ) html . Append ( '<li><a href="/%s">%s/</a>' % ( normpath , os . pardir ) ) for filename in sorted ( os . listdir ( path ) ) : full_path = os . path . join ( path , filename ) _ , file_ext = os . path . splitext ( full_path ) if os . path . isdir ( full_path ) and not full_path . endswith ( '.xcodeproj' ) : html . Append ( '<li><a href="/%s/">%s/</a>' % ( full_path , filename ) ) elif file_ext in [ '.json' , '.idl' ] : html . Append ( '<li><a href="#%s">%s</a>' % ( filename , filename ) ) html . Append ( '</ul>' ) return html . Render ( )
Renders an HTML nav pane.
Renders an HTML nav pane .
"""Renders an HTML nav pane.

    This consists of a select element to set highlight style, and a list of all
    files at |path| with the appropriate onclick handlers to open either
    subdirectories or JSON files.
    """ # Highlighter chooser. # Style for each highlighter. # The correct highlighting will be shown by Javascript. # The files, with appropriate handlers. # Make path point to a non-empty directory. This can happen if a URL like # http://localhost:8000 is navigated to. # Firstly, a .. link if this isn't the root. # Each file under path/ # cc/h panes will automatically update via the hash change event.
self
path