"Exclude in print" not working any more

302 views
Skip to first unread message

Friedrich

unread,
Jun 1, 2013, 10:55:37 AM6/1/13
to mw...@googlegroups.com
Hello,

why doesn't "Vom Druck ausschließen" / "Exclude in print" work any more, everything which should be excluded from print is being printed in the PDF and in the book (preview)?

Please see

http://www.ck-wissen.de/ckwiki/index.php/Kategorie:Vom_Druck_ausschlie%C3%9Fen

and please help!

Regards,
Friedrich

Friedrich

unread,
Jun 1, 2013, 11:19:48 AM6/1/13
to mw...@googlegroups.com
Message has been deleted

Friedrich

unread,
Jun 2, 2013, 5:48:15 PM6/2/13
to mw...@googlegroups.com
There seems to be the same problem in Wikipedia.de, please see:

http://de.wikipedia.org/wiki/Kategorie:Vorlage:Vom_Druck_ausgeschlossen

... includes "Vorlage:Krünitz"

Test: http://de.wikipedia.org/wiki/Benutzer:Friedrich_K./Werkbank

Print result (PDF attached) includes the template "Vorlage:Krünitz" which should not be printed.



Am Samstag, 1. Juni 2013 16:55:37 UTC+2 schrieb Friedrich:
index.php.pdf

Volker Haas

unread,
Jun 6, 2013, 5:17:19 AM6/6/13
to mw...@googlegroups.com
Hi,

the "Exclude in Print" Category indeed does not work anymore. The reason is that we recently changed the logic which renders templates. Essentially we are now using the Wikipedia API to do that - this unfortunately breaks the "exclude in print" functionality (and it won't be possible to make it work again).

The following work-arounds should be used in the future:
For content that is not supposed to be included in the PDF use the css class "noprint":

<div class="noprint">blub noprint</div>

For content that is only supposed to be visible in PDFs and not in the wiki do the following:

<div class="onlyinprint">blub onlyinprint</div>

This css class is ignored by the PDF renderer and thus displayed normally in the PDF. If you modify your Mediawiki css file to include

.onlyinprint {display: none}

the content will not be visible in the wiki.

I hope this solution works for you.

Best Regards,
Volker

Friedrich Fuchs

unread,
Jun 6, 2013, 2:17:08 PM6/6/13
to mw...@googlegroups.com

Hi Volker,

 

thank you very much!

 

Partial success, the following seems to work and the template is excluded from print:

 

http://www.ck-wissen.de/ckwiki/index.php?title=Vorlage:Gesundheitshinweis&diff=15663&oldid=15638

 

 

But unfortunately we can’t get the “Vorlage:ImDruckVerbergen” to work as it used to work, for the content of this template please see

 

http://www.ck-wissen.de/ckwiki/index.php?title=Vorlage:ImDruckVerbergen&diff=15672&oldid=15669

 

Now it is even worse, on some pages it seems to work and on some pages it does not work. In a full PDF-book download it did not seem to work at all, even if some single article PDF prints seem to render OK.

 

What should the content of the template “Exclude in print”

 

http://www.ck-wissen.de/ckwiki/index.php/Vorlage:ImDruckVerbergen

 

exactly be, to be able to use this template within the article pages as we used it before the change?  

 

Thank you very much for your help, best wishes!

Friedrich

--
You received this message because you are subscribed to a topic in the Google Groups "mwlib" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mwlib/mdiqIWwH3RQ/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to mwlib+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

William Tucker

unread,
Jun 10, 2013, 3:21:34 PM6/10/13
to mw...@googlegroups.com
In my version of MediaWiki, there is a user preference option labeled "Real
name" which says " Real name is optional. If you choose to provide it, this
will be used for giving you attribution for your work."

I would like to have this real name value appear in all attributions
generated from MWLIB for image and article contributors instead of the
MediaWiki username.

I am aware of the http://www.mediawiki.org/wiki/Extension:Realnames
extension; but, I suspect that this will not change what is displayed in the
contributors lists of MWLib output. Am I wrong about that?

Short of forcing all users of my wiki to use their real name as their
username for proper attribution, can I get MWLib to use the real name
property if set and fall back on the username if not?

Thanks,
William

William Tucker

unread,
Jun 14, 2013, 5:38:09 PM6/14/13
to mw...@googlegroups.com
Update:

I modified the MediaWiki software to add the real name in the result for
revisions queries to the API in ApiQueryRevisions.php.

I then modified my copy of MWLib authors.py to use the real name and fall
back to the username if the real name is blank. This results in the proper
attribution I was seeking.

William

stefan...@gmail.com

unread,
Jun 17, 2013, 4:43:00 AM6/17/13
to mw...@googlegroups.com
Hi William,

what changes did you make in these files? I'm still looking for a way to show the real names in my PDFs.

Regards
Stefan

William Tucker

unread,
Jun 17, 2013, 10:39:19 AM6/17/13
to mw...@googlegroups.com
From: stefan...@gmail.com
what changes did you make in these files? I'm still looking for a way to
show the real names in my PDFs.

Hi Stefan,

I am replying to the group in case others find this useful or wish to
comment to make it better.

In ApiQueryRevisions.php, I modified the list of tables to look like this:
$this->addTables('revision');
$this->addFields(Revision::selectFields());
$this->addTables('user');
$this->addWhere('rev_user = user_id');
$this->addFields('user_real_name');
$this->addTables('page');
$this->addWhere('page_id = rev_page');

This causes the user table to be joined such that user_real_name is
available later.

Then, I add to vals when user is specified as one of the fields:

if ($this->fld_user) {
if ($revision->isDeleted(Revision::DELETED_USER)) {
$vals['userhidden'] = '';
} else {
$vals['user'] = $revision->getUserText();
$vals['user_real_name'] = $row->user_real_name;
if (!$revision->getUser())
$vals['anon'] = '';
}

I found some of this code to be different for different versions of
MediaWiki so it is likely that you will have to think about it and
understand the change instead of just copy/paste.

The result of this is that when “user” is specified in query revisions, a
property for “user_real_name” will also be included. Example template:
http://<url>/api.php?action=query&prop=revisions&rvlimit=500&rvprop=ids|timestamp|flags|comment|user|size&titles=<title>

Finally, in authors.py, I modified scan_edits to look like:
def scan_edits(self, revs):
authors = self.authors

for r in revs:
user = r.get('user', u'')
user_real_name = r.get('user_real_name', u'')
if not user_real_name:
user_real_name = user
if 'anon' in r and (not user or self.ip_rex.match(user)): # anon
self.num_anon += 1
elif not user:
continue
elif self.bot_rex.search(user) or
self.bot_rex.search(r.get('comment', '')):
continue # filter bots
else:
authors.add(user_real_name)

I am not certain as to all of the side effects of this change; but, it
accomplishes exactly what I wanted for my purposes.

Hope this helps,
William



Reply all
Reply to author
Forward
0 new messages