From 91bd0c769fef6c62aa065f3ef22c3cb7d890c597 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 28 Jul 2014 21:14:40 +0000 Subject: Add description, date, and change log to documentation index. --- doc/style.css | 26 ++++---- lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl | 2 +- lv2/lv2plug.in/ns/index.html.in | 67 ++++++++++++++++++- lv2/lv2plug.in/ns/meta/meta.ttl | 2 +- lv2specgen/lv2specgen.py | 70 ++++++++++++-------- lv2specgen/template.html | 3 +- wscript | 101 ++++++++++++++++++++++------- 7 files changed, 204 insertions(+), 67 deletions(-) diff --git a/doc/style.css b/doc/style.css index f5f37d5..a6cc11e 100644 --- a/doc/style.css +++ b/doc/style.css @@ -33,28 +33,28 @@ h1 { } h2 { font-size: 140%; - font-weight: 650; + font-weight: 700; } h3 { font-size: 130%; - font-weight: 600; + font-weight: 700; } h4 { font-size: 120%; - font-weight: 550; + font-weight: 700; } h5 { font-size: 110%; - font-weight: 500; + font-weight: 700; } h6 { font-size: 100%; - font-weight: 450; + font-weight: 700; } #header { background-color: #F0F0F0; border: 0; - border-bottom: 1px solid #E8E8E8; + border-bottom: 1px solid #D8D8D8; margin: 0; padding: 1ex; vertical-align: top; @@ -91,16 +91,16 @@ h6 { #title { font-size: 200%; font-weight: 700; - margin: 0 0 .25ex 0; - padding: 0; + margin: 0 0 0.25ex 0; + padding: 0 0 0 0; } #subtitle { - font-size: x-small; - margin-bottom: 1em; + font-size: small; } #shortdesc { font-size: small; font-style: italic; + margin-top: 1em; } #logo { height: 63px; @@ -405,9 +405,9 @@ ul, ol { #contents { background-color: #F3F3F3; border: 0; - border-bottom: 1px solid #EAEAEA; - padding: 0.25ex 0 0 0.5ex; - vertical-align: top; + border-bottom: 1px solid #D8D8D8; + padding: 0.25ex 0 0.25ex 1ex; + vertical-align: middle; font-size: small; } #contents li { diff --git a/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl b/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl index c61096a..6316b4b 100644 --- a/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl +++ b/lv2/lv2plug.in/ns/ext/log/lv2-log.doap.ttl @@ -17,7 +17,7 @@ dcs:blame ; dcs:changeset [ dcs:item [ - rdfs:label "Add missing include to logger.h for memset." + rdfs:label "Add missing include string.h to logger.h for memset." ] ] ] , [ diff --git a/lv2/lv2plug.in/ns/index.html.in b/lv2/lv2plug.in/ns/index.html.in index 2134e44..fbaacc3 100644 --- a/lv2/lv2plug.in/ns/index.html.in +++ b/lv2/lv2plug.in/ns/index.html.in @@ -10,9 +10,44 @@ href="../aux/style.css" /> + + + + + +

Description

+
+

This is an index of all official LV2 specifications. These pages are + high-level descriptions of each specification, and vocabulary + references with API links where appropriate. A + global API reference is also + available.

+ + +

Index

@@ -24,5 +59,35 @@ @ROWS@
+ + +

History

+
+ @HISTORY@ +
+ + + + diff --git a/lv2/lv2plug.in/ns/meta/meta.ttl b/lv2/lv2plug.in/ns/meta/meta.ttl index ecbf315..e6bd3a4 100644 --- a/lv2/lv2plug.in/ns/meta/meta.ttl +++ b/lv2/lv2plug.in/ns/meta/meta.ttl @@ -48,7 +48,7 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R meta:kfoltman , meta:paniq ; doap:release [ - doap:revision "1.8.1" ; + doap:revision "1.8.3" ; doap:created "2014-01-23" ; dcs:changeset [ dcs:item [ diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index 1c4b93c..3b8e5d5 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -182,7 +182,7 @@ if have_pygments: aliases = ['n3', 'turtle'] filenames = ['*.n3', '*.ttl', '*.nt'] mimetypes = ['text/rdf+n3','application/x-turtle','application/n3'] - + tokens = { 'comments': [ (r'(\s*#.*)', Comment) @@ -203,7 +203,7 @@ if have_pygments: (r'\s*[a-zA-Z_:][a-zA-Z0-9\-_:]*\b\s*', Name.Tag, 'object'), (r'\s*(<[^>]*\>)', Name.Tag, 'object'), (r'\s*\]\s*', Text, '#pop'), - (r'(?=\s*\.\s*)', Keyword, '#pop'), + (r'(?=\s*\.\s*)', Keyword, '#pop'), ], 'objList': [ include('comments'), @@ -222,8 +222,8 @@ if have_pygments: (r'\s*\(', Text, 'objList'), (r'\s*;\s*\n?', Punctuation, '#pop'), (r'\s*,\s*\n?', Punctuation), # Added by drobilla so "," is not an error - (r'(?=\s*\])', Text, '#pop'), - (r'(?=\s*\.)', Text, '#pop'), + (r'(?=\s*\])', Text, '#pop'), + (r'(?=\s*\.)', Text, '#pop'), ], } @@ -242,7 +242,7 @@ def linkify(string): def translateCodeLink(match): return match.group(1) + linkmap[match.group(2)] + match.group(3) - + return rgx.sub(translateCodeLink, string) def getComment(m, urinode, classlist, proplist, instalist): @@ -420,7 +420,7 @@ def parseCollection(model, node): rest = findOne(model, node, rdf.rest, None) if not first or not rest: break; - + uris.append(getObject(first)) node = getObject(rest) @@ -455,7 +455,7 @@ def rdfsClassInfo(term, m): else: meta_type = findOne(m, getObject(st), rdf.type, None) restrictions.append(getSubject(meta_type)) - + if len(superclasses) > 0: doc += "\nSub-class of" first = True @@ -740,7 +740,7 @@ def buildIndex(m, classlist, proplist, instalist=None): return '%s' % (name, name) else: return '%s' % (str(t), str(t)) - + if (len(classlist) > 0): azlist += "
Classes
    " classlist.sort() @@ -913,13 +913,34 @@ def specAuthors(m, subject): return doc -def specHistory(m, subject): - entries = {} +def releaseChangeset(m, release, prefix=''): + changeset = findOne(m, release, dcs.changeset, None) + if changeset is None: + return '' + + entry = '
      ' + for i in findStatements(m, getObject(changeset), dcs.item, None): + item = getObject(i) + label = findOne(m, item, rdfs.label, None) + if not label: + print("error: dcs:item has no rdfs:label") + continue + + text = getLiteralString(getObject(label)) + if prefix: + text = prefix + ': ' + text + + entry += '
    • %s
    • ' % text + + entry += '
    \n' + return entry + +def specHistoryEntries(m, subject, entries={}): for r in findStatements(m, subject, doap.release, None): release = getObject(r) revNode = findOne(m, release, doap.revision, None) if not revNode: - print "error: doap:release has no doap:revision" + print("error: doap:release has no doap:revision") continue rev = getLiteralString(getObject(revNode)) @@ -931,29 +952,22 @@ def specHistory(m, subject): entry = '
    Version %s' % (getObject(dist), rev) else: entry = '
    Version %s' % rev - #print "warning: doap:release has no doap:file-release" + #print("warning: doap:release has no doap:file-release") if created: entry += ' (%s)
    ' % getLiteralString(getObject(created)) else: entry += ' (EXPERIMENTAL)' - changeset = findOne(m, release, dcs.changeset, None) - if changeset: - entry += '
      ' - for i in findStatements(m, getObject(changeset), dcs.item, None): - item = getObject(i) - label = findOne(m, item, rdfs.label, None) - if not label: - print "error: dcs:item has no rdfs:label" - continue + entry += releaseChangeset(m, release) - entry += '
    • %s
    • ' % getLiteralString(getObject(label)) + if dist is not None: + entries[getObject(dist)] = entry - entry += '
    \n' + return entries - entries[rev] = entry +def specHistoryMarkup(entries): if len(entries) > 0: history = '
    ' for e in sorted(entries.keys(), reverse=True): @@ -964,6 +978,10 @@ def specHistory(m, subject): return '' +def specHistory(m, subject): + return specHistoryMarkup(specHistoryEntries(m, subject)) + + def specVersion(m, subject): """ Return a (minorVersion, microVersion, date) tuple @@ -1108,7 +1126,7 @@ def specgen(specloc, indir, style_uri, docdir, tags, opts, instances=False): seeAlso.add(path) m.parse(path, format='n3') done = False - + spec_ns_str = spec_url if (spec_ns_str[-1] != "/" and spec_ns_str[-1] != "#"): spec_ns_str += "#" @@ -1306,7 +1324,7 @@ if __name__ == "__main__": if (len(args) < 3): print(usage()) sys.exit(-1) - + spec_pre = options.prefix ontology = "file:" + str(args[0]) indir = args[1] diff --git a/lv2specgen/template.html b/lv2specgen/template.html index d8b56c6..57d5134 100644 --- a/lv2specgen/template.html +++ b/lv2specgen/template.html @@ -1,3 +1,4 @@ + History @FILES@
-

Description

@@ -88,4 +88,3 @@ - diff --git a/wscript b/wscript index 0c26870..b978170 100644 --- a/wscript +++ b/wscript @@ -117,9 +117,7 @@ def specgen(task): return try: - model = rdflib.ConjunctiveGraph() - for i in glob.glob('%s/*.ttl' % bundle): - model.parse(i, format='n3') + model = load_ttl(glob.glob('%s/*.ttl' % bundle)) except: e = sys.exc_info()[1] print('error parsing %s: %s' % (bundle, str(e))) @@ -130,7 +128,7 @@ def specgen(task): if not ext_node: print('no extension found in %s' % bundle) return - + ext = str(ext_node) # Get version @@ -147,19 +145,18 @@ def specgen(task): date = None for r in model.triples([ext_node, doap.release, None]): revision = model.value(r[2], doap.revision, None) - if revision == ('%d.%d' % (minor, micro)): + if str(revision) == ('%d.%d' % (minor, micro)): date = model.value(r[2], doap.created, None) break # Verify that this date is the latest for r in model.triples([ext_node, doap.release, None]): - revision = model.value(r[2], doap.revision, None) this_date = model.value(r[2], doap.created, None) if this_date > date: print('warning: %s revision %d.%d (%s) is not the latest release' % ( ext_node, minor, micro, date)) break - + # Get short description shortdesc = model.value(ext_node, doap.shortdesc, None) @@ -224,8 +221,72 @@ def subst_file(template, output, dict): i.close() o.close() +def specdirs(path): + return ([path.find_node('lv2/lv2plug.in/ns/lv2core')] + + path.ant_glob('plugins/*', dir=True) + + path.ant_glob('lv2/lv2plug.in/ns/ext/*', dir=True) + + path.ant_glob('lv2/lv2plug.in/ns/extensions/*', dir=True)) + +def ttl_files(path, specdir): + def abspath(node): + return node.abspath() + + return map(abspath, + path.ant_glob(specdir.path_from(path) + '/*.ttl')) + +def load_ttl(files): + import rdflib + model = rdflib.ConjunctiveGraph() + for f in files: + model.parse(f, format='n3') + return model + # Task to build extension index def build_index(task): + sys.path.append('./lv2specgen') + import rdflib + import lv2specgen + + doap = rdflib.Namespace('http://usefulinc.com/ns/doap#') + lv2 = rdflib.Namespace('http://lv2plug.in/ns/lv2core#') + rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') + + model = load_ttl(['lv2/lv2plug.in/ns/meta/meta.ttl']) + + # Get date for this version, and list of all LV2 distributions + proj = rdflib.URIRef('http://lv2plug.in/ns/lv2') + date = None + dists = [] + for r in model.triples([proj, doap.release, None]): + revision = model.value(r[2], doap.revision, None) + if str(revision) == VERSION: + date = model.value(r[2], doap.created, None) + + dist = model.value(r[2], doap['file-release'], None) + if dist: + dists += [dist] + dists.sort() + + # Get history for this LV2 release + entries = lv2specgen.specHistoryEntries(model, proj) + + # Add entries for every spec that has the same distribution + ctx = task.generator.bld + subdirs = specdirs(ctx.path) + for specdir in subdirs: + m = load_ttl(ttl_files(ctx.path, specdir)) + name = os.path.basename(specdir.abspath()) + spec = m.value(None, rdf.type, lv2.Specification) + if spec: + for dist in dists: + release = m.value(None, doap['file-release'], dist) + if release: + entries[dist] += lv2specgen.releaseChangeset(m, release, str(name)) + + # Filter entries for post-unification LV2 distributions only + unified_entries = { dist: entries[dist] for dist in dists } + history = lv2specgen.specHistoryMarkup(unified_entries) + global index_lines rows = [] for f in task.inputs: @@ -236,7 +297,9 @@ def build_index(task): subst_file(task.inputs[0].abspath(), task.outputs[0].abspath(), { '@ROWS@': ''.join(rows), - '@LV2_VERSION@': VERSION}) + '@LV2_VERSION@': VERSION, + '@DATE@' : date, + '@HISTORY@' : history}) # Task for making a link in the build directory to a source file def link(task): @@ -357,7 +420,7 @@ def build(bld): base = i.srcpath()[len('lv2/lv2plug.in'):] name = os.path.basename(i.srcpath()) - + # Generate .htaccess file if bld.env.ONLINE_DOCS: bld(features = 'subst', @@ -447,26 +510,19 @@ class DistCheck(Dist, Scripting.DistCheck): def execute(self): Dist.execute(self) self.check() - + def archive(self): Dist.archive(self) def dist(ctx): - subdirs = ([ctx.path.find_node('lv2/lv2plug.in/ns/lv2core')] + - ctx.path.ant_glob('plugins/*', dir=True) + - ctx.path.ant_glob('lv2/lv2plug.in/ns/ext/*', dir=True) + - ctx.path.ant_glob('lv2/lv2plug.in/ns/extensions/*', dir=True)) + subdirs = specdirs(ctx.path) # Write NEWS files in source directory top_entries = {} - for i in subdirs: - def abspath(node): - return node.abspath() - in_files = map(abspath, - ctx.path.ant_glob(i.path_from(ctx.path) + '/*.ttl')) - autowaf.write_news(os.path.basename(i.abspath()), - in_files, - i.abspath() + '/NEWS', + for specdir in subdirs: + autowaf.write_news(os.path.basename(specdir.abspath()), + ttl_files(ctx.path, specdir), + specdir.abspath() + '/NEWS', top_entries) # Write top level amalgamated NEWS file @@ -485,4 +541,3 @@ def dist(ctx): os.remove(os.path.join(i.abspath(), 'NEWS')) except: pass - -- cgit v1.2.1