Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
weilinglindachen committed Apr 14, 2024
1 parent 201e85c commit 475af00
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 0 deletions.
20 changes: 20 additions & 0 deletions doc/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 = source
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)
35 changes: 35 additions & 0 deletions doc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
12 changes: 12 additions & 0 deletions doc/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.rst-content .section ol p,
.rst-content .section ul p {
margin-bottom: 0px;
}
.rst-content p + ol,
.rst-content p + ul {
margin-top: -18px;
}
.rst-content dl p + ol,
.rst-content dl p + ul {
margin-top: -6px;
}
52 changes: 52 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import sys
from pathlib import Path

CURRENT_DIR = Path(__file__).parent

sys.path.insert(0, str(CURRENT_DIR.parent.parent))


# 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 = "HanziAnalysisKit"
copyright = "2024, lope"
author = "lope"

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

extensions = [
"notfound.extension",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"numpydoc",
"sphinx_rtd_theme",
]

templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
exclude_patterns = ["build", ".DS_Store"]
exclude_trees = [".build"]


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

html_theme = "sphinx_rtd_theme" # alabaster
import sphinx_rtd_theme

html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_copy_source = True

html_static_path = ["_static"]

html_css_files = ["custom.css"]
27 changes: 27 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. HanziAnalysisKit documentation master file, created by
sphinx-quickstart on Fri Mar 29 20:21:56 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
HanziAnalysisKit documentation
=================================

We are `lopers`_.

.. _lopers: https://lope.linguistics.ntu.edu.tw/

Tools
===========

.. toctree::
:caption: Tools
:hidden:

tools/hgct
tools/lexicoR

:doc:`tools/hgct`
Understand the core fundamentals of hgct.

:doc:`tools/lexicoR`
Understand the core fundamentals of lexicoR.
53 changes: 53 additions & 0 deletions doc/source/tools/hgct.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
================
hgct
================

This section is dedicated to introducing the **core foundational elements** of hgct


Prerequisites
================
Please make sure that `Python`_ (version >= 3.8) is installed on your operating system.

.. _Python: https://www.python.org/


Set up
================


.. code-block:: python
import scrapy
class QuotesSpider(scrapy.Spider):
name = "quotes"
start_urls = [
"https://quotes.toscrape.com/tag/humor/",
]
def parse(self, response):
for quote in response.css("div.quote"):
yield {
"author": quote.xpath("span/small/text()").get(),
"text": quote.css("span.text::text").get(),
}
next_page = response.css('li.next a::attr("href")').get()
if next_page is not None:
yield response.follow(next_page, self.parse)
3 changes: 3 additions & 0 deletions doc/source/tools/lexicoR.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lexicoR
================

0 comments on commit 475af00

Please sign in to comment.