primary_topic_format for pfl wiki, code improvements

- import config and use the library implicit instead of
  intrinsic use of pywikibot.config
- remove obsolete variables
- use pywikibot.output instead of print statement
- some updates from core

Change-Id: I8616dd7954c8e17aa15f9c80872c33835db06815
Merge "primary_topic_format for pfl wiki, code improvements"