[Wikitech-l] Inserting single line breaks in VisualEditor (from mediwiki-l)

2023-07-24 Thread Robert Vogel via Wikitech-l
HINT: This is a crossposting from mediawiki-l

Hello everyone!

With this message I am reaching out to the developers/maintainers of 
Extension:VisualEditor. I have already tried the mw.org support desk [1] and 
IRC without much success.

1. I was wondering if there were any technical reasons for 
Extension:VisualEditor not inserting a `` element on `SHIFT+ENTER`. This 
seems to be standard functionality in most other visual HTML editors, plus `` is supported by wikitext.
2. If there was no technical reason, I'd ask for support to implement a Gadget 
that allows for this behavior. I have already tried a couple of things, but it 
looks like the `SHIFT+ENTER` event can not be handeled easily. Apparently some 
core code handles the event and always creates a new paragraph. I did not 
succeed to stop propagation and override this behavior from my handler.

Maybe I am just missing something here. Any help would be much appreciated.

[1] https://www.mediawiki.org/wiki/Topic:Xhywmkd6b0mnwjk7

Greetings,
Robert Vogel


___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] VisualEditor inserting ``

2023-03-13 Thread Robert Vogel via Wikitech-l
Hi everyone!
Inspired by 
https://www.mediawiki.org/wiki/VisualEditor/Gadgets#Implementing_a_custom_command
 I was trying to add a `` into the VE using this command:

```
ve.init.target.getSurface().getModel().getFragment().insertContent( [ { type: 
'break' }, { type: '/break' } ] );
```

While it actually inserted the line break in visual edit mode, there was not 
`` in the wikitext after saving the page or switching to wikitext mode 
within the edit session.
I also tried to implement the whole "command/tool" in an extension, but the 
behavior was the same. The odd thing is that a `` inserted  in wikitext 
mode survives the round trip. The linear data model shows it as "alienInline" 
node then.

Any ideas why the official example didn't work for me?

Greetings,
Robert
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: help mediawiki extension

2023-01-12 Thread Robert Vogel via Wikitech-l
Hi!

Change

use UrlUtils;

to

use MediaWiki\Utils\UrlUtils;

-
Robert

Von: Tim Moody 
Gesendet: Donnerstag, 12. Januar 2023 16:27
An: Wikitech-l 
Betreff: [Wikitech-l] Re: help mediawiki extension

I'm still a brick shy of a load:

in extension.json I have

"HookHandlers": {
"main": {
"class": "MediaWiki\\Extension\\OurWorldInData\\Hooks",
"services": [
"MainConfig",
"UrlUtils"
]
}
},

in Hooks.php I have

use Config;
use Html;
use UrlUtils;
use MediaWiki\Hook\ParserFirstCallInitHook;
use MWException;
use Parser;
use PPFrame;

class Hooks implements ParserFirstCallInitHook {
/** @var Config Main config */
private Config $config;
private UrlUtils $urlUtils;

/**
 * @param Config $config Main config
 */
public function __construct( Config $config, UrlUtils $urlUtils ) {
$this->config = $config;
$this->urlUtils = $urlUtils;
}


I get

TypeError: MediaWiki\Extension\OurWorldInData\Hooks::__construct(): Argument #2 
($urlUtils) must be of type UrlUtils, MediaWiki\Utils\UrlUtils given


On Wed, Jan 11, 2023 at 10:14 PM D 
mailto:dylss...@gmail.com>> wrote:
$urlUtils->parse() is not a static method.

Non-dependency injection way:

use MediaWiki\MediaWikiServices;

$urlUtils = MediaWikiServices::getInstance()->getUrlUtils()

$urlUtils->parse()

Otherwise inject the UrlUtils service. For example, if using HookHandlers[1], 
add the service to your extension registration extension.json:
{
"HookHandlers": {
"main": {
"class": "MediaWiki\\Extension\\Example\\Hooks",
"services": [ "UrlUtils" ]
}
},
"Hooks": {
"ParserFirstCallInit": "main"
}
}

Then the service will be injected into your __construct(UrlUtils $urlUtils) 
method as an argument.

[1] 
https://www.mediawiki.org/wiki/Manual:Hooks#Handling_hooks_in_MediaWiki_1.35_and_later

On Wed, Jan 11, 2023 at 6:36 PM Tim Moody 
mailto:t...@timmoody.com>> wrote:
On MW 1.39.0 and .1 and PHP 8.1.2-1ubuntu2.9,

I am trying to revise a parserhook extension to mediawiki that uses 
wfParseUrl(). 
https://doc.wikimedia.org/mediawiki-core/master/php/GlobalFunctions_8php.html#a178b2b51ef87926e5daa08f66fbae9b0
 says that is deprecated and I should use UrlUtils::parse().

The former looks like a function and the latter looks like a class, perhaps a 
subclass of Utils. My first question is what if any use statement do I need. 
The extension already has use Html, but use UrlUtils gives an error because it 
can't be found.

Do I need to instantiate Utils or UrlUtils and invoke the urlparser as 
$urlUtils -> parse()? When I invoke UrlUtils::parse I get a complaint about 
calling a non-static method statically.

The old code was
$url_parts = wfParseUrl( $graph_url );
and the new
$url_parts = UrlUtils::parse( $graph_url );

Any help would be appreciated.

Tim
___
Wikitech-l mailing list -- 
wikitech-l@lists.wikimedia.org
To unsubscribe send an email to 
wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
___
Wikitech-l mailing list -- 
wikitech-l@lists.wikimedia.org
To unsubscribe send an email to 
wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: How to specify version of MW that Jenkins should run?

2022-09-15 Thread Robert Vogel via Wikitech-l
@Hashar: Just wondering, are there any plans to change CI configs after moving 
development/code-review from gerrit to gitlab [1]? Maybe some file living in 
the repo directly rather than using a centralized repo like 
`integration/config`?

[1] https://www.mediawiki.org/wiki/GitLab/Gerrit_to_GitLab

--
Robert

Von: Antoine Musso 
Gesendet: Dienstag, 13. September 2022 15:42
An: Wikitech-l ; Sebastian Berlin 

Betreff: [Wikitech-l] Re: How to specify version of MW that Jenkins should run?

Le 12/09/2022 à 12:20, Sebastian Berlin a écrit :
I'm having some issues with Jenkins running the latest version of MW for an 
extension (Wikispeech). 
Jenkins run with the 1.40 alpha, but we want the extension to support the 
latest LTS (1.35 as of right now).

I tried changing in extension.json to:
"requires": {
 "MediaWiki": "1.35.*"
}
which caused an error for Jenkins:
12:44:09 A dependency error was encountered while installing the extension 
"Wikispeech": Wikispeech is not compatible with the current MediaWiki core 
(version 1.40.0-alpha), it requires: 1.35.*.
The whole log is here: https://phabricator.wikimedia.org/P34482.

How can I specify what version of MW to run with? I've looked at both the MW 
wiki and Wikitech, but hasn't found any instructions for this.

Hello,

There are a lot of good answers and hints in this thread. I will complement the 
answers since I am the one that has introduced the CI system currently used for 
MediaWiki and I used to be in the Wikimedia Foundation team which was 
responsible for MediaWiki development (Platform Engineering, disbanded in 2015).

MediaWiki is primarily developed for the Wikimedia project and the focus on CI 
is to ensure that the master branch of MediaWiki core, extensions, skins and 
their composer dependencies are working well together.  The CI jobs prefixed 
"wmf-quibble" clone a few dozen of extensions and are triggered whenever one 
send a patch to one of those extensions or mediawiki/core. Hence we have more 
or less a guarantee that the master branches of the participating repositories 
are all working together.

For the deployment to the Wikimedia cluster, we cut a new deployment branch 
(wmf/XXX) directly from the master branch. Since a change could only have been 
merged in the master branch if all the CI jobs passed, we are pretty sure that 
the set of repositories with their wmf branches are passing tests. There are 
some caveats still but that is the rough idea.

The MediaWiki releases are generated from the REL* branches and CI follows the 
same logic. If one send a patch to their extensions REL1_35 branch, CI checkout 
the REL1_35 branch of mediawiki/core and any other repositories participating 
in the job.

Thus if you send a patch to WikiSpeech REL1_35 you would get mediawiki/core and 
Vector at REL1_35 as well ensuring everything works well together (and by 
everything, I mean what ever is covered by tests). But if you send a patch for 
the master branch, it is the master branch of all repositories being checked 
out. In all case the value(s) of the requires field in extension.json does not 
affect the branch used in CI. It is entirely based on the convention that all 
repos are using the same branch.

There are lot of use cases for developers ensuring the master branch is 
compatible with the current development version (master) AND keeping back 
compatibility all the way up to the latest LTS. But that is not enforced by CI. 
I know Translate does it, most probably through manual testing.


What we could potentially do is create a job which would inspect the extension 
requires field to get the target branch to test (so if one requires 1.35, 
target the REL1_35 branch) then invoke the testrunner with that branch override 
(--branch REL1_35). Then if you send a patch to WikiSpeech master branch, such 
a job would test its code against mediawiki/core / vector using REL1_35. I am 
not entirely sure how to implement it, but the best place would probably be 
https://gerrit.wikimedia.org/g/integration/quibble/  It is the code holding all 
the logic to clone/checkout repositories, setup MediaWiki and run the test 
suite.  I am guessing when a change is targeting an extension or skin, Quibble 
would clone it first, inspect the extension.json and then internally set the 
default branch (the `--branch` parameter). And we can have a Jenkins job using 
that feature and running along the rest of the jobs.

It will most probably be fine for extensions that do not have many other 
dependencies.

The relevant task would be https://phabricator.wikimedia.org/T196467 . I think 
the devil is defining the workflow that is needed, which is more or less the 
text above.


Antoine "hashar" Musso




___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org

[Wikitech-l] Re: How to specify version of MW that Jenkins should run?

2022-09-12 Thread Robert Vogel via Wikitech-l
The "DonationInterface" has some "special handling" in the CI config: 
https://github.com/wikimedia/integration-config/blob/d2ef596ea8f697c0920270939c1bf967e0be/zuul/layout.yaml#L4464-L4480

They apparently use some dedicated Quibble test runner: 
https://github.com/wikimedia/integration-config/blob/d2ef596ea8f697c0920270939c1bf967e0be/jjb/wm-fundraising.yaml#L63-L76

I don't think this pattern can easily be re-used.

Von: Ostrzyciel 
Gesendet: Montag, 12. September 2022 16:42
An: wikitech-l@lists.wikimedia.org 
Betreff: [Wikitech-l] Re: How to specify version of MW that Jenkins should run?

Hi all,

I've been looking into a similar thing for a different extension, where I 
wanted it to be compatible with MW 1.37+ (see 
task<https://phabricator.wikimedia.org/T316479>). Basically, I want the tests 
to run both on REL1_37 and master to make sure that whatever I merge is 
compatible with 1.37. The cherry-picking approach is not a valid solution, as 
it's tedious, error-prone, and I can never be sure that the patch works with 
both branches.

I know of one extension that seemingly has something like this: 
DonationInterface. For example, this master 
patch<https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DonationInterface/+/733965>
 had its tests run against REL1_35.

Can something like this be replicated in other extensions? I think it's a vital 
feature for extension developers, because compatibility with only master is 
next to useless. To be honest, it boggles my mind that this hasn't become 
common practice long ago.

--
The Slightly Mind-Boggled Ostrzyciel

On 12/09/2022 16:14, Robert Vogel via Wikitech-l wrote:
The continous integration testing currently uses the same branch fot the 
"dependecies" as it tests. So if you create a change set on branch `master`, it 
will use `master` for all the other repos (like mw core, extensions, skins) it 
clones to build up the environment. I am not aware of any way to influence this 
on a per repo level.

The only way I am currently aware of is to commit against a branch called 
`REL1_35` of your extension and then cherry-pick the changes up to `master`, 
once the tests have passed. This will make the CI tests use the `REL1_35` 
branch of each dependency (including mw core).

--
Robert

Von: Sebastian Berlin 
<mailto:sebastian.ber...@wikimedia.se>
Gesendet: Montag, 12. September 2022 12:20
An: Wikimedia developers 
<mailto:wikitech-l@lists.wikimedia.org>
Betreff: [Wikitech-l] How to specify version of MW that Jenkins should run?

I'm having some issues with Jenkins running the latest version of MW for an 
extension (Wikispeech<https://www.mediawiki.org/wiki/Extension:Wikispeech>). 
Jenkins run with the 1.40 alpha, but we want the extension to support the 
latest LTS (1.35 as of right now).

I tried changing in extension.json to:
"requires": {
 "MediaWiki": "1.35.*"
}
which caused an error for Jenkins:
12:44:09 A dependency error was encountered while installing the extension 
"Wikispeech": Wikispeech is not compatible with the current MediaWiki core 
(version 1.40.0-alpha), it requires: 1.35.*.
The whole log is here: https://phabricator.wikimedia.org/P34482.

How can I specify what version of MW to run with? I've looked at both the MW 
wiki and Wikitech, but hasn't found any instructions for this.

Best,

Sebastian Berlin
Utvecklare/Developer
Wikimedia Sverige (WMSE)

E-post/E-Mail: 
sebastian.ber...@wikimedia.se<mailto:sebastian.ber...@wikimedia.se>
Telefon/Phone: (+46) 0707 - 92 03 84



___
Wikitech-l mailing list -- 
wikitech-l@lists.wikimedia.org<mailto:wikitech-l@lists.wikimedia.org>
To unsubscribe send an email to 
wikitech-l-le...@lists.wikimedia.org<mailto:wikitech-l-le...@lists.wikimedia.org>
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: How to specify version of MW that Jenkins should run?

2022-09-12 Thread Robert Vogel via Wikitech-l
The continous integration testing currently uses the same branch fot the 
"dependecies" as it tests. So if you create a change set on branch `master`, it 
will use `master` for all the other repos (like mw core, extensions, skins) it 
clones to build up the environment. I am not aware of any way to influence this 
on a per repo level.

The only way I am currently aware of is to commit against a branch called 
`REL1_35` of your extension and then cherry-pick the changes up to `master`, 
once the tests have passed. This will make the CI tests use the `REL1_35` 
branch of each dependency (including mw core).

--
Robert

Von: Sebastian Berlin 
Gesendet: Montag, 12. September 2022 12:20
An: Wikimedia developers 
Betreff: [Wikitech-l] How to specify version of MW that Jenkins should run?

I'm having some issues with Jenkins running the latest version of MW for an 
extension (Wikispeech). 
Jenkins run with the 1.40 alpha, but we want the extension to support the 
latest LTS (1.35 as of right now).

I tried changing in extension.json to:
"requires": {
 "MediaWiki": "1.35.*"
}
which caused an error for Jenkins:
12:44:09 A dependency error was encountered while installing the extension 
"Wikispeech": Wikispeech is not compatible with the current MediaWiki core 
(version 1.40.0-alpha), it requires: 1.35.*.
The whole log is here: https://phabricator.wikimedia.org/P34482.

How can I specify what version of MW to run with? I've looked at both the MW 
wiki and Wikitech, but hasn't found any instructions for this.

Best,

Sebastian Berlin
Utvecklare/Developer
Wikimedia Sverige (WMSE)

E-post/E-Mail: 
sebastian.ber...@wikimedia.se
Telefon/Phone: (+46) 0707 - 92 03 84
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Help +2 php 8.1 updates

2022-07-12 Thread Robert Vogel via Wikitech-l
Thanks Mark, that's just awesome!

I'd like to express my support for those changes and also kindly ask the core 
developers of MediaWiki to review those changes.

--
Robert

Von: Mark A. Hershberger via Wikitech-l 
Gesendet: Mittwoch, 6. Juli 2022 16:07
An: Wikitech 
Cc: Mark A. Hershberger 
Betreff: [Wikitech-l] Help +2 php 8.1 updates


MediaWiki devs,

I've been running the test suite using PHP 8.1 and providing patches in
Gerrit.  I've gotten some feedback but I am hoping that I can get the
requisite +2's to get these fixes incorporated into MediaWiki.

I have several patches outstanding with no comments.  If they could be
+2'd that would be awesome.

If they need more work before they're accepted, please let me know how
they are lacking so that I can update them.

Most of these can be found here:
https://gerrit.wikimedia.org/r/q/topic:change-809720

Thanks!

Mark.


--
http://hexmode.com/

I cannot remember the books I've read any more than the meals I have eaten;
even so, they have made me.
-- Ralph Waldo Emerson
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/