Skip to content

[Doc] Ignore lines starting with # #4409

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

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion util/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
from lintlib import parse_all, log

lint_subheadline = re.compile(r'''^\*\*([\w\s]+?)[:?.!]?\*\*(.*)''')
rust_code_block = re.compile(r'''```rust.+?```''', flags=re.DOTALL)

CONF_TEMPLATE = """\
This lint has the following configuration variables:

* `%s: %s`: %s (defaults to `%s`)."""


def parse_code_block(match):
lines = []

for line in match.group(0).split('\n'):
if not line.startswith('# '):
lines.append(line)

return '\n'.join(lines)


def parse_lint_def(lint):
lint_dict = {}
lint_dict['id'] = lint.name
Expand Down Expand Up @@ -44,7 +55,7 @@ def parse_lint_def(lint):
lint_dict['docs'][last_section] += text + "\n"

for section in lint_dict['docs']:
lint_dict['docs'][section] = lint_dict['docs'][section].strip()
lint_dict['docs'][section] = re.sub(rust_code_block, parse_code_block, lint_dict['docs'][section].strip())

return lint_dict

Expand Down