Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Strip (some) spec-specific knowledge from publish.py.

  • Loading branch information...
commit 7cfb94e3f9a9c945cec991556af72f4e70bc94f2 1 parent d2429d3
@hober hober authored
Showing with 22 additions and 13 deletions.
  1. +1 −0  default-config.json
  2. +21 −13 publish.py
View
1  default-config.json
@@ -3,6 +3,7 @@
"path": "../html"
, "branch": "CR"
, "boilerplate": "header-w3c-html-core"
+ , "select": "w3c-html"
}
, "2dcontext": {
"path": "../html"
View
34 publish.py
@@ -3,20 +3,28 @@
from StringIO import StringIO
from anolislib import generator, utils
-if len(sys.argv)>1 and sys.argv[1] == 'html':
- select = 'w3c-html'
- spec = 'html'
-elif len(sys.argv)>1 and sys.argv[1] == 'microdata':
- select = spec = 'microdata'
-elif len(sys.argv)>1 and sys.argv[1] == '2dcontext':
- spec = select = '2dcontext'
-elif len(sys.argv)>1 and sys.argv[1] == 'srcset':
- spec = select = 'srcset'
-else:
- sys.stderr.write("Usage: python %s [html|2dcontext|microdata|srcset]\n" % sys.argv[0])
+def invoked_incorrectly():
+ specs = config.load_config().keys()
+ sys.stderr.write("Usage: python %s [%s]\n" % (sys.argv[0],'|'.join(specs)))
exit()
-conf = config.load_config()[spec]
+if len(sys.argv) < 2:
+ invoked_incorrectly()
+
+spec = sys.argv[1]
+
+conf = None
+try:
+ conf = config.load_config()[spec]
+except KeyError:
+ invoked_incorrectly()
+
+if 'select' in conf:
+ select = conf['select']
+else:
+ select = spec
+
+print "spec: %s\nselect: %s\nboilerplate: %s" % (spec, select, conf['boilerplate'])
print 'parsing'
os.chdir(config.rel_to_me(conf["path"], __file__))
@@ -154,7 +162,7 @@ def copy_dependencies (targets):
copy_dependencies(["images", "fonts", "404/*"])
elif spec == "2dcontext":
copy_dependencies(["images", "fonts"])
-elif spec == "microdata":
+else:
copy_dependencies("fonts")
# fix the styling of the 404

0 comments on commit 7cfb94e

Please sign in to comment.
Something went wrong with that request. Please try again.