Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate html and json of supported css properties. #10208

Merged
merged 5 commits into from Mar 29, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -21,4 +21,21 @@
})
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))
@@ -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>
@@ -12,5 +12,7 @@ cd "$(dirname $0)/../.."
# etc/doc.servo.org/index.html overwrites $(mach rust-root)/doc/index.html
cp etc/doc.servo.org/* target/doc/

python components/style/list_properties.py

ghp-import -n target/doc
git push -qf https://${TOKEN}@github.com/servo/doc.servo.org.git gh-pages
@@ -163,10 +163,17 @@ def test(self, params, render_mode=DEFAULT_RENDER_MODE, release=False, faster=Fa
@CommandArgument('test_name', nargs=argparse.REMAINDER,
help="Only run tests that match this pattern or file path")
def test_unit(self, test_name=None, package=None):
properties = json.loads(subprocess.check_output([
subprocess.check_output([
sys.executable,
path.join(self.context.topdir, "components", "style", "list_properties.py")
]))
])

this_file = os.path.dirname(__file__)
servo_doc_path = os.path.abspath(os.path.join(this_file, '../', '../', 'target', 'doc', 'servo'))

with open(os.path.join(servo_doc_path, 'css-properties.json'), 'r') as property_file:
properties = json.loads(property_file.read())

assert len(properties) >= 100
assert "margin-top" in properties
assert "margin" in properties
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.