code: def create_symlinks(d):
      
      data = loadJson(d)
      outDir = prepare_output(d)
  
      unseen = data["pages"].keys()
      while len(unseen) > 0:
          latest = work = unseen[0]
          while work in unseen:
              unseen.remove(work)
              if "prev" in data["pages"][work]:
                  work = data["pages"][work]["prev"]
      print("Latest page: %s" % (latest))
  
      order = []
      work = latest
      while work in data["pages"]:
          order.extend(data["pages"][work]["images"].values())
          if "prev" in data["pages"][work]:
              work = data["pages"][work]["prev"]
          else:
              work = None
      order.reverse()
  
      for i, img in enumerate(order):
          os.symlink(os.path.join('..', img), os.path.join(outDir, '%05i_%s' % (i, img)))
docs: Create new symbolic links in output directory.