aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-03-29 13:34:08 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2016-03-29 13:34:08 +0530
commitdf73a18a61e57f62e2e17541d45dcd3818b35b7c (patch)
treefbb298d93dc84cef14074dcd7ed061efeab50b8f /components
parentaac2da75f40f4c55a4b450b6d9d134429fcf741e (diff)
parent6de7228945f9e9882ae5a8d45fd3ed40906057db (diff)
downloadservo-df73a18a61e57f62e2e17541d45dcd3818b35b7c.tar.gz
servo-df73a18a61e57f62e2e17541d45dcd3818b35b7c.zip
Auto merge of #10208 - jrasanen:jr/issue10196, r=SimonSapin
Generate html and json of supported css properties. Fixes #10196. Outputs html and json of supported css properties to `target/doc/` directory when deploying github-pages. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10208) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/style/list_properties.py19
-rw-r--r--components/style/properties.html.mako40
2 files changed, 58 insertions, 1 deletions
diff --git a/components/style/list_properties.py b/components/style/list_properties.py
index 63bbe247511..34043be888b 100644
--- a/components/style/list_properties.py
+++ b/components/style/list_properties.py
@@ -21,4 +21,21 @@ properties = dict(
})
for p in template.module.LONGHANDS + template.module.SHORTHANDS
)
-print(json.dumps(properties, indent=4))
+
+json_dump = json.dumps(properties, indent=4)
+
+#
+# Resolve path to doc directory and write CSS properties and JSON.
+#
+servo_doc_path = os.path.abspath(os.path.join(style, '../', '../', 'target', 'doc', 'servo'))
+
+# Ensure ./target/doc/servo exists
+if not os.path.exists(servo_doc_path):
+ os.makedirs(servo_doc_path)
+
+with open(os.path.join(servo_doc_path, 'css-properties.json'), "w") as out_file:
+ out_file.write(json_dump)
+
+html_template = Template(filename=os.path.join(style, "properties.html.mako"), input_encoding='utf8')
+with open(os.path.join(servo_doc_path, 'css-properties.html'), "w") as out_file:
+ out_file.write(html_template.render(properties=properties))
diff --git a/components/style/properties.html.mako b/components/style/properties.html.mako
new file mode 100644
index 00000000000..d06524d3e13
--- /dev/null
+++ b/components/style/properties.html.mako
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="generator" content="rustdoc">
+ <meta name="description" content="API documentation for the Rust `servo` crate.">
+ <meta name="keywords" content="rust, rustlang, rust-lang, servo">
+ <title>Supported CSS properties - servo - Rust</title>
+ <link rel="stylesheet" type="text/css" href="../rustdoc.css">
+ <link rel="stylesheet" type="text/css" href="../main.css">
+</head>
+<body class="rustdoc">
+ <!--[if lte IE 8]>
+ <div class="warning">
+ This old browser is unsupported and will most likely display funky
+ things.
+ </div>
+ <![endif]-->
+ <section id='main' class="content mod">
+ <h1 class='fqn'><span class='in-band'>CSS properties currently supported in <a class='mod' href=''>Servo</a></span></h1>
+ <div id='properties' class='docblock'>
+ <table>
+ <tr>
+ <th>Property</th>
+ <th>Flag</th>
+ <th>Shorthand</th>
+ </tr>
+ % for prop in properties:
+ <tr>
+ <td>${prop}</td>
+ <td>${properties[prop]['flag']}</td>
+ <td>${properties[prop]['shorthand']}</td>
+ </tr>
+ % endfor
+ </table>
+ </div>
+ </section>
+</body>
+</html>