Skip to content

Commit

Permalink
feat(docs): try to generate docs via sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
pysan3 committed Jan 30, 2024
1 parent 3cd8497 commit 4d8ca25
Show file tree
Hide file tree
Showing 13 changed files with 979 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: test-and-docs

on:
push:
branches:
- main
workflow_run:
workflows:
- release-please
types:
- complete

permissions:
contents: write
pull-requests: write

jobs:
deploy:
runs-on: ubuntu-latest
name: docsgen
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: install pip deps
run: |
python -m pip install myst-parser pydata-sphinx-theme sphinx-lua sphinx-press-theme
- name: Build docs
shell: bash
run: |
make html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
23 changes: 23 additions & 0 deletions .github/workflows/lemmy-help.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: lemmy-help

on: [push]

env:
PLUGIN_NAME: pathlib.nvim

jobs:
docs:
runs-on: ubuntu-latest
name: emmylua to vimdoc
steps:
- uses: actions/checkout@v2
- name: Generating help
run: |
curl -Lq https://github.com/numToStr/lemmy-help/releases/latest/download/lemmy-help-x86_64-unknown-linux-gnu.tar.gz | tar xz
./lemmy-help ./lua/pathlib/{init,base,posix,windows}.lua | grep -v -- ' --' > doc/${{env.PLUGIN_NAME}}.txt
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref }}
commit_message: "chore(docs): auto-generate vimdoc"
file_pattern: doc/*.txt
2 changes: 2 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
release-type: simple
package-name: pathlib.nvim
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
extra-files: |
conf.py
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
!.luarc.json
/index.norg

### Sphinx ###
/_build/

### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
49 changes: 49 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'pathlib.nvim'
copyright = '2023, pysan3'
author = 'pysan3'
release = '0.3.2' # x-release-please-version

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinxcontrib.luadomain',
'sphinx_lua',
'myst_parser',
]

templates_path = ['_templates']
source_suffix = ['.rst', '.md']
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'lua_modules',
]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'pydata_sphinx_theme'
html_theme_options = {
'navigation_with_keys': False,
}
# html_theme = 'press'
html_static_path = ['_static']


# Available options and default values
lua_source_path = ["./lua/pathlib"]
lua_source_encoding = 'utf8'
lua_source_comment_prefix = '---'
lua_source_use_emmy_lua_syntax = True
lua_source_private_prefix = '_'
8 changes: 8 additions & 0 deletions doc/PathlibPath.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PathlibPath
========================================

.. toctree::
:maxdepth: 0
:caption: Index:

.. lua:autoclass:: PathlibPath
8 changes: 8 additions & 0 deletions doc/PathlibPosixPath.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PathlibPosixPath
========================================

.. toctree::
:maxdepth: 0
:caption: Index:

.. lua:autoclass:: PathlibPosixPath
8 changes: 8 additions & 0 deletions doc/PathlibWindowsPath.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PathlibWindowsPath
========================================

.. toctree::
:maxdepth: 0
:caption: Index:

.. lua:autoclass:: PathlibWindowsPath
Loading

0 comments on commit 4d8ca25

Please sign in to comment.