Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ build:
mkdir -p $(out_folder)
cd src && python generate_dashing.py
# Sublime Text
cd $(st_site) && dashing build
cd $(st_site) && dashing build | tee ../../$(out_folder)/dashing-$(st_submodule).txt
mv $(st_built_path) $(out_folder)
# Sublime Merge
cd $(sm_site) && dashing build
cd $(sm_site) && dashing build | tee ../../$(out_folder)/dashing-$(sm_submodule).txt
mv $(sm_built_path) $(out_folder)

.PHONY: post-build
Expand Down
7 changes: 6 additions & 1 deletion resources/sublime-text.toml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ css = '#module-sublime_plugin h2 code'
type = 'Module'

[[selectors.api_reference]]
css = 'dl.class > div > dt[id]'
css = 'dl.class > div[id^=sublime]'
attr = 'id'
type = 'Class'

Expand All @@ -281,6 +281,11 @@ css = 'dl.class > dt[id]'
attr = 'id'
type = 'Class'

[[selectors.api_reference]]
css = 'dl.exception > dt[id]'
attr = 'id'
type = 'Exception'

[[selectors.api_reference]]
css = 'dl.function > dt[id]'
attr = 'id'
Expand Down
64 changes: 64 additions & 0 deletions src/generate_tests_from_dashing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python3

"""
Strip portions of the HTML pages that we don't need
"""
import sys
from collections import defaultdict
from re import match, sub

DASHING_LOGS = [
'../out/dashing-sublime-merge.txt',
'../out/dashing-sublime-text.txt',
]


def dump_test_stuff(doc_path, assertions):
if not doc_path:
return

name = match(r'docs/([\w-]+)\.html', doc_path).group(1)
tests = f'''
def test_{name.replace('-', '_')}(self):
contains = [
{('\n' + (' ' * 12)).join(sorted(assertions.keys()))}
]
self._test_a_doc_page_index('{doc_path}', contains)'''
print(tests)

for assertion in [k for k in sorted(assertions.keys()) if assertions[k] > 1]:
print(f'{" " * 8}### {assertion} was found {assertions[assertion]} times')


def process_dashing_output(dashing_filepath):
doc_path = None
assertion_histogram = defaultdict(int)

with open(dashing_filepath, 'r') as dashing_file:

for line in dashing_file:
doc_path_match = match(r'(docs/[\w-]+\.html) looks like HTML$', line)
test_match = match(r"Match: '(.+)' is type (\w+) at", line)

if doc_path_match:
dump_test_stuff(doc_path, assertion_histogram)
assertion_histogram = defaultdict(int)
doc_path = doc_path_match.group(1)
elif test_match:
index_type = test_match.group(2)
index_text = test_match.group(1).replace('\\', '\\\\')
assertion = f"('{index_type}', '{index_text}'),"
assertion_histogram[assertion] += 1

dump_test_stuff(doc_path, assertion_histogram)


def main():

for dump in DASHING_LOGS:
print(f'\n# Starting test case for {dump} ###########################')
process_dashing_output(dump)


if __name__ == '__main__':
sys.exit(main())
2 changes: 1 addition & 1 deletion sublime-text
Submodule sublime-text updated 42 files
+33 −1 README.md
+49 −12 www.sublimetext.com/docs/api_environments.html
+1,010 −931 www.sublimetext.com/docs/api_reference.html
+48 −76 www.sublimetext.com/docs/build_systems.html
+80 −80 www.sublimetext.com/docs/color_schemes.html
+9 −9 www.sublimetext.com/docs/column_selection.html
+12 −12 www.sublimetext.com/docs/command_line.html
+44 −48 www.sublimetext.com/docs/completions.html
+2 −2 www.sublimetext.com/docs/distraction_free.html
+1 −1 www.sublimetext.com/docs/docs.js
+1 −1 www.sublimetext.com/docs/docs.js@v=8e965901211a2d7b1e98728dcfde112c
+6 −6 www.sublimetext.com/docs/file_patterns.html
+1 −1 www.sublimetext.com/docs/font.html
+13 −13 www.sublimetext.com/docs/git_integration.html
+3 −3 www.sublimetext.com/docs/gpu_rendering.html
+10 −10 www.sublimetext.com/docs/incremental_diff.html
+13 −13 www.sublimetext.com/docs/indentation.html
+5 −5 www.sublimetext.com/docs/index.html
+13 −13 www.sublimetext.com/docs/indexing.html
+10 −17 www.sublimetext.com/docs/key_bindings.html
+3 −3 www.sublimetext.com/docs/ligatures.html
+6 −6 www.sublimetext.com/docs/linux_repositories.html
+13 −13 www.sublimetext.com/docs/menus.html
+15 −15 www.sublimetext.com/docs/minihtml.html
+6 −6 www.sublimetext.com/docs/multiple_selection_with_the_keyboard.html
+17 −7 www.sublimetext.com/docs/os_compatibility.html
+5 −5 www.sublimetext.com/docs/packages.html
+3 −3 www.sublimetext.com/docs/portable_license_keys.html
+8 −8 www.sublimetext.com/docs/porting_guide.html
+4 −4 www.sublimetext.com/docs/previous_versions.html
+14 −14 www.sublimetext.com/docs/projects.html
+3 −3 www.sublimetext.com/docs/revert.html
+3 −3 www.sublimetext.com/docs/safe_mode.html
+22 −22 www.sublimetext.com/docs/scope_naming.html
+33 −38 www.sublimetext.com/docs/selectors.html
+8 −8 www.sublimetext.com/docs/settings.html
+2 −2 www.sublimetext.com/docs/side_by_side.html
+8 −8 www.sublimetext.com/docs/spell_checking.html
+25 −25 www.sublimetext.com/docs/syntax.html
+23 −23 www.sublimetext.com/docs/tab_multi-select.html
+249 −190 www.sublimetext.com/docs/themes.html
+10 −10 www.sublimetext.com/docs/vintage.html
Loading
Loading