def convert_file()

in _scripts/convert-recipes-docs.py [0:0]


def convert_file(inPath, outPath):

  print "Creating ", outPath

  with open(inPath) as fin:

    # skip license
    line = ''
    while not line.startswith('-->'):
      line = fin.readline().strip()

    # read title
    title = ''
    while len(title) == 0:
      title = fin.readline().strip()
    title = title.lstrip(' #').strip()

    fin.readline()

    if inPath.endswith("README.md"):
      title = "Fluo Recipes {0} Documentation".format(release_ver)

    with open(outPath, "w") as fout:
      print >> fout, "---" 
      print >> fout, "layout: recipes-doc" 
      print >> fout, "title:", title 
      print >> fout, "version:", release_ver
      print >> fout, "---"

      if inPath.endswith("README.md"):
        fin.readline()
        fin.readline()

      for line in fin:
        if line.startswith("["):
          if line.find(".md") != -1:
            for word in line.split(' '):
              if word.find(".md") != -1:
                fout.write(path_to_url(word))
              else:
                fout.write(word+" ")
          elif line.find("../modules") != -1:
            if line.strip().endswith(".java"):
              start = line.find("../modules/")
              end = line.find("org/apache/fluo")
              fout.write(line.replace(line[start:end], javadocs_prefix).replace(".java", ".html"))
            else:
              fout.write(line.replace("../modules/", github_prefix))
          else:
            fout.write(line)
        else:
          fout.write(line)