docs: private boolean needPushTerm() {
          if (elementStack.empty()) {
              return false;
          }
  
  
          if (elementStack.peek() instanceof TopicrefElement) {
              // for dita files the indexterm has been moved to its <prolog>
              // therefore we don't need to collect these terms again.
              final TopicrefElement elem = (TopicrefElement) elementStack.peek();
              if (indexMoved && (elem.getFormat() == null || elem.getFormat().equals(ATTR_FORMAT_VALUE_DITA) || elem.getFormat().equals(ATTR_FORMAT_VALUE_DITAMAP))) {
                  return false;
              }
          }
          return true;
      }