public List<String> addIncludes(List<String> content) {
        List<String> result = new LinkedList<String>();

        String includeTag = "";
        boolean inComment = false;
        boolean startTagFound = false;

        for (String candidate : content) {
            if (commentStart(candidate)) {
                inComment = true;
            }

            if (commentEnd(candidate)) {
                inComment = false;
            }

            if (completeIncludeLine(inComment, candidate)) {
                includeTag = candidate;
                result = getIncludeContent(result, includeTag);
                includeTag = "";
                continue;
            }

            if (initialIncludeLine(inComment, candidate)) {
                includeTag = candidate;
                startTagFound = true;
                continue;
            }

            if (endingIncludeLine(inComment, candidate)) {
                includeTag += candidate;
                result = getIncludeContent(result, includeTag);
                includeTag = "";
                startTagFound = false;
                continue;
            }

            if (continuingIncludeLine(inComment, startTagFound)) {
                includeTag += candidate;
            } else {
                result.add(candidate);
            }
        }

        return result;
    }