> On Jan 8, 2019, at 12:32 PM, César Hernández Mendoza <cesargu...@gmail.com> 
> wrote:
> 
> tomee-8.0 (latest)
> Documentation
> Examples [es]
> Javadoc
> 
> tomee-7.1
> Examples [es] [fr]
> Javadoc

We could still do that regardless of the url pattern change.  There's a little 
bit of jumping already happening on the main /docs.html page.  Particularly:

 - http://tomee.apache.org/docs.html           ... links to
 - http://tomee.apache.org/tomee-8.0/docs/     ... here and skips over 
 - http://tomee.apache.org/tomee-8.0/          ... this page which does exist

The only way to get to "tomee-8.0/index.html" is via URL hack.  But it's there 
in case we want to point people to it.  If we wanted tot add breadcrumbs, we're 
ready.

There could and should be a "tomee-8.0/es/index.html" page.

I haven't looked at the PR since this weekend, but one approach might be to 
break up this method 
https://github.com/apache/tomee-site-generator/blob/master/src/main/java/org/apache/tomee/website/Sources.java#L117

This is pseudo code, but something a little like this:

    public void prepare() {
        // copy the non-version specific stuff over
        try {
            IO.copyDirectory(mainSource, jbake);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        // download all the external repos
        sources.stream()
                .flatMap(source -> source.getRelated().stream())
                .peek(source -> source.setDir(new File(repos, 
source.getName())))
                .forEach(Repos::download);

        // download all our repos and process javadoc
        final Javadocs javadocs = new Javadocs(this);
        sources.stream()
                .peek(source -> source.setDir(new File(repos, 
source.getName())))
                .peek(Repos::download)
                .forEach(javadocs::prepare);
        ;

        // for each source, collect the extensions and process them
        // each gets its own identical layout
        // perhaps empty string "" implies english
        for (Source source : sources) {
            for (String lang : source.findLanguages()) {

                final Docs docs = new Docs(this, lang);
                final Examples examples = new Examples(this, lang);
                final VersionIndex versionIndex = new VersionIndex(this, lang);

                // this logic now knows what language it needs to look for and 
collect and process
                sources.stream()
                        .peek(docs::prepare)
                        .peek(examples::prepare)
                        .peek(versionIndex::prepare)
                        .forEach(Sources::done);
            }
        }

        // create the big magical index across all projects, versions and 
languages
        // we can try to keep it on one page for as long as possible
        // it will eventually get too big, but we're not there yet

        VersionsIndex.prepare(this);
    }

Then we make sure anything we add in that second set of loops always handles 
internationalization.  Now it's docs and examples.  Tomorrow it could include 
presentations, video links, who knows.

I'm sure that second set of loops could be done with Streams.  I don't know 
that I could type that into an email window with confidence :)


-David

Reply via email to