From 29ebdd79c31797620760fdb6c1ce8dd81f5279d9 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Tue, 17 Mar 2015 00:05:32 +0200 Subject: [PATCH] Add 'introduced' into calls-by-tag list --- website/buildsite.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/website/buildsite.py b/website/buildsite.py index d298e559..c8dc55fb 100644 --- a/website/buildsite.py +++ b/website/buildsite.py @@ -262,11 +262,17 @@ def processApiDoc(doc, testrefs, used_tags): res.append('

' % doc['name']) res.append('.%s()' % (doc['name'], doc['name'])) if floating_list_tags and len(doc['tags']) > 0: - p = sorted(doc['tags'], reverse=True) # reversed because floated to right (which reverses DOM order) + # Sort, reverse order because tags are floated to right + # (visual order is reverse of DOM order). Sort version + # number tags last. - # For now, add the introduced version as a tag - if doc.has_key('introduced'): - p = [ doc['introduced'] ] + p + def mycmp(a,b): + return cmp( (a[0].isdigit(), a), (b[0].isdigit(), b) ) + p = sorted(doc['tags'], reverse=True, cmp=mycmp) + + # 'introduced' is automatically added as a tag now + #if doc.has_key('introduced'): + # p = [ doc['introduced'] ] + p if doc.has_key('deprecated'): # XXX: must mark deprecation pass @@ -746,6 +752,10 @@ def generateApiDoc(apidocdir, apitestdir): apidoc['tags'] = [] # ensures tags is present apidoc['name'] = funcname # add funcname automatically + # add 'introduced' version to tag list automatically + if apidoc.has_key('introduced'): + apidoc['tags'].insert(0, apidoc['introduced']) + if 'omit' in apidoc['tags']: print 'Omit API doc: ' + str(funcname) continue