diff --git a/.gitignore b/.gitignore index 2136baa..fc546b7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,7 @@ build __pycache__ *.pyc .*.swp -ui/node_modules -ui/dist +node_modules dist demo/_build sphinx_nervproject_theme.egg-info diff --git a/CHANGES b/CHANGES index 452e9af..c5a9d53 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,15 @@ Changes ======= +1.1.0 (*2020-06-20*) +==================== + +- Remove dependency of vue, rewrite all JS +- Refactor all CSS +- Add print theme (some bugs must be fixed) +- Add weasyprint theme (some bugs must be fixed) +- Add epub theme (some bugs must be fixed) + 1.0.8 (*2020-06-10*) ==================== diff --git a/sphinx_nervproject_theme/static/fa/LICENSE.txt b/LICENCE_FOR_FONTAWESOME.txt similarity index 100% rename from sphinx_nervproject_theme/static/fa/LICENSE.txt rename to LICENCE_FOR_FONTAWESOME.txt diff --git a/README.rst b/README.rst index e7a029e..a213dbc 100644 --- a/README.rst +++ b/README.rst @@ -23,14 +23,12 @@ See details on `Sphinx theming docs =0.0.4" + } + } + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "optional": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "requires": { + "graceful-readlink": ">= 1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "optional": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "optional": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "optional": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "optional": true, + "requires": { + "prr": "~1.0.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "optional": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "optional": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "optional": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "optional": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "optional": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "optional": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "optional": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "optional": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "optional": true + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "optional": true, + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "optional": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=", + "optional": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "optional": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "optional": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "optional": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "optional": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "optional": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "optional": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "less": { + "version": "3.11.3", + "resolved": "https://registry.npmjs.org/less/-/less-3.11.3.tgz", + "integrity": "sha512-VkZiTDdtNEzXA3LgjQiC3D7/ejleBPFVvq+aRI9mIj+Zhmif5TvFPM244bT4rzkvOCvJ9q4zAztok1M7Nygagw==", + "requires": { + "clone": "^2.1.2", + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "make-dir": "^2.1.0", + "mime": "^1.4.1", + "promise": "^7.1.1", + "request": "^2.83.0", + "source-map": "~0.6.0", + "tslib": "^1.10.0" + } + }, + "less-plugin-clean-css": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/less-plugin-clean-css/-/less-plugin-clean-css-1.5.1.tgz", + "integrity": "sha1-zFeveqM5iVflbezr5jy2DCNClwM=", + "requires": { + "clean-css": "^3.0.1" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "optional": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "optional": true + }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "optional": true + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "optional": true, + "requires": { + "mime-db": "1.44.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "optional": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "optional": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "optional": true + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "optional": true, + "requires": { + "asap": "~2.0.3" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "optional": true + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "optional": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "optional": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "optional": true + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "optional": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "optional": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "optional": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "optional": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "optional": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "optional": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "optional": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "optional": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "optional": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..831704c --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "sphinx_nervproject_theme", + "version": "1.0.0", + "description": "Sphinx Nerv Project Theme", + "main": "index.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "build:theme": "lessc --clean-css='--advanced' ui/theme.less sphinx_nervproject_theme/static/sphinx_nervproject_theme.css", + "build:weasyprint": "lessc --clean-css='--advanced' ui/theme-weasyprint.less sphinx_nervproject_theme/static/sphinx_nervproject_weasyprint.css", + "build:epub": "lessc --clean-css='--advanced' ui/theme-epub.less sphinx_nervproject_theme/static/sphinx_nervproject_epub.css", + "build": "npm run build:theme && npm run build:weasyprint && npm run build:epub" + }, + "repository": { + "type": "git", + "url": "git@procrastinator.nerv-project.eu:nerv-project/communication/sphinx_nervproject_theme" + }, + "author": "kujiu", + "license": "EUPL 1.2", + "dependencies": { + "less": "^3.11.3", + "less-plugin-clean-css": "^1.5.1" + } +} diff --git a/setup.py b/setup.py index 2a34ce3..1752e33 100644 --- a/setup.py +++ b/setup.py @@ -22,12 +22,13 @@ class TranslateCommand(distutils.cmd.Command): for cmd_name in self.get_sub_commands(): self.run_command(cmd_name) + with open("README.rst", "r") as fh: long_description = fh.read() setup( name="sphinx_nervproject_theme", - version="1.0.8", + version="1.1.0", url="https://procrastinator.nerv-project.eu/nerv-project/communication/sphinx_nervproject_theme", license="EUPL 1.2", author="Kujiu", @@ -36,7 +37,7 @@ setup( long_description=long_description, long_description_content_type="text/x-rst", packages=["sphinx_nervproject_theme"], - cmdclass = { + cmdclass={ 'translate': TranslateCommand, }, package_data={ diff --git a/sphinx_nervproject_theme/__init__.py b/sphinx_nervproject_theme/__init__.py index dbfd523..519956c 100644 --- a/sphinx_nervproject_theme/__init__.py +++ b/sphinx_nervproject_theme/__init__.py @@ -1,11 +1,15 @@ from os import path +import sys from docutils import nodes from sphinx.environment.collectors import EnvironmentCollector from sphinx import addnodes from sphinx.util.osutil import relative_uri -__version__ = (1, 0, 8) +__version__ = (1, 1, 0) + + +sys.setrecursionlimit(15000) class SimpleTocTreeCollector(EnvironmentCollector): @@ -35,19 +39,15 @@ class SimpleTocTreeCollector(EnvironmentCollector): for docname in docnames: env.toc_dict[docname] = other.toc_dict[docname] - def process_doc(self, app, doctree): - docname = app.env.docname # sphinx mutates this, ouch!!! - - # print(f"================ Collector\n{docname}\n============\n") - # get 1 level document toc (sections) + docname = app.env.docname section_nodes = [s for s in doctree if isinstance(s, nodes.section)] # if first level is a single section, # ignore it and use second level of sections if len(section_nodes) == 1: section2_nodes = [s for s in section_nodes[0] if isinstance(s, nodes.section)] - if section2_nodes: # do not replace with level-2 sections if None + if section2_nodes: # do not replace with level-2 sections if None section_nodes = section2_nodes sections = [] @@ -63,7 +63,6 @@ class SimpleTocTreeCollector(EnvironmentCollector): } - def add_toctree_data(app, pagename, templatename, context, doctree): """Create toctree_data, used to build sidebar navigation @@ -88,7 +87,7 @@ def add_toctree_data(app, pagename, templatename, context, doctree): master = app.env.get_doctree(app.env.config.master_doc) # each toctree will create navigation section - res = [] # list of top level toctrees in master_doc + res = [] # list of top level toctrees in master_doc for tree in master.traverse(addnodes.toctree): # special case for toctree that includes a single item @@ -101,7 +100,7 @@ def add_toctree_data(app, pagename, templatename, context, doctree): for tree in toctrees: pass - current0 = False # same page might have multiple tocs + current0 = False # same page might have multiple tocs # add toc tree items, expand one more level if toctree is current page entries = [] @@ -123,7 +122,7 @@ def add_toctree_data(app, pagename, templatename, context, doctree): 'children': children, }) - toc_docname = tree['parent'] # docname where this toc appears + toc_docname = tree['parent'] # docname where this toc appears title = tree['caption'] toc_caption = tree['caption'] @@ -135,7 +134,7 @@ def add_toctree_data(app, pagename, templatename, context, doctree): # First parent is "compound" node toctree-wrapper, # second parent is the section containing the toctree toc_section = tree.parent.parent - if toc_section['ids']: # no id means toc actually not in a section + if toc_section['ids']: # no id means toc actually not in a section # TODO: should we be strict about toc being inside a section anchor_id = toc_section['ids'][0] if not title: @@ -157,10 +156,22 @@ def add_toctree_data(app, pagename, templatename, context, doctree): context['toctree_data'] = res +def on_config_inited(app, conf): + exclude_files = list(app.config.get('epub_exclude_files', [])) + exclude_files.append('_static/sphinx_nervproject_theme.js') + exclude_files.append('_static/sphinx_nervproject_simple.css') + exclude_files.append('_static/sphinx_nervproject_theme.css') + exclude_files.append('_static/basic.css') + app.config.exclude_files = exclude_files + + app.config.weasyprint_footer_selector = 'footer.footer' + app.config.weasyprint_header_selector = 'header.navbar' + def setup(app): app.add_env_collector(SimpleTocTreeCollector) app.connect('html-page-context', add_toctree_data) + app.connect('config-inited', on_config_inited) app.add_html_theme('nervproject', path.abspath(path.dirname(__file__))) locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale') diff --git a/sphinx_nervproject_theme/layout.html b/sphinx_nervproject_theme/layout.html index d5d6fdd..d107591 100644 --- a/sphinx_nervproject_theme/layout.html +++ b/sphinx_nervproject_theme/layout.html @@ -1,36 +1,41 @@ - + - - + + {{- metatags }} {%- block htmltitle %} {{ title|striptags|e }}{{ titlesuffix }} {%- endblock %} - {# #} + {# #} {%- block css %} - - - - {% if theme_isso %} - - - + + {% if builder=='weasyprint' %} + + {% elif builder=='epub' %} + + {% else %} + + {% if theme_isso %} + + + + {% endif %} {% endif %} {%- for css in css_files %} {%- if css|attr("rel") %} @@ -42,20 +47,22 @@ {%- endblock %} {%- block scripts %} - {# FIXME: use link-preload #} - - {% if theme_fathom %} - {%- include "util/fathom.html" %} + {% if builder=='html' %} + {# FIXME: use link-preload #} + + {% if theme_fathom %} + {%- include "util/fathom.html" %} + {% endif %} + + + {%- for scriptfile in script_files %} + {{ js_tag(scriptfile) }} + {%- endfor %} + + + + {% endif %} - - - {%- for scriptfile in script_files %} - {{ js_tag(scriptfile) }} - {%- endfor %} - - {# press js #} - - {%- endblock %} {%- if pageurl %} @@ -70,33 +77,31 @@ -
+
{%- block container %} {%- block header %}{%- include "util/navbar.html" %}{% endblock %} - {# close sidebar when clicked out of it #} - -
{%- block sidebar %} - + {% if builder=='html' %} + + {% endif %} {%- endblock %} - +
{%- block document %} {% block body_header %} {%- include "util/bodyheader.html" %} @@ -105,7 +110,7 @@ {% block body %} {% endblock %} {%- endblock %} - +
{%- block footer %} diff --git a/sphinx_nervproject_theme/page.html b/sphinx_nervproject_theme/page.html index 496a4f0..9e0b857 100644 --- a/sphinx_nervproject_theme/page.html +++ b/sphinx_nervproject_theme/page.html @@ -2,40 +2,29 @@ {%- block extrahead %} {{ super() }} {% if feed_path %} - + {% endif %} {% endblock %} {% block body %} {{ body }} -
- {% if ablog and pagename in ablog %} - {% include "postnavy.html" %} - {% include "share.html" %} - {% else %} - {% if ablog and theme_share_all %} + {% if builder=='html' %} +
+ {% if ablog and pagename in ablog %} + {% include "postnavy.html" %} {% include "share.html" %} + {% else %} + {% if ablog and theme_share_all %} + {% include "share.html" %} + {% endif %} {% endif %} + {% if ablog and ablog.disqus_shortname and ablog.blog_baseurl and + (not ablog[pagename].nocomments) and + ((pagename in ablog and (ablog[pagename].published or + ablog.disqus_drafts)) or + (not pagename in ablog and ablog.disqus_pages)) %} + {% include "util/disqus.html" %} + {% endif %} +
{% endif %} - {% if ablog and ablog.disqus_shortname and ablog.blog_baseurl and - (not ablog[pagename].nocomments) and - ((pagename in ablog and (ablog[pagename].published or - ablog.disqus_drafts)) or - (not pagename in ablog and ablog.disqus_pages)) %} - {% include "util/disqus.html" %} - {% endif %} - {% if ablog and theme_isso and - (not ablog[pagename].nocomments) and - ((pagename in ablog and (ablog[pagename].published or - ablog.disqus_drafts)) or - (not pagename in ablog and ablog.disqus_pages)) %} -
-

{{ _("Comments") }}

-
-
- {% endif %} -
{% endblock %} diff --git a/sphinx_nervproject_theme/share.html b/sphinx_nervproject_theme/share.html index 55772e4..0cfc297 100644 --- a/sphinx_nervproject_theme/share.html +++ b/sphinx_nervproject_theme/share.html @@ -1,6 +1,6 @@
{% set post = ablog[pagename] %} -