Skip to content

Commit e7d9112

Browse files
Add a Sublime Merge docset (#21)
1 parent ef70830 commit e7d9112

File tree

12 files changed

+195
-35
lines changed

12 files changed

+195
-35
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ jobs:
2929
- name: Build the docset
3030
run: make
3131

32-
- name: Upload the docset
32+
- name: Upload the ST docset
3333
uses: actions/upload-artifact@v4
3434
with:
3535
name: sublime-text.docset
36-
path: SublimeText_Documentation/www.sublimetext.com/sublime-text.docset
36+
path: out/sublime-text.docset
37+
38+
- name: Upload the SM docset
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: sublime-merge.docset
42+
path: out/sublime-merge.docset

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
out/

.gitmodules

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
[submodule "SublimeText_Documentation"]
2-
path = SublimeText_Documentation
1+
[submodule "sublime-text"]
2+
path = sublime-text
33
url = https://github.com/maliayas/SublimeText_Documentation
44
ignore = dirty
5+
[submodule "sublime-merge"]
6+
path = sublime-merge
7+
url = https://github.com/maliayas/SublimeMerge_Documentation
8+
ignore = dirty

Makefile

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
submodule_path := SublimeText_Documentation
2-
local_path := $(submodule_path)/www.sublimetext.com
3-
local_index := $(local_path)/docs/index.html
4-
docset := sublime-text.docset
5-
dashing_json := $(local_path)/dashing.json
6-
built_path := $(local_path)/$(docset)
1+
# Shared
2+
out_folder := out
3+
install_path_linux := ~/.local/share/Zeal/Zeal/docsets
4+
5+
# Sublime Text
6+
st_submodule := sublime-text
7+
st_site := $(st_submodule)/www.sublimetext.com
8+
st_site_index := $(st_site)/docs/index.html
9+
st_docset := sublime-text.docset
10+
st_built_path := $(st_site)/$(st_docset)
11+
12+
# Sublime Merge
13+
sm_submodule := sublime-merge
14+
sm_site := $(sm_submodule)/www.sublimemerge.com
15+
sm_site_index := $(sm_site)/docs/index.html
16+
sm_docset := sublime-merge.docset
17+
sm_built_path := $(sm_site)/$(sm_docset)
718

819
.PHONY: all
920
all: clean pre-build build
@@ -16,12 +27,23 @@ fix-html:
1627
python fix_html.py
1728

1829
build:
19-
yq -j . dashing.yml > $(dashing_json)
20-
cd $(local_path) \
21-
&& dashing build
30+
# Shared
31+
mkdir -p $(out_folder)
32+
# Sublime Text
33+
yq -j . sublime-text-dashing.yml > $(st_site)/dashing.json
34+
cd $(st_site) && dashing build
35+
mv $(st_built_path) $(out_folder)
36+
# Sublime Merge
37+
yq -j . sublime-merge-dashing.yml > $(sm_site)/dashing.json
38+
cd $(sm_site) && dashing build
39+
mv $(sm_built_path) $(out_folder)
2240

2341
.PHONY: clean
2442
clean:
25-
[ -d "$(built_path)" ] && rm -r $(built_path) || true
26-
[ -f "$(dashing_json)" ] && rm $(dashing_json) || true
27-
git restore $(submodule_path) --recurse-submodules
43+
[ -d "$(out_folder)" ] && rm -r $(out_folder) || true
44+
[ -f "$(st_site)/dashing.json" ] && rm $(st_site)/dashing.json || true
45+
[ -f "$(sm_site)/dashing.json" ] && rm $(sm_site)/dashing.json || true
46+
git restore --recurse-submodules $(st_submodule) $(sm_submodule)
47+
48+
install-linux:
49+
cp -r $(out_folder)/* $(install_path_linux)

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [Sublime Text Docset][self]
22

33
[Dash][] and [Zeal][] docset for [Sublime Text][st]’s official
4-
[documentation][st-docs].
4+
[documentation][st-docs]. There is also a small docset for Sublime Merge.
55

66

77
## Installation
@@ -11,7 +11,7 @@ Download from GitHub Releases or build yourself with the instructions below.
1111
- If you have a `sublime-text.docset.zip` from GitHub, extract it to a
1212
folder called `sublime-text.docset`.
1313
- If you build yourself, `sublime-text.docset` will be in the
14-
`www.sublimetext.com` folder.
14+
`sublime-text/www.sublimetext.com` folder.
1515

1616
We hope to have a distribution channel [eventually][distribution].
1717

@@ -22,13 +22,17 @@ We hope to have a distribution channel [eventually][distribution].
2222
1. Open the "Docsets" tab.
2323
1. Click the <kbd>+</kbd>.
2424
1. Choose "Add Local Docset".
25-
1. Select the `sublime-text.docset` in the `www.sublimetext.com` folder.
25+
1. Select the `sublime-text.docset` in the `out` folder.
2626
1. Optionally change the keyword.
27+
1. Repeat for `out/sublime-merge.docset`
2728

2829
### Install a local folder to Zeal
2930

31+
If you have default Linux folders, `make install-linux`. Otherwise:
32+
3033
1. Find your docset folder ("Docset storage" in your Preferences)
31-
1. Copy or symlink `sublime-text.docset` to that folder.
34+
1. Copy or symlink `out/sublime-text.docset` to that folder.
35+
1. Repeat for `out/sublime-merge.docset`
3236

3337

3438
## Building
@@ -43,9 +47,13 @@ We hope to have a distribution channel [eventually][distribution].
4347
### Steps
4448

4549
0. (Optional) Enter a Python virtual environment.
46-
1.
47-
``` sh
50+
1. One time
51+
```sh
52+
git submodule init
4853
pip install -r requirements.txt
54+
```
55+
1. Each build
56+
```sh
4957
make
5058
```
5159

fix_html.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
from bs4 import BeautifulSoup
1010

11-
DOC_ROOT = 'SublimeText_Documentation/www.sublimetext.com/docs'
11+
DOC_ROOTS = [
12+
'sublime-text/www.sublimetext.com/docs',
13+
'sublime-merge/www.sublimemerge.com/docs',
14+
]
1215

1316

1417
def delete_skins(soup):
@@ -39,20 +42,21 @@ def remove_link_icon(soup):
3942

4043
def main():
4144

42-
root_directory = Path(DOC_ROOT)
43-
for path in root_directory.rglob('*.html'):
45+
for root in DOC_ROOTS:
46+
root_directory = Path(root)
47+
for path in root_directory.rglob('*.html'):
4448

45-
with path.open(encoding='utf-8') as file:
46-
html = file.read()
49+
with path.open(encoding='utf-8') as file:
50+
html = file.read()
4751

48-
soup = BeautifulSoup(html, 'lxml')
52+
soup = BeautifulSoup(html, 'lxml')
4953

50-
delete_skins(soup)
51-
remove_link_icon(soup)
54+
delete_skins(soup)
55+
remove_link_icon(soup)
5256

53-
with path.open('w', encoding='utf-8') as file:
54-
# Can't prettify as that would introduce whitespace around inline tags
55-
file.write(str(soup))
57+
with path.open('w', encoding='utf-8') as file:
58+
# Can't prettify as that would introduce whitespace around inline tags
59+
file.write(str(soup))
5660

5761

5862
if __name__ == '__main__':

sublime-merge

Submodule sublime-merge added at 2e2cd24

sublime-merge-dashing.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Sublime Merge
2+
package: sublime-merge
3+
index: docs/index.html
4+
icon32x32: ../../sublime-merge-icon.png
5+
allowJS: false
6+
ExternalURL: 'https://www.sublimemerge.com'
7+
ignore:
8+
- id
9+
- id0
10+
- id1
11+
- id2
12+
13+
# https://github.com/technosophos/dashing?tab=readme-ov-file#usage
14+
# https://kapeli.com/docsets#supportedentrytypes
15+
selectors:
16+
17+
###[ GLOBAL ]##################################################################
18+
19+
# Each pages' header
20+
title:
21+
type: Guide
22+
matchpath: '\.html$'
23+
24+
# Page subheadings
25+
h2:
26+
type: Section
27+
matchpath: '\.html$'
28+
29+
###[ FAQ ]#####################################################################
30+
###[ GETTING STARTED ]#########################################################
31+
###[ DIFF CONTEXT ]############################################################
32+
###[ KEY BINDINGS ]############################################################
33+
34+
# Binding settings
35+
'section:has(#bindings) h3[id]':
36+
type: Setting
37+
matchpath: '/key_bindings\.html$'
38+
39+
# "context" modifiers
40+
'dt':
41+
type: Filter
42+
matchpath: '/key_bindings\.html$'
43+
44+
###[ COMMAND PALETTE ]#########################################################
45+
###[ CUSTOM COMMANDS ]#########################################################
46+
###[ COMMAND LINE ]############################################################
47+
###[ THEMES ]##################################################################
48+
49+
# Attributes
50+
'dl.attribute > dt':
51+
type: Attribute
52+
matchpath: '/themes\.html$'
53+
54+
# Settings
55+
'dl.settings > dt':
56+
type: Setting
57+
matchpath: '/themes\.html$'
58+
59+
# Properties
60+
'dl.properties > dt':
61+
type: Property
62+
matchpath: '/themes\.html$'
63+
64+
# Theme elements
65+
'dl.elements > dt':
66+
type: Element
67+
matchpath: '/themes\.html$'
68+
69+
# Element properties
70+
# TODO: Maybe split these into attributes and properties
71+
'dl.elements > dd > dl dt code':
72+
type: Property
73+
matchpath: '/themes\.html$'
74+
75+
###[ MENUS ]###################################################################
76+
77+
# Settings
78+
'.primary section:has(#entries) dt':
79+
type: Setting
80+
matchpath: '/menus\.html$'
81+
82+
# Variables
83+
'.primary section:has(#available_menus) dl.enum > dt':
84+
requiretext: '\$'
85+
type: Variable
86+
matchpath: '/menus\.html$'
87+
88+
# Menus
89+
# (Extra trailing space to avoid JSON dict key overload)
90+
'.primary section:has(#available_menus) dl.enum > dt ':
91+
requiretext: '.sublime-menu'
92+
type: File
93+
matchpath: '/menus\.html$'
94+
95+
###[ PACKAGES ]################################################################
96+
97+
# Files
98+
'dl dd':
99+
type: File
100+
matchpath: '/packages\.html$'
101+
102+
###[ MINIHTML REFERENCE ]######################################################
103+
104+
# Variables
105+
'li code:first-child':
106+
requiretext: 'var'
107+
type: Variable
108+
matchpath: '/minihtml\.html$'
109+

sublime-merge-icon.png

774 Bytes
Loading

0 commit comments

Comments
 (0)