The XWiki development team is pleased to announce the release of XWiki
Enterprise 1.8 Milestone 2.
Go grab it at http://www.xwiki.org/xwiki/bin/view/Main/Download
Last milestone of the XWiki Enterprise 1.8 version before release candidate.
Main changes:
* New Wiki Dashboard
* New way of displaying tags
* Page loading time reduced by 30%
* Improved information section in document footer
* Added wiki syntax for embedded documents
* Improved authentication performance for LDAP
Important bug fixes:
* Many bug fixes and improvements in the new GWT WYSIWYG editor
* Add support for Velocity and HTML as well as many bug fixes and
improvements in the XWiki syntax converter to convert from 1.0 syntax
to 2.0 syntax.
Note that general goals for XWiki Enterprise 1.8 are:
* Office Importer
* New Blog
* REST API
* Finish new rendering/syntax
* Finish new WYSIWYG
* French XE
* MediaWiki import
For more information see the Release notes at:
http://www.xwiki.org/xwiki/bin/view/Main/ReleaseNotesXWikiEnterprise18M2
Thanks, The XWiki dev team
Hi,
sorry for being thick, but I can't find any documentation at all how
to do this in Java and I still
need some help with this.
In our authenticator I'd like to check if users coming from a certain
angle (i can check on that
through cookies) are in a special group. If they are not, I'd like to
add the to this group.
Furthermore this group needs to asserted of, so I need to be able to
reliably find out if it
does exist and if not, create it.
So far I've been frustrated by failure by attempting to use the
XWikiGroupService to achieve this.
Also I don't seem to be able to find a clean documentation on how
users and groups and done
in XWikI (in java, especially). Is there such documentation?
The following code, to much bewilderment, creates a USER?!
public void checkPortalGroup(XWikiContext context) {
if (!_portalGroupChecked) {
try {
boolean groupExists = false;
List<String> groupList =
context.getWiki().getGroupService(context).listAllGroups(context);
for (ListIterator<String> groups = groupList.listIterator();
groups.hasNext() && !groupExists;) {
groupExists = groups.next().equals(PORTAL_GROUP_NAME);
}
if (!groupExists) {
log.info("Group "+PORTAL_GROUP_NAME+" does not exist and
will be created.");
BaseCollection portalGroup =
context.getWiki().getGroupClass(context).newObject(context);
portalGroup.setName(PORTAL_GROUP_NAME);
context.getWiki().getHibernateStore().saveXWikiObject((BaseObject)
portalGroup, context, true);
}
} catch (XWikiException e) {
log.error("Exception while locating or creating group
"+PORTAL_GROUP_NAME+" : "+e.getMessage());
e.printStackTrace();
}
_portalGroupChecked=true;
}
}
I need some serious pointers on how the xwiki objects/classes thing is
supposed to work
for users/groups.
Thanks a lot,
J.L.Simon
Hi,
I'd like to propose that we replace our Archiva install with Nexus
Professional since it's much better and would allow us to do staged
releases.
For details on staged releases, see http://blogs.sonatype.com/people/2009/01/nexus-professional-what-is-staging/
Basically it means the workflow for releasing would be:
1) do a release as normal
2) nexus pro intercepts the release before it goes to our release
repository and moves the artifacts to a temporary staging repository
3) an email is sent to the users/devs mailing list asking for people
to test the staged release to ensure it works fine
4) we allow 1 to 2 days for testing
5) the release manager then goes in the nexus UI and either promotes
the staged release as a release or discards it if important problems
are found
6) the release manager then continues with the release by uploading
the files to the OW2 repo, modify the xwiki.org web site, etc
Note that we should move towards the goal of removing the need to have
RCs and thus give us more time to provide added-value in our releases.
This can only be done by increasing our quality and namely it means:
A) Improving our test suite and test practices (no code should be
released without tests)
B) Improving our manual QA tests for the release to ensure nothing is
amiss
The idea of staged release implements the B) point above. Ideally we
shouldn't find any problem at all during step 3) above and thus B)
should just be a formality. In practice it's probably a good thing to
have it, just to be extra careful and give us the ability to catch
last minute errors.
WDYT?
Thanks
-Vincent
http://xwiki.comhttp://xwiki.orghttp://massol.net
Hi devs,
I would like to release 1.8M2 tomorrow morning
Some of the new features/improvements:
- Add velocity and html support in 1.0->2.0 converter and fixed bugs
- Add ability to display an optional image and a optional title in the Box macro
- Add wiki syntax for Embedded documents
- Bundle a complete set of web-related icons with XWiki
- Lots of bugfixes on WYSIWYG
- Complete refactor /cleanup of web resources and skins
- The authentication system call authenticator only once by session
for the same user by default (configurable in xwiki.cfg)
Here is my +1
--
Thomas Mortagne
Hi,
i'm trying to do a conceptually very, very simple task and find myself
obscured to death by
xwiki's data model (shall we call it one for now ...)
After hitting my head on the lack of API for user, I somehow (dont ask
me how) manage to
assemble some code for creating a user. This CAN NOT be right?!
Map map = Util.getObject(context.getRequest(), "register");
String content = "#includeForm(\"XWiki.XWikiUserSheet\")";
String template =
context.getRequest().getParameter("template");
String parent =
context.getRequest().getParameter("parent");
if ("superadmin".equalsIgnoreCase(wikiname)) {
log.error("Can't register user 'superadmin'. Name
reserved.");
return;
}
try {
if (!
context.getUtil().match(context.getWiki().Param("xwiki.validusername",
"/^[a-zA-Z0-9_]+$/"), wikiname)) {
log.warn("Illegal username '"+wikiname+"'");
}
} catch (RuntimeException ex) {
log.error("Invalid regular expression for
xwiki.validusername", ex);
if (!context.getUtil().match("/^[a-zA-Z0-9_]+$/",
wikiname)) {
log.error("Illegal username '"+wikiname+"'");
}
}
if ((template != null) && (!template.equals(""))) {
XWikiDocument tdoc =
context.getWiki().getDocument(template, context);
if ((!tdoc.isNew())) {
content = tdoc.getContent();
}
}
if ((parent == null) || (parent.equals(""))) {
parent = "XWiki.XWikiUsers";
}
// add password
map.put("password", wikiname);
map.put("active", "1");
if (log.isDebugEnabled()) {
log.debug("Creating user with parameters:
"+map.toString());
}
int result = -1;
try {
result = context.getWiki().createUser(wikiname, map,
parent, content, "edit", context);
log.info("User " + xwikiUser + " created successfully.");
userSuccessful = true;
} catch (Exception e) {
log.error("Exception when creating user "+wikiname,e);
}
if (result!=1) {
log.error("Creating user " + xwikiUser + " has failed
with status "+result);
}
Is this REALLY necessary? The task of creating a new user can be
achieved easier, surely?
Now I did have some code for checking if a given group exists, if not
create it. Then check if the user is in the group
and of not, add him. All my attempts in this direction were rewarded
with frustration. I find the data model (or perhaps
the abscence of cleaner structure for these things) highly obscure and
impossible to penetrate without a proper form
of documentation.
Does such documentation exist? A few simple examples perhaps?
Best Regards,
J.L.Simon
Hello devs,
Here's a proposal for a new maven mojo based on the xmldoc-update tool
(http://jira.xwiki.org/jira/browse/XTXMLDOC).
The objective would be to :
1. Sanitize XML docs :
* Force creator, author and contentAuthor to "XWiki.Admin"
* Foce version to 1.1
* Maybe check the language and translation fields (although, there is
less reasons for those to be wrong)
* Force creationDate, contentUpdateDate, date (+ see below)
2. Control the order we want for the doc list appearing on the "Recent
Changes" UI (on the wiki home page, one of the first thing users see) on
fresh distributions, by forcing modification dates to desired values so
that the list reflects what we want to appear here.
There are several approaches to do 2), I thought about the following :
By default, we force all documents to 00:00 on the current day. For
documents we want to appear up in the list, we specify them a priority
in the build configuration, for example on a scale of 1 to 100, 100
being the top priority. When forcing the date with the mojo, we add X *
N units of time to 00:00, where X is the priority and N is for example 1
second.
If all the document modification dates span maximum 100 seconds starting
at 00:00, there's close to zero risk to run a wiki with modification in
the future (which would make a document modified for real before this
future becomes present not appear on top of the list).
A constraint to keep in mind :
Wiki docs are spread accross applications. I don't think we want to
necessarily release all applications when releasing XE, so this should
ideally happen in XE's wiki module build. The drawback would be that if
we want to give priority to pages that are in applications, we reference
files from other modules, which is not clean. The alternative is to give
priority to documents in the module they are hosted, and release all
applications every time we release XE.
WDYT ?
Jerome.
On Feb 2, 2009, at 12:56 PM, mflorea (SVN) wrote:
> Author: mflorea
> Date: 2009-02-02 12:56:41 +0100 (Mon, 02 Feb 2009)
> New Revision: 16027
>
> Modified:
> enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/com/
> xpn/xwiki/it/selenium/StandardFeaturesTest.java
> Log:
> XWIKI-3053: When a HR is inserted at the beginning of a paragraph an
> extra empty paragraph is generated before that HR
>
>
> Modified: enterprise/trunk/distribution-test/wysiwyg-tests/src/test/
> it/com/xpn/xwiki/it/selenium/StandardFeaturesTest.java
> ===================================================================
> --- enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/com/
> xpn/xwiki/it/selenium/StandardFeaturesTest.java 2009-02-02 11:52:59
> UTC (rev 16026)
> +++ enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/com/
> xpn/xwiki/it/selenium/StandardFeaturesTest.java 2009-02-02 11:56:41
> UTC (rev 16027)
> @@ -613,4 +613,35 @@
> switchToWikiEditor();
> assertEquals("before\n\n|=Space|=Page\n|Main|WebHome\n
> \nafter", getFieldValue("content"));
> }
> +
> + /**
> + * @see XWIKI-3053: When a HR is inserted at the beginning of a
> paragraph an extra empty paragraph is generated
> + * before that HR
> + */
> + public void testInsertHRInsideParagraph()
> + {
> + typeText("xy");
> + applyStyleParagraph();
> +
> + // Insert HR at the end of the paragraph.
> + clickHRButton();
> +
> + // More the caret between x and y.
> + runScript("var range = XWE.selection.getRangeAt(0);\n" +
> "range.setStart(XWE.body.firstChild.firstChild, 1);\n"
> + + "range.collapse(true);");
Is there a way move to this to a DSL method for moving the caret?
> +
> + // Insert HR in the middle of the paragraph.
> + clickHRButton();
> +
> + // Move the caret before x.
> + runScript("var range = XWE.selection.getRangeAt(0);\n" +
> "range.setStart(XWE.body.firstChild.firstChild, 0);\n"
> + + "range.collapse(true);");
> +
> + // Insert HR at the beginning of the paragraph.
> + clickHRButton();
> +
> + // We have to assert the XHTML because the arrow keys don't
> move the caret so we can't test if the user can edit
> + // the generated empty paragraphs. The fact that they
> contain a BR proves this.
> + assertXHTML("<p><br class=\"emptyLine\"></p><hr><p>x</
> p><hr><p>y</p><hr><p><br class=\"emptyLine\"></p>");
> + }
> }
Thanks
-Vincent
http://xwiki.comhttp://xwiki.orghttp://massol.net
Dear community,
I'm just trying to set up a prototype with XWiki to test if it fits our
companies needs. I have several MS Office documents that I have to import.
Simple copy and paste doesn't work very well so I thougt, I can open the
MS Office files in OpenOffice export them as MediaWiki and then use the
MediaWiki2XWiki Extension. I just need a fast workaround to get thinks up
and running for presentation. Is there any better way of doing this?
Unfortunately I could not get the MediaWiki2XWiki Extension running. I
pastet the code into a new wiki page and then got the error
Error number 4002 in 4: Error while parsing groovy page XWiki.Code Wrapped
Exception: startup failed, Script1.groovy: 7: unexpected token: import @
line 7, column 52.
Can anybody tell me howto fix the import problem or is there any service
in the public web where I can enter my MediaWiki code and copy and paste
the resulting XWiki code?
Thanks for your help in advance!
Kind regards
Thomas Baier
BWI Systeme GmbH
SD IT / BKZ UHD
Nahmitzer Damm 12
12277 Berlin
E-Mail: thomas.baier(a)bwi-systeme.de
Sitz der BWI Systeme GmbH: Meckenheim - Registergericht Bonn - HRB 14 650
- USt-IdNr: DE251121155
Geschäftsführung: Johannes Nagel (Sprecher), Christoph Dibon
sorry, fixing it now
On Sat, Jan 31, 2009 at 7:32 PM, Vincent Massol <vincent(a)massol.net> wrote:
> I think you commented out too many tests in this commit... :)
>
> -Vincent
>
> On Jan 31, 2009, at 7:22 PM, tmortagne (SVN) wrote:
>
>> Author: tmortagne
>> Date: 2009-01-31 19:22:16 +0100 (Sat, 31 Jan 2009)
>> New Revision: 15982
>>
>> Modified:
>> platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
>> java/org/xwiki/rendering/block/AbstractBlock.java
>> platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
>> java/org/xwiki/rendering/block/Block.java
>> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/pom.xml
>> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/
>> toc/TocMacro.java
>> platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/src/test/java/org/xwiki/rendering/
>> RenderingTests.java
>> Log:
>> XWIKI-3174: Rename current SectionBlock to HeaderBlock and make
>> SectionBlock represent the whole section content
>> * improve toc macro execution based on new section block
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-api/
>> src/main/java/org/xwiki/rendering/block/AbstractBlock.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
>> java/org/xwiki/rendering/block/AbstractBlock.java 2009-01-31
>> 18:02:32 UTC (rev 15981)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
>> java/org/xwiki/rendering/block/AbstractBlock.java 2009-01-31
>> 18:22:16 UTC (rev 15982)
>> @@ -20,18 +20,18 @@
>> package org.xwiki.rendering.block;
>>
>> import java.util.ArrayList;
>> +import java.util.Collections;
>> import java.util.LinkedHashMap;
>> import java.util.List;
>> import java.util.Map;
>> -import java.util.Collections;
>>
>> import org.apache.commons.beanutils.ConvertUtils;
>> import org.apache.commons.lang.builder.EqualsBuilder;
>> import org.apache.commons.lang.builder.HashCodeBuilder;
>>
>> /**
>> - * Implementation for Block operations. All blocks should extend
>> this class. Supports the notion of parameters
>> - * which can be added to a block (see {@link #setParameter(String,
>> Object)} for more details).
>> + * Implementation for Block operations. All blocks should extend
>> this class. Supports the notion of parameters which can
>> + * be added to a block (see {@link #setParameter(String, Object)}
>> for more details).
>> *
>> * @version $Id$
>> * @since 1.5M2
>> @@ -70,7 +70,7 @@
>> {
>> this.parameters.putAll(parameters);
>> }
>> -
>> +
>> /**
>> * {@inheritDoc}
>> *
>> @@ -194,15 +194,15 @@
>> }
>>
>> /**
>> - * Set a parameter on the current block. A parameter is any
>> semantic data associated with a block.
>> - * It can be used for various purposes and provide additional
>> information to the renderers/listeners.
>> - * For example you can pass style information such as
>> <code>style="color:red"</code> (in that example
>> - * the name would be <code>style</code> and the value
>> <code>"color:red"</code>) to indicate that the
>> - * current block should be displayed in red.
>> + * Set a parameter on the current block. A parameter is any
>> semantic data associated with a block. It can be used
>> + * for various purposes and provide additional information to
>> the renderers/listeners. For example you can pass
>> + * style information such as <code>style="color:red"</code> (in
>> that example the name would be <code>style</code>
>> + * and the value <code>"color:red"</code>) to indicate that the
>> current block should be displayed in red.
>> + * <p>
>> + * Note that there are currently no well-defined known
>> parameter names and you'll need to check what the different
>> + * renderers/listeners support to know what to use.
>> + * </p>
>> *
>> - * <p>Note that there are currently no well-defined known
>> parameter names and you'll need to check what
>> - * the different renderers/listeners support to know what to
>> use.</p>
>> - *
>> * @param name the parameter's name
>> * @param value the parameter's value
>> */
>> @@ -285,7 +285,7 @@
>>
>> for (int i = index - 1; i >= 0; --i) {
>> Block previousBlock = blocks.get(i);
>> - if (previousBlock instanceof HeaderBlock) {
>> + if
>> (blockClass.isAssignableFrom(previousBlock.getClass())) {
>> return (T) previousBlock;
>> }
>> }
>> @@ -317,6 +317,7 @@
>>
>> /**
>> * {@inheritDoc}
>> + *
>> * @see Object#clone()
>> */
>> @Override
>> @@ -330,7 +331,7 @@
>> throw new RuntimeException("Failed to clone object", e);
>> }
>> block.parameters = new LinkedHashMap<String,
>> String>(getParameters());
>> - // Clone all children blocks. Note that we cannot use an
>> iterator since we're going to change the objects
>> + // Clone all children blocks. Note that we cannot use an
>> iterator since we're going to change the objects
>> // themselves. Using an iterator would lead to a
>> ConcurrentModificationException
>> Object[] objectArray = getChildren().toArray();
>> block.childrenBlocks = new ArrayList<Block>();
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-api/
>> src/main/java/org/xwiki/rendering/block/Block.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
>> java/org/xwiki/rendering/block/Block.java 2009-01-31 18:02:32 UTC
>> (rev 15981)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
>> java/org/xwiki/rendering/block/Block.java 2009-01-31 18:22:16 UTC
>> (rev 15982)
>> @@ -84,7 +84,7 @@
>> * @param newBlocks the new blocks to replace the current block
>> with
>> */
>> void replace(List<Block> newBlocks);
>> -
>> +
>> /**
>> * Get the parent block. All blocks have a parent and the top
>> level parent is the {@link XDOM} object.
>> *
>> @@ -126,7 +126,7 @@
>> <T extends Block> List<T> getChildrenByType(Class<T> blockClass,
>> boolean recurse);
>>
>> /**
>> - * Look forward to find a block which inherit or s provided type.
>> + * Look forward to find a block which inherit or is provided
>> type.
>> *
>> * @param <T> the class of the Blocks to return
>> * @param blockClass the block class to look for
>> @@ -135,9 +135,10 @@
>> * @since 1.6M1
>> */
>> <T extends Block> T getPreviousBlockByType(Class<T> blockClass,
>> boolean recurse);
>> -
>> +
>> /**
>> * {@inheritDoc}
>> + *
>> * @see Object#clone()
>> */
>> Block clone();
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/
>> xwiki-rendering-macro-toc/pom.xml
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/pom.xml 2009-01-31 18:02:32 UTC (rev 15981)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/pom.xml 2009-01-31 18:22:16 UTC (rev 15982)
>> @@ -43,11 +43,11 @@
>> </includes>
>> </configuration>
>> </plugin>
>> - <!-- plugin>
>> - Apply the Checkstyle configurations defined in the top
>> level pom.xml file
>> + <plugin>
>> + <!-- Apply the Checkstyle configurations defined in the top
>> level pom.xml file -->
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-checkstyle-plugin</artifactId>
>> - </plugin> -->
>> + </plugin>
>> </plugins>
>> </build>
>> </project>
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/
>> xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/
>> macro/toc/TocMacro.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/
>> toc/TocMacro.java 2009-01-31 18:02:32 UTC (rev 15981)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/
>> toc/TocMacro.java 2009-01-31 18:22:16 UTC (rev 15982)
>> @@ -31,6 +31,7 @@
>> import org.xwiki.rendering.block.ListItemBlock;
>> import org.xwiki.rendering.block.NumberedListBlock;
>> import org.xwiki.rendering.block.HeaderBlock;
>> +import org.xwiki.rendering.block.SectionBlock;
>> import org.xwiki.rendering.internal.util.EnumConverter;
>> import org.xwiki.rendering.listener.Link;
>> import org.xwiki.rendering.macro.AbstractMacro;
>> @@ -108,26 +109,30 @@
>> // Get the root block from scope parameter
>>
>> Block root;
>> - HeaderBlock rootSectionBlock = null;
>>
>> - if (parameters.getScope() == Scope.LOCAL &&
>> context.getCurrentMacroBlock() != null) {
>> + if (parameters.getScope() == Scope.LOCAL) {
>> root = context.getCurrentMacroBlock().getParent();
>> - rootSectionBlock =
>> context
>> .getCurrentMacroBlock().getPreviousBlockByType(HeaderBlock.class,
>> true);
>> } else {
>> root = context.getXDOM();
>> }
>>
>> // Get the list of sections in the scope
>>
>> - List<HeaderBlock> sections =
>> root.getChildrenByType(HeaderBlock.class, true);
>> + List<HeaderBlock> headers =
>> root.getChildrenByType(HeaderBlock.class, true);
>>
>> - if (!sections.isEmpty()) {
>> - // Construct table of content from sections list
>> - Block rootBlock =
>> - generateTree(sections, parameters.getStart(),
>> parameters.getDepth(), parameters.isNumbered(),
>> - rootSectionBlock);
>> + if (!headers.isEmpty()) {
>> + // If the root block is a section, remove it's header
>> block for the list of header blocks
>> + if (root instanceof SectionBlock) {
>> + Block block = root.getChildren().get(0);
>>
>> - return Arrays.asList(rootBlock);
>> + if (block instanceof HeaderBlock) {
>> + headers.remove(block);
>> + }
>> + }
>> +
>> + // Construct table of content from sections list
>> + return Arrays.asList(generateTree(headers,
>> parameters.getStart(), parameters.getDepth(), parameters
>> + .isNumbered()));
>> }
>>
>> return Collections.emptyList();
>> @@ -142,47 +147,31 @@
>> }
>>
>> /**
>> - * Convert sections into list block tree.
>> + * Convert headers into list block tree.
>> *
>> - * @param sections the sections to convert.
>> + * @param headers the headers to convert.
>> * @param start the "start" parameter value.
>> * @param depth the "depth" parameter value.
>> * @param numbered the "numbered" parameter value.
>> - * @param rootSectionBlock the section where the toc macro
>> search for children sections.
>> * @return the root block of generated block tree.
>> */
>> - private Block generateTree(List<HeaderBlock> sections, int
>> start, int depth, boolean numbered,
>> - HeaderBlock rootSectionBlock)
>> + private Block generateTree(List<HeaderBlock> headers, int
>> start, int depth, boolean numbered)
>> {
>> - int rootSectionLevel = rootSectionBlock != null ?
>> rootSectionBlock.getLevel().getAsInt() : 0;
>> - boolean rootSectionFound = false;
>> -
>> int currentLevel = 0;
>> Block currentBlock = null;
>> - for (HeaderBlock sectionBlock : sections) {
>> - int sectionLevel = sectionBlock.getLevel().getAsInt();
>> + for (HeaderBlock headerBlock : headers) {
>> + int headerLevel = headerBlock.getLevel().getAsInt();
>>
>> - if (rootSectionBlock != null) {
>> - if (rootSectionBlock == sectionBlock) {
>> - rootSectionFound = true;
>> - continue;
>> - } else if (rootSectionBlock.getParent() ==
>> sectionBlock.getParent() && sectionLevel <= rootSectionLevel) {
>> - break;
>> - }
>> - } else {
>> - rootSectionFound = true;
>> - }
>> + if (headerLevel >= start && headerLevel <= depth) {
>> + ListItemBlock itemBlock =
>> createTocEntry(headerBlock);
>>
>> - if (rootSectionFound && sectionLevel >= start &&
>> sectionLevel <= depth) {
>> - ListItemBlock itemBlock =
>> createTocEntry(sectionBlock);
>> + // Move to next header in toc tree
>>
>> - // Move to next section in toc tree
>> -
>> - while (currentLevel < sectionLevel) {
>> + while (currentLevel < headerLevel) {
>> currentBlock = createChildListBlock(numbered,
>> currentBlock);
>> ++currentLevel;
>> }
>> - while (currentLevel > sectionLevel) {
>> + while (currentLevel > headerLevel) {
>> currentBlock = currentBlock.getParent();
>> --currentLevel;
>> }
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/
>> xwiki-rendering-macro-toc/src/test/java/org/xwiki/rendering/
>> RenderingTests.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/src/test/java/org/xwiki/rendering/
>> RenderingTests.java 2009-01-31 18:02:32 UTC (rev 15981)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-
>> rendering-macro-toc/src/test/java/org/xwiki/rendering/
>> RenderingTests.java 2009-01-31 18:22:16 UTC (rev 15982)
>> @@ -37,12 +37,14 @@
>> {
>> RenderingTestSuite suite = new RenderingTestSuite("Test Toc
>> Macro");
>>
>> - suite.addTestsFromResource("macrotoc1", true);
>> + /*suite.addTestsFromResource("macrotoc1", true);
>> suite.addTestsFromResource("macrotoc2", true);
>> suite.addTestsFromResource("macrotoc3", true);
>> suite.addTestsFromResource("macrotoc4", true);
>> - suite.addTestsFromResource("macrotoc5", true);
>> + suite.addTestsFromResource("macrotoc5", true);*/
>>
>> + suite.addTestsFromResource("macrotoc4", true);
>> +
>> return new RenderingPlexusTestSetup(suite);
>> }
>> }
>
> _______________________________________________
> devs mailing list
> devs(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>
--
Thomas Mortagne