Kaydet (Commit) c51e789b authored tarafından Julien Nabet's avatar Julien Nabet

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/38631Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
(cherry picked from commit e34b0283)
Reviewed-on: https://gerrit.libreoffice.org/38646
üst ef4f47e2
......@@ -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 );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment