Skip to content
Merged
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
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ jobs:
- name: Build the docset
run: make

- name: Upload the docset
- name: Upload the ST docset
uses: actions/upload-artifact@v4
with:
name: sublime-text.docset
path: SublimeText_Documentation/www.sublimetext.com/sublime-text.docset
path: out/sublime-text.docset

- name: Upload the SM docset
uses: actions/upload-artifact@v4
with:
name: sublime-merge.docset
path: out/sublime-merge.docset
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/
8 changes: 6 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[submodule "SublimeText_Documentation"]
path = SublimeText_Documentation
[submodule "sublime-text"]
path = sublime-text
url = https://github.com/maliayas/SublimeText_Documentation
ignore = dirty
[submodule "sublime-merge"]
path = sublime-merge
url = https://github.com/maliayas/SublimeMerge_Documentation
ignore = dirty
46 changes: 34 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
submodule_path := SublimeText_Documentation
local_path := $(submodule_path)/www.sublimetext.com
local_index := $(local_path)/docs/index.html
docset := sublime-text.docset
dashing_json := $(local_path)/dashing.json
built_path := $(local_path)/$(docset)
# Shared
out_folder := out
install_path_linux := ~/.local/share/Zeal/Zeal/docsets

# Sublime Text
st_submodule := sublime-text
st_site := $(st_submodule)/www.sublimetext.com
st_site_index := $(st_site)/docs/index.html
st_docset := sublime-text.docset
st_built_path := $(st_site)/$(st_docset)

# Sublime Merge
sm_submodule := sublime-merge
sm_site := $(sm_submodule)/www.sublimemerge.com
sm_site_index := $(sm_site)/docs/index.html
sm_docset := sublime-merge.docset
sm_built_path := $(sm_site)/$(sm_docset)

.PHONY: all
all: clean pre-build build
Expand All @@ -16,12 +27,23 @@ fix-html:
python fix_html.py

build:
yq -j . dashing.yml > $(dashing_json)
cd $(local_path) \
&& dashing build
# Shared
mkdir -p $(out_folder)
# Sublime Text
yq -j . sublime-text-dashing.yml > $(st_site)/dashing.json
cd $(st_site) && dashing build
mv $(st_built_path) $(out_folder)
# Sublime Merge
yq -j . sublime-merge-dashing.yml > $(sm_site)/dashing.json
cd $(sm_site) && dashing build
mv $(sm_built_path) $(out_folder)

.PHONY: clean
clean:
[ -d "$(built_path)" ] && rm -r $(built_path) || true
[ -f "$(dashing_json)" ] && rm $(dashing_json) || true
git restore $(submodule_path) --recurse-submodules
[ -d "$(out_folder)" ] && rm -r $(out_folder) || true
[ -f "$(st_site)/dashing.json" ] && rm $(st_site)/dashing.json || true
[ -f "$(sm_site)/dashing.json" ] && rm $(sm_site)/dashing.json || true
git restore --recurse-submodules $(st_submodule) $(sm_submodule)

install-linux:
cp -r $(out_folder)/* $(install_path_linux)
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [Sublime Text Docset][self]

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


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

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

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

### Install a local folder to Zeal

If you have default Linux folders, `make install-linux`. Otherwise:

1. Find your docset folder ("Docset storage" in your Preferences)
1. Copy or symlink `sublime-text.docset` to that folder.
1. Copy or symlink `out/sublime-text.docset` to that folder.
1. Repeat for `out/sublime-merge.docset`


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

0. (Optional) Enter a Python virtual environment.
1.
``` sh
1. One time
```sh
git submodule init
pip install -r requirements.txt
```
1. Each build
```sh
make
```

Expand Down
26 changes: 15 additions & 11 deletions fix_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

from bs4 import BeautifulSoup

DOC_ROOT = 'SublimeText_Documentation/www.sublimetext.com/docs'
DOC_ROOTS = [
'sublime-text/www.sublimetext.com/docs',
'sublime-merge/www.sublimemerge.com/docs',
]


def delete_skins(soup):
Expand Down Expand Up @@ -39,20 +42,21 @@ def remove_link_icon(soup):

def main():

root_directory = Path(DOC_ROOT)
for path in root_directory.rglob('*.html'):
for root in DOC_ROOTS:
root_directory = Path(root)
for path in root_directory.rglob('*.html'):

with path.open(encoding='utf-8') as file:
html = file.read()
with path.open(encoding='utf-8') as file:
html = file.read()

soup = BeautifulSoup(html, 'lxml')
soup = BeautifulSoup(html, 'lxml')

delete_skins(soup)
remove_link_icon(soup)
delete_skins(soup)
remove_link_icon(soup)

with path.open('w', encoding='utf-8') as file:
# Can't prettify as that would introduce whitespace around inline tags
file.write(str(soup))
with path.open('w', encoding='utf-8') as file:
# Can't prettify as that would introduce whitespace around inline tags
file.write(str(soup))


if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions sublime-merge
Submodule sublime-merge added at 2e2cd2
109 changes: 109 additions & 0 deletions sublime-merge-dashing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Sublime Merge
package: sublime-merge
index: docs/index.html
icon32x32: ../../sublime-merge-icon.png
allowJS: false
ExternalURL: 'https://www.sublimemerge.com'
ignore:
- id
- id0
- id1
- id2

# https://github.com/technosophos/dashing?tab=readme-ov-file#usage
# https://kapeli.com/docsets#supportedentrytypes
selectors:

###[ GLOBAL ]##################################################################

# Each pages' header
title:
type: Guide
matchpath: '\.html$'

# Page subheadings
h2:
type: Section
matchpath: '\.html$'

###[ FAQ ]#####################################################################
###[ GETTING STARTED ]#########################################################
###[ DIFF CONTEXT ]############################################################
###[ KEY BINDINGS ]############################################################

# Binding settings
'section:has(#bindings) h3[id]':
type: Setting
matchpath: '/key_bindings\.html$'

# "context" modifiers
'dt':
type: Filter
matchpath: '/key_bindings\.html$'

###[ COMMAND PALETTE ]#########################################################
###[ CUSTOM COMMANDS ]#########################################################
###[ COMMAND LINE ]############################################################
###[ THEMES ]##################################################################

# Attributes
'dl.attribute > dt':
type: Attribute
matchpath: '/themes\.html$'

# Settings
'dl.settings > dt':
type: Setting
matchpath: '/themes\.html$'

# Properties
'dl.properties > dt':
type: Property
matchpath: '/themes\.html$'

# Theme elements
'dl.elements > dt':
type: Element
matchpath: '/themes\.html$'

# Element properties
# TODO: Maybe split these into attributes and properties
'dl.elements > dd > dl dt code':
type: Property
matchpath: '/themes\.html$'

###[ MENUS ]###################################################################

# Settings
'.primary section:has(#entries) dt':
type: Setting
matchpath: '/menus\.html$'

# Variables
'.primary section:has(#available_menus) dl.enum > dt':
requiretext: '\$'
type: Variable
matchpath: '/menus\.html$'

# Menus
# (Extra trailing space to avoid JSON dict key overload)
'.primary section:has(#available_menus) dl.enum > dt ':
requiretext: '.sublime-menu'
type: File
matchpath: '/menus\.html$'

###[ PACKAGES ]################################################################

# Files
'dl dd':
type: File
matchpath: '/packages\.html$'

###[ MINIHTML REFERENCE ]######################################################

# Variables
'li code:first-child':
requiretext: 'var'
type: Variable
matchpath: '/minihtml\.html$'

Binary file added sublime-merge-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions dashing.yml → sublime-text-dashing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Sublime Text
package: sublime-text
index: docs/index.html
icon32x32: ../../favicon.png
icon32x32: ../../sublime-text-icon.png
allowJS: false
ExternalURL: 'https://www.sublimetext.com'
ignore:
Expand Down Expand Up @@ -131,7 +131,12 @@ selectors:

###[ KEY BINDINGS ]############################################################

# Context modifiers
# Bindings keys
'#bindings h3':
type: Setting
matchpath: '/key_bindings\.html$'

# "context" modifiers
'#context-key table code':
type: Filter
requiretext: '"'
Expand Down
File renamed without changes
Loading