public Doc parse()

in src/main/java/org/apache/tomee/website/GroupedIndex.java [251:285]


    public Doc parse(final File file) {
        final Parser parser = new Parser(new CompositeConfiguration(), file.getAbsolutePath());
        final Map<String, Object> map = parser.processFile(file);

        if (map == null) {
            return new Doc("Unknown", Docs.simpleName(file), Docs.href(directory, file), file);
        }

        final String title = getTitle(map, file);
        final String group = Optional.ofNullable(map.get("index-group")).orElse("Unknown") + "";

        /*
             Create the document reference to be ready to be added as part of the index files like:
             target/jbake/content/tomee-8.0/docs/index.html
             target/jbake/content/tomee-8.0/docs/maven/index.html
             target/jbake/content/tomee-8.0/fr/examples/index.html
             target/jbake/content/tomee-8.0/examples/index.html

         */
        if (type.equalsIgnoreCase("examplesindex") && file.getParentFile().getName().equalsIgnoreCase("examples")) {
            String detectedLanguage = getLanguageFromPath(file, this.type);

            if (detectedLanguage.equalsIgnoreCase("en")) {
                return new Doc(group, title, Docs.href(new File(directory + File.separator + "examples"), file), file, detectedLanguage);
            } else {
                return new Doc(group, title, Docs.href(new File(directory + File.separator + detectedLanguage + File.separator + "examples"), file), file, detectedLanguage);
            }

        } else {
            // todo: Here we can implement later when doc type is docindex and not examplesindex
            return new Doc(group, title, Docs.href(directory, file), file); //default to english
        }


    }