tag_yellowCreates pages with tags of different weight (for testing puposes)
TypeSnippet
Category
Developed by

Jean-Vincent Drean

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

You can use the following code to create a lot of dummy pages with tags in your wiki for test purposes. To use it, edit a page, put this code in it and save it :

#set($animals1 = ["Alligator", "Baboon", "Camel", "Deer", "Eagle", "Falcon", "Gazelle", "Hamster", "Jackal", "Kangaroo", "Ladybug", "Magpie", "Nightingale", "Ostrich", "Panda", "Quail", "Rabbit", "Sea lion", "Tiger", "Weasel", "Yak", "Zebra"])
#set($animals2 = ["Ant", "Badger", "Cat", "Dog", "Eel", "Ferret", "Gerbil", "Hare", "Jaguar", "Lark", "Mallard", "Otter", "Parrot", "Raccoon", "Sea urchin", "Toad", "Whale"])

#macro(createPages $animals $magic)
  #foreach($animal in $animals)
    #foreach($i in [0..$magic])
      #set($aTags = false)
      #set($aDoc = $xwiki.getDocument("Animals.${animal}${i}"))
      #set($aTags = $aDoc.getObject("XWiki.TagClass"))
      #if(!$aTags)
        #set($aTags = $aDoc.newObject("XWiki.TagClass"))    
      #end
     $aTags.set("tags", $animal)
     $aDoc.save()
     * [$aDoc]
    #end
    #set($magic = $magic - 1)
  #end
#end

#createPages($animals1 $animals1.size())
#set($magic = $animals2.size() * 2)
#createPages($animals2 $magic)
Tags: tag
     

Get Connected