code: public boolean handleEnd(TagContext context)
      {
          boolean nonGeneratedContent = (boolean) context.getTagStack().popStackParameter(NON_GENERATED_CONTENT_STACK);
          MacroInfo macroInfo = (MacroInfo) context.getTagStack().getStackParameter(MACRO_INFO);
  
          if (nonGeneratedContent && macroInfo != null) {
              context.getTagStack().getScannerContext().endDocument();
  
              XWikiGeneratorListener xWikiGeneratorListener =
                  (XWikiGeneratorListener) context.getTagStack().popScannerContext().getfListener();
  
              PrintRenderer renderer;
  
              if (context.getTagStack().isInsideBlockElement()) {
                  WrappingListener wrappingListener = (WrappingListener) xWikiGeneratorListener.getListener();
                  renderer = (PrintRenderer) wrappingListener.getWrappedListener();
              } else {
                  renderer = (PrintRenderer) xWikiGeneratorListener.getListener();
              }
              String content = renderer.getPrinter().toString();
  
              if (context.getTagStack().getStackParameter(PARAMETER_CONTENT_NAME) == null) {
                  macroInfo.setContent(content);
              } else {
                  String parameterName = (String) context.getTagStack().popStackParameter(PARAMETER_CONTENT_NAME);
                  WikiParameters parameters = macroInfo.getParameters();
  
                  // WikiParameters are immutable
                  macroInfo.setParameters(parameters.setParameter(parameterName, content));
              }
          }
  
          return nonGeneratedContent || macroInfo != null;
      }
docs: Handle the end of a container (div or span) which can contain a non generated content metadata.
  @param context the context of the current tag.
  @return true if a non generated content tag has been detected or it's in an macro info.