yuvipanda / WPSignpost

Wikipedia Signpost Android Application
7 stars 5 forks source link

App should support unlinked authors #21

Open Jarry1250 opened 12 years ago

Jarry1250 commented 12 years ago

Occasionally the Signpost features non-Wikimedia authors. I don't understand the following fully, but I think it's looking for links:

# Author tag
author_el = doc.cssselect("dd a[href*='User:'], .signpost-author a[href*='User:']")
author_el = author_el[0] if len(author_el) != 0 else None
if author_el is not None:
    author_name, author_link = unicode(author_el.text), unicode(author_el.get('href'))
    author_parent = author_el.xpath("ancestor::dl")
    if author_parent:
        author_parent[0].drop_tree()
else:
    author_name = author_link = u'Unknown'

I suggest you take the contents of signpost-author and explode by comma, it would surely be a lot easier.

yuvipanda commented 12 years ago

Currently, the author names aren't even displayed anywhere :P (I know, I need to fix this)

yuvipanda commented 12 years ago

The scraping for author names is also a mess - especially if you look at earlier issues.

Jarry1250 commented 12 years ago

I think we've had header templates for a good few years now - let me know if you would like me to add .signpost-author to any older templates / pages in the legacy format.

yuvipanda commented 12 years ago

That would be awesome :) On Aug 20, 2012 4:46 PM, "Jarry1250" notifications@github.com wrote:

I think we've had header templates for a good few years now - let me know if you would like me to add .signpost-author to any older templates / pages in the legacy format.

— Reply to this email directly or view it on GitHubhttps://github.com/yuvipanda/WPSignpost/issues/21#issuecomment-7866300.

Jarry1250 commented 12 years ago

Link? :P

yuvipanda commented 12 years ago

Ahem, I thought you said the older ones had templates. When I checked, the older articles just used a :: to offset the byline, and thus made this sortof hard. The only proper solution is to wrap just the author names in some sort of span.

Jarry1250 commented 12 years ago

Yeah, I should have checked that. The issue of February 16, 2009 had the first templates, so that output includes .signpost author. For 2.5 years before then, the equivalent of:

if( $( 'dd small' ).length === 1 ) { var authorsAndDate = $( 'dd small' ).html(); var authors = ....; }

would work. But just supporting 3.5 years is probably enough for the time being.

yuvipanda commented 12 years ago

That code is already included :) But I'm looking for links inside that (since there is a lot of stuff inside that!) so it will still miss non-linked authors.

On Mon, Aug 20, 2012 at 5:10 PM, Jarry1250 notifications@github.com wrote:

Yeah, I should have checked that. The issue of February 16, 2009 had the first templates, so that output includes .signpost author. For 2.5 years before then, the equivalent of:

if( $( 'dd small' ).length === 1 ) { var authorsAndDate = $( 'dd small' ).html(); var authors = ....; }

would work. But just supporting 3.5 years is probably enough for the time being.

— Reply to this email directly or view it on GitHubhttps://github.com/yuvipanda/WPSignpost/issues/21#issuecomment-7866698.

Yuvi Panda T http://yuvi.in/blog

Jarry1250 commented 12 years ago

Hmm, I've thought about this more and I think it might indeed be too difficult to be more intelligent here, though depending on your preferred display it might make more sense just to display the actual byline prettily rather than trying to parse it?

On a related note, you should have history links for attribution purposes: not appearing in the byline isn't really a CC-BY-SA opt-out. (Maybe you've already got this and I just didn't see it.)

yuvipanda commented 12 years ago

Opened #24 for that.