diff --git a/basant/build/kitaab.py b/basant/build/kitaab.py index 3b9c9e8..cc034b5 100644 --- a/basant/build/kitaab.py +++ b/basant/build/kitaab.py @@ -1,5 +1,6 @@ from . import mistune -from basant.shared import TagHelper, config +from poonam import TagHelper +from basant.shared import config from jinja2 import Environment, FileSystemLoader import argparse import glob @@ -57,7 +58,7 @@ def add_file_path(pages, root_dir): def generate_index_pages(template=config.template_main, template_nav=config.template_nav, template_head=config.template_head): template = template - all_tags = TagHelper.getAllTags() + all_tags = TagHelper.getAllTags(path=config.files_folder) for index in all_tags.keys(): pages = all_tags[index] pages = add_file_path(pages, config.files_folder) @@ -90,7 +91,7 @@ def generate_table_index(template=config.template_index, template_nav=config.tem file_loader = FileSystemLoader('') env = Environment(loader=file_loader) template = env.get_template(template) - all_tags = TagHelper.getAllTags() + all_tags = TagHelper.getAllTags(path=config.files_folder) parsed_set = {} for k, v in all_tags.items(): parsed_set[k] = len(v) @@ -445,7 +446,10 @@ def create_entries(pages): # Copy assets to production folder def move_files(site_folder, path): assets = os.listdir(path) - to_copy_to = path.split("basant/")[1] + if 'basant/' in path: + to_copy_to = path.split("basant/")[1] + else: + to_copy_to = path if assets: for asset in assets: asset = os.path.join(path, asset) diff --git a/basant/partial/list.html b/basant/partial/list.html index 74fbce8..994ec60 100644 --- a/basant/partial/list.html +++ b/basant/partial/list.html @@ -5,18 +5,10 @@ {% for entry in entries %}

- {% if title %} - {{entry["title"]}} + {% if entry['title']|length > 1 %} + {{entry["title"]}} {% else %} - - {% if entry['title']|length > 0 %} - {{entry["title"]}} - {% else %} - {{entry['file']}} - {% endif %} + {{entry['file']}} {% endif %}

{{entry['date']}}

diff --git a/basant/shared/config.py b/basant/shared/config.py index fa7ab19..a128270 100644 --- a/basant/shared/config.py +++ b/basant/shared/config.py @@ -3,7 +3,6 @@ nav_tags = ['dev', 'way', 'recipe', 'ops', 'blog', relative_build_url = "" absolute_build_url = "https://anish.lakhwara.com/" files_folder = 'public/' -_folder = 'public/' build_folder = "output/" assets_folder = "./basant/assets/" medias_folder = "media/" diff --git a/flake.lock b/flake.lock index 51d67ee..e65da4a 100644 --- a/flake.lock +++ b/flake.lock @@ -30,32 +30,19 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1662446902, - "narHash": "sha256-Dmsd3jSG2ldZUlhFaIwunqgMf14EEK7ylXpw+OPDLxE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "3bfaf06b12253ddaafe64a67f4ed39b547d41667", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, "poonam": { "inputs": { - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "nixpkgs" + ], "vimwiki-cli": "vimwiki-cli" }, "locked": { - "lastModified": 1680876003, - "narHash": "sha256-3aN6OSLrDpMHgViYr+C0qV7bVULpoN2vkcEdeKPq7B8=", + "lastModified": 1681309221, + "narHash": "sha256-iYin3deklQrF6Hjk8bPzlKleLtBk3QWLfJqWdcqFyAs=", "ref": "main", - "rev": "65bb6b4d5f1f3e6f022b939b7feaf927c5c712cd", - "revCount": 588, + "rev": "543cbf2c0e3ab3f64738987d818982f1b7446098", + "revCount": 606, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, diff --git a/flake.nix b/flake.nix index fd891e4..fed424a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ nixpkgs.url = "github:nixos/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main"; + poonam.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self, nixpkgs, flake-utils, poonam }: @@ -12,15 +13,19 @@ (system: let pkgs = nixpkgs.legacyPackages.${system}; - my-python = pkgs.python3; - python-with-my-packages = my-python.withPackages (p: with p; [ + my-python = pkgs.python39; + finalPython = my-python.override { packageOverrides = poonam.overlays.default; }; + python-with-my-packages = finalPython.withPackages (p: with p; [ jinja2 click pytest + poonam + python-ctags3 # other python packages you want in the devShell ]); - python-deps = with pkgs.python3Packages; [ + python-deps = with finalPython.pkgs.pythonPackages; [ # Packages necessary at runtime to run build script + poonam jinja2 python-ctags3 ]; @@ -31,17 +36,18 @@ python-with-my-packages pkgs.pandoc self.packages.x86_64-linux.basant + poonam.packages.${system}.poonam ]; shellHook = '' # PYTHONPATH=${python-with-my-packages}/${python-with-my-packages.sitePackages} # maybe set more env-vars ''; }; - packages.basant = pkgs.python3Packages.buildPythonPackage { + packages.basant = finalPython.pkgs.pythonPackages.buildPythonApplication { pname = "basant"; src = ./.; - version = "0.1"; - propagatedBuildInputs = [ python-deps ]; + version = "0.2"; + propagatedBuildInputs = [ poonam.packages.${system}.poonam python-deps ]; doCheck = false; }; packages.site = pkgs.stdenv.mkDerivation { @@ -50,7 +56,7 @@ buildInputs = [ poonam.defaultPackage.${system} self.packages.${system}.basant ]; configurePhase = '' cp -r ${poonam.defaultPackage.${system}}/public/ ./ - cp -r ${poonam.defaultPackage.${system}}/assets/ ./ + cp -r ${poonam.defaultPackage.${system}}/media/ ./ ''; buildPhase = '' ${self.packages.${system}.basant}/bin/main.py diff --git a/setup.py b/setup.py index 5b3ae3e..97fd2bb 100644 --- a/setup.py +++ b/setup.py @@ -2,8 +2,9 @@ from setuptools import setup, find_packages setup( name='basant', - version='0.1', + version='0.2', author='Anish Lakhwara', + install_requires = [ "jinja2" ], # TODO: broken because of import stuff, need to refactor app somehow project_urls={"Source code": "https://git.sealight.xyz/aynish/basant"}, url="https://git.sealight.xyz/aynish/basant",