Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 7cfb94e3f9a9c945cec991556af72f4e70bc94f2 1 parent d2429d3
Edward O'Connor hober authored

Showing 2 changed files with 22 additions and 13 deletions. Show diff stats Hide diff stats

  1. +1 0  default-config.json
  2. +21 13 publish.py
1  default-config.json
@@ -3,6 +3,7 @@
3 3 "path": "../html"
4 4 , "branch": "CR"
5 5 , "boilerplate": "header-w3c-html-core"
  6 + , "select": "w3c-html"
6 7 }
7 8 , "2dcontext": {
8 9 "path": "../html"
34 publish.py
@@ -3,20 +3,28 @@
3 3 from StringIO import StringIO
4 4 from anolislib import generator, utils
5 5
6   -if len(sys.argv)>1 and sys.argv[1] == 'html':
7   - select = 'w3c-html'
8   - spec = 'html'
9   -elif len(sys.argv)>1 and sys.argv[1] == 'microdata':
10   - select = spec = 'microdata'
11   -elif len(sys.argv)>1 and sys.argv[1] == '2dcontext':
12   - spec = select = '2dcontext'
13   -elif len(sys.argv)>1 and sys.argv[1] == 'srcset':
14   - spec = select = 'srcset'
15   -else:
16   - sys.stderr.write("Usage: python %s [html|2dcontext|microdata|srcset]\n" % sys.argv[0])
  6 +def invoked_incorrectly():
  7 + specs = config.load_config().keys()
  8 + sys.stderr.write("Usage: python %s [%s]\n" % (sys.argv[0],'|'.join(specs)))
17 9 exit()
18 10
19   -conf = config.load_config()[spec]
  11 +if len(sys.argv) < 2:
  12 + invoked_incorrectly()
  13 +
  14 +spec = sys.argv[1]
  15 +
  16 +conf = None
  17 +try:
  18 + conf = config.load_config()[spec]
  19 +except KeyError:
  20 + invoked_incorrectly()
  21 +
  22 +if 'select' in conf:
  23 + select = conf['select']
  24 +else:
  25 + select = spec
  26 +
  27 +print "spec: %s\nselect: %s\nboilerplate: %s" % (spec, select, conf['boilerplate'])
20 28
21 29 print 'parsing'
22 30 os.chdir(config.rel_to_me(conf["path"], __file__))
@@ -154,7 +162,7 @@ def copy_dependencies (targets):
154 162 copy_dependencies(["images", "fonts", "404/*"])
155 163 elif spec == "2dcontext":
156 164 copy_dependencies(["images", "fonts"])
157   -elif spec == "microdata":
  165 +else:
158 166 copy_dependencies("fonts")
159 167
160 168 # 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.