diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-06-10 10:45:23 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-06-10 23:02:15 +0200 |
commit | e34b02834b24be4062ffd535aa1b929481ff427e (patch) | |
tree | bf593fde0e395411ec7803289d5d91e81f79759e /swext | |
parent | b80935d5c45f26876d9fa2718c7a6b9a469b12cf (diff) |
tdf#97743: mediawiki account
To find main url in header section, search link containing:
- load.php
- or opensearch_desc.php
In Wikipedia or wiki.documentfoundation.org, I haven't seen any link with index.php
Change-Id: Iccb27aa8aaaf936faf8ec3b3f67eaa98d0426f19
Reviewed-on: https://gerrit.libreoffice.org/38631
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'swext')
-rw-r--r-- | swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java index 4ef08950c11b..114709fae36e 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java +++ b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java @@ -103,13 +103,16 @@ public class EditPageParser extends HTMLEditorKit.ParserCallback String sName = ( String ) a.getAttribute( HTML.Attribute.HREF ); if ( sName != null ) { - int nIndexStart = sName.indexOf( "index.php" ); - // get the main URL from the first header-link with index.php - // the link with "action=edit" inside is preferable - if ( nIndexStart>= 0 - && ( m_sMainURL.length() == 0 || sName.contains("action=edit") ) ) + // get the main URL from the first header-link with load.php (which is used for stylesheet) + int nPhpFileStart = sName.indexOf( "load.php" ); + if (nPhpFileStart < 0) + // if not found, try header-link with opensearch_desc.php + nPhpFileStart = sName.indexOf( "opensearch_desc.php" ); + + if ( nPhpFileStart >= 0 + && m_sMainURL.length() == 0 ) { - m_sMainURL = sName.substring( 0, nIndexStart ); + m_sMainURL = sName.substring( 0, nPhpFileStart ); } } } |