code: private void parseReference(char[] array, int i, StringBuffer reference,
          StringBuffer parameters)
      {
          int nb;
  
          for (boolean escaped = false; i < array.length; ++i) {
              char c = array[i];
  
              if (!escaped) {
                  if (array[i] == '~' && !escaped) {
                      escaped = true;
                  } else if ((nb = countFirstChar(array, i, '|')) >= 2) {
                      for (; nb > 2; --nb) {
                          reference.append(array[i++]);
                      }
                      i += 2;
                      parameters.append(array, i, array.length - i);
                      break;
                  } else {
                      reference.append(c);
                  }
              } else {
                  reference.append(c);
                  escaped = false;
              }
          }
      }
docs: Extract the link and the parameters.
  
  @param array the array to extract information from
  @param i the current position in the array
  @param reference the link buffer to fill
  @param parameters the parameters buffer to fill