You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ft_documentationreference.m
    path of file: ./repos/bspm/thirdparty/spm12/external/fieldtrip
    
    the code of the file until where you have to start completion: function ft_documentationreference(outdir)

% FT_DOCUMENTATIONREFERENCE is a function to maintain the online document
    
function names
for i=1:length(funname)
  filename = fullfile(outdir, [funname{i} '.txt']);
  str = help(funname{i});
  
  % make text html-compatible
  str = strrep(str, '<', '&lt;');
  str = strrep(str, '>', '&gt;');
  
  % add crossrefs
  for f=1:length(funname)
    str = strrep(str, [' ', upper(funname{f})], [' <a href=/reference/', funname{f}, '><font color=green>', upper(funname{f}),'</font></a>']);
  end