mirror of
https://github.com/jqlang/jq.git
synced 2025-11-16 18:22:22 +03:00
[docs] Use yaml.safe_load() in build_*.py scripts (#2432)
Co-authored-by: itchyny <itchyny@cybozu.co.jp>
This commit is contained in:
@@ -187,7 +187,7 @@ class RoffWalker(object):
|
|||||||
|
|
||||||
def load_yml_file(fn):
|
def load_yml_file(fn):
|
||||||
with open(fn) as f:
|
with open(fn) as f:
|
||||||
return yaml.load(f, Loader=yaml.Loader)
|
return yaml.safe_load(f)
|
||||||
|
|
||||||
def dedent_body(body):
|
def dedent_body(body):
|
||||||
lines = [re.sub(r'^ (\S)', r'\1', l) for l in body.split('\n')]
|
lines = [re.sub(r'^ (\S)', r'\1', l) for l in body.split('\n')]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
with open("content/manual/manual.yml") as f:
|
with open("content/manual/manual.yml") as f:
|
||||||
manual = yaml.load(f)
|
manual = yaml.safe_load(f)
|
||||||
for section in manual.get('sections', []):
|
for section in manual.get('sections', []):
|
||||||
for entry in section.get('entries', []):
|
for entry in section.get('entries', []):
|
||||||
for example in entry.get('examples', []):
|
for example in entry.get('examples', []):
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ env = Environment(
|
|||||||
|
|
||||||
def load_yml_file(fn):
|
def load_yml_file(fn):
|
||||||
with open(fn) as f:
|
with open(fn) as f:
|
||||||
return yaml.load(f, Loader=yaml.Loader)
|
return yaml.safe_load(f)
|
||||||
|
|
||||||
env.filters['search_id'] = lambda input: input.replace(r'`', '')
|
env.filters['search_id'] = lambda input: input.replace(r'`', '')
|
||||||
env.filters['section_id'] = lambda input: re.sub(r"[^a-zA-Z0-9_]", '', input)
|
env.filters['section_id'] = lambda input: re.sub(r"[^a-zA-Z0-9_]", '', input)
|
||||||
|
|||||||
Reference in New Issue
Block a user