code: protected String removeInvalidHeaderCommentsAndProcessVelocityMacros(String text) {
          String answer = "";
          String[] lines = text.split("\r?\n");
          for (String line : lines) {
              String l = line.trim();
              // a bit of Velocity here
              if (!l.startsWith("##") && !l.startsWith("#set(")) {
                  if (line.contains("${D}")) {
                      line = line.replaceAll("\\$\\{D\\}", "\\$");
                  }
                  answer = answer.concat(line);
                  answer = answer.concat(System.lineSeparator());
              }
          }
          return answer;
      }
docs: This method should do a full Velocity macro processing...