Hello,

I don't understand why the removal of entire sections, even if empty, is considered as ''cosmetic change''. Before this evolutions the CC had no change on the render of the page. 

There are still some bugs because of this evolution.

When a title of section is immediatly followed by an HTML comment the script crash


exemple : https://fr.wikipedia.org/w/index.php?title=Pr%C3%A9vost&diff=151365252&oldid=151360267

log :
ERROR: Fatal error:
Traceback (most recent call last):
  File "/data/project/herculebot/pywikibot-core/scripts/template.py", line 382, in <module>
    main()
  File "/data/project/herculebot/pywikibot-core/scripts/template.py", line 377, in main
    bot.run()
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/scripts/replace.py", line 833, in run
    callback=self._replace_sync_callback, quiet=True)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/tools/__init__.py", line 1488, in wrapper
    return obj(*__args, **__kw)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/tools/__init__.py", line 1488, in wrapper
    return obj(*__args, **__kw)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/page.py", line 1275, in save
    cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/page.py", line 127, in wrapper
    handle(func, self, *args, **kwargs)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/page.py", line 109, in handle
    func(self, *args, **kwargs)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/page.py", line 1283, in _save
    summary = self._cosmetic_changes_hook(summary)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/page.py", line 1329, in _cosmetic_changes_hook
    self.text = cc_toolkit.change(old)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/cosmetic_changes.py", line 301, in change
    new_text = self._change(text)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/cosmetic_changes.py", line 295, in _change
    text = self.safe_execute(method, text)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/cosmetic_changes.py", line 282, in safe_execute
    result = method(text)
  File "/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywikibot/cosmetic_changes.py", line 696, in removeEmptySections
    current_heading = sections[i][0]

Regards

Hercule

2018-05-29 17:07 GMT+02:00 Dalba <dalba.wiki@gmail.com>:
That's OK. I've sent a patch for review at
https://gerrit.wikimedia.org/r/#/c/436028/ .

On Tue, May 29, 2018 at 7:18 PM Antoine Delarue <antoinedelarue@hotmail.com>
wrote:

> I don't know how to edit the code. I'm a user of the existing scripts,
with no changes.


> I run my bot form WMFLabs.


> Regards


> Hercule

_______________________________________________
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot