Uploaded image for project: 'Maven Doxia Sitetools'
  1. Maven Doxia Sitetools
  2. DOXIASITETOOLS-97

Support polymorphism for menu inheritance

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • None
    • None
    • Site model

    Description

      Inheritance of menus in an multimodule project environment does not work as intuitively expected (as in OO languages). The following excerpts try to illustrate this. Assume there is a root project R that has one module (project) S. Both contain a site descriptor. Let the site descriptor for R be as follows:

      <project name="${project.name}">
      
      	<!-- ... -->
      
      	<body>
      		<menu name="Main">
      			<item name="Introduction" href="/index.html" />
      			<item name="News" href="/news.html" />
      			<item name="Overwrite" href="/documentation.html" />
      		</menu>
      	</body>
      
      	<!-- ... -->
      	
      </project>
      

      And let the site descriptor for S be:

      <project name="${project.name}">
      
      	<!-- ... -->
      
      	<body>
      		<menu name="Main">
      			<item name="Introduction" href="/index.html" />
      			<item name="Overwrite" href="/overwrite.html" />
      			<item name="Added" href="/added.html" />
      		</menu>
      	</body>
      
      	<!-- ... -->
      	
      </project>
      

      As I'm used to the way inheritance and polymorphism are defined in OO languages such as Java, I would expect the following properties for the "Main" menu in S:

      • item "Introduction" is overwritten in S but refers to the same index.html file; of course, its path is relative to start directory of S
      • item "News" is missing for S but will be inherited from R, thus, it will be rendered to the site as in R
      • item "Overwrite" is overwritten in S and refers now to overwrite.html (instead of documentation.html as in R)
      • item "Added" is new in S, thus, it will be rendered to the site in addition

      Unfortunately, with the current implementation of the site plugin inheritance is as follows:

      • "Main" menu of R is inherited by S as-is, that is, all changes made to the menu in S are not visible/rendered to the site.

      I would like to propose to implement polymorphism regarding menu inheritance as described above. In addition, I would like to propose a new boolean parameter "inherited" (or "inherit") that can be added to menu items. Its semantics would be equivalent to the "inherited" tag in pom.xml. In the following one example for R:

      <project name="${project.name}">
      
      	<!-- ... -->
      
      	<body>
      		<menu name="Main">
      			<item name="Introduction" href="/index.html" />
      			<item name="News 1" href="/news1.html"  inherited="false"/>
      			<item name="News 2" href="/news2.html"  inherited="true"/>
      			<item name="Overwrite" href="/documentation.html" />
      		</menu>
      	</body>
      
      	<!-- ... -->
      	
      </project>
      

      With this example only menu item "News 2" would appear in S because its inheritance is not disabled, while menu item "News 1" appears only in R and not in S because its inheritance was disabled (false). The default if the parameter is missing should be "true".

      Btw, the same extension should be made to the <menu ... > tag to allow to enable or disable inheritance of menus entirely.

      Regards,
      Thorsten

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              twwwt Thorsten Möller
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: