fix(docs): remove empty '/// # ' lines

They seem to make cargo fail to build valid doctests. Might be worth
a ticket !
This commit is contained in:
Sebastian Thiel
2015-03-05 12:05:02 +01:00
parent 331ecf87a7
commit f2dda421e6
3 changed files with 502 additions and 544 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
method_params, activity_rust_type, mangle_ident, activity_input_type, get_word,
split_camelcase_s, property, is_pod_property, TREF, method_io, IO_REQUEST,
schema_to_required_property, rust_copy_value_s, is_required_property,
hash_comment, build_all_params, REQUEST_VALUE_PROPERTY_NAME)
hide_rust_doc_test, build_all_params, REQUEST_VALUE_PROPERTY_NAME)
%>\
<%namespace name="util" file="util.mako"/>\
<%namespace name="lib" file="lib.mako"/>\
@@ -33,11 +33,10 @@ ${m.description | rust_doc_comment}
/// Instantiate a resource method builder
///
<%block filter="rust_doc_test_norun, rust_doc_comment">\
${capture(util.test_prelude) | hash_comment}\
${capture(util.test_prelude) | hide_rust_doc_test}\
<%block filter="rust_test_fn_invisible">\
${capture(lib.test_hub, hub_type_name, comments=False) | hash_comment}\
${capture(lib.test_hub, hub_type_name, comments=False) | hide_rust_doc_test}
// Usually you wouldn't bind this to a variable, but keep calling methods
// to setup your call.
## % for p

View File

@@ -49,6 +49,10 @@ def rust_comment(s):
def hash_comment(s):
return re_linestart.sub('# ', s)
# hides lines in rust examples, if not already hidden, or empty.
def hide_rust_doc_test(s):
return re.sub('^[^#\n]', lambda m: '# ' + m.group(), s, flags=re.MULTILINE)
# remove the first indentation (must be spaces !)
def unindent(s):
return re_first_4_spaces.sub('', s)