mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-17 10:10:30 +00:00
commit
f0b852ad12
2 changed files with 13 additions and 3 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.pyc
|
||||||
|
*~
|
|
@ -1,11 +1,14 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from html_table_parser import HTMLTableParser
|
from html_table_parser import HTMLTableParser
|
||||||
|
|
||||||
|
|
||||||
# Regex for parsing options on MySQL documentation pages
|
# Regex for parsing options on MySQL documentation pages
|
||||||
# Options are (normally) specified as command-line options
|
# Options are (normally) specified as command-line options
|
||||||
# as anchor tags on the page. Certain documentation pages only
|
# as anchor tags on the page. Certain documentation pages only
|
||||||
|
@ -141,11 +144,16 @@ def print_yaml_options(sections, parser, file=sys.stdout):
|
||||||
A YAML library could be used, but we avoid extra dependencies by
|
A YAML library could be used, but we avoid extra dependencies by
|
||||||
just using string formatting.
|
just using string formatting.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for section, url, yaml in sections:
|
for section, url, yaml in sections:
|
||||||
options = parser(url, section)
|
options = parser(url, section)
|
||||||
print(yaml % {'section': section,
|
options_string = '\n - '.join(options)
|
||||||
'options': '\n - '.join(options),
|
string = yaml % {
|
||||||
'url': url}, end='', file=file)
|
'section': section,
|
||||||
|
'options': options_string,
|
||||||
|
'url': url
|
||||||
|
}
|
||||||
|
print(string,file=file,end= "")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Reference in a new issue