setup and fix basant with the changes to TagHelper
This commit is contained in:
parent
15db0ea5c1
commit
36e967f976
|
@ -1,5 +1,6 @@
|
||||||
from . import mistune
|
from . import mistune
|
||||||
from basant.shared import TagHelper, config
|
from poonam import TagHelper
|
||||||
|
from basant.shared import config
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
import argparse
|
import argparse
|
||||||
import glob
|
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):
|
def generate_index_pages(template=config.template_main, template_nav=config.template_nav, template_head=config.template_head):
|
||||||
template = template
|
template = template
|
||||||
all_tags = TagHelper.getAllTags()
|
all_tags = TagHelper.getAllTags(path=config.files_folder)
|
||||||
for index in all_tags.keys():
|
for index in all_tags.keys():
|
||||||
pages = all_tags[index]
|
pages = all_tags[index]
|
||||||
pages = add_file_path(pages, config.files_folder)
|
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('')
|
file_loader = FileSystemLoader('')
|
||||||
env = Environment(loader=file_loader)
|
env = Environment(loader=file_loader)
|
||||||
template = env.get_template(template)
|
template = env.get_template(template)
|
||||||
all_tags = TagHelper.getAllTags()
|
all_tags = TagHelper.getAllTags(path=config.files_folder)
|
||||||
parsed_set = {}
|
parsed_set = {}
|
||||||
for k, v in all_tags.items():
|
for k, v in all_tags.items():
|
||||||
parsed_set[k] = len(v)
|
parsed_set[k] = len(v)
|
||||||
|
@ -445,7 +446,10 @@ def create_entries(pages):
|
||||||
# Copy assets to production folder
|
# Copy assets to production folder
|
||||||
def move_files(site_folder, path):
|
def move_files(site_folder, path):
|
||||||
assets = os.listdir(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:
|
if assets:
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
asset = os.path.join(path, asset)
|
asset = os.path.join(path, asset)
|
||||||
|
|
|
@ -5,18 +5,10 @@
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
<div style='overflow: hidden; display:flex; justify-content: space-between;position:relative'>
|
<div style='overflow: hidden; display:flex; justify-content: space-between;position:relative'>
|
||||||
<h3 style='float:left;padding-right:150px'>
|
<h3 style='float:left;padding-right:150px'>
|
||||||
{% if title %}
|
{% if entry['title']|length > 1 %}
|
||||||
<a href='{{entry['slug']}}'>{{entry["title"]}}</a>
|
<a href='{{entry['file']}}.html'>{{entry["title"]}}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<!--
|
<a href='{{entry['file']}}.html'>{{entry['file']}}</a>
|
||||||
TODO
|
|
||||||
Sometimes the entry doesn't output a title and I'm not entirely sure why
|
|
||||||
--!>
|
|
||||||
{% if entry['title']|length > 0 %}
|
|
||||||
<a href='{{entry['file']}}.html'>{{entry["title"]}}</a>
|
|
||||||
{% else %}
|
|
||||||
<a href='{{entry['file']}}.html'>{{entry['file']}}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
<p style='position:absolute;bottom:0;margin-left:29em'>{{entry['date']}}</p>
|
<p style='position:absolute;bottom:0;margin-left:29em'>{{entry['date']}}</p>
|
||||||
|
|
|
@ -3,7 +3,6 @@ nav_tags = ['dev', 'way', 'recipe', 'ops', 'blog',
|
||||||
relative_build_url = ""
|
relative_build_url = ""
|
||||||
absolute_build_url = "https://anish.lakhwara.com/"
|
absolute_build_url = "https://anish.lakhwara.com/"
|
||||||
files_folder = 'public/'
|
files_folder = 'public/'
|
||||||
_folder = 'public/'
|
|
||||||
build_folder = "output/"
|
build_folder = "output/"
|
||||||
assets_folder = "./basant/assets/"
|
assets_folder = "./basant/assets/"
|
||||||
medias_folder = "media/"
|
medias_folder = "media/"
|
||||||
|
|
27
flake.lock
27
flake.lock
|
@ -30,32 +30,19 @@
|
||||||
"type": "github"
|
"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": {
|
"poonam": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
"vimwiki-cli": "vimwiki-cli"
|
"vimwiki-cli": "vimwiki-cli"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1680876003,
|
"lastModified": 1681309221,
|
||||||
"narHash": "sha256-3aN6OSLrDpMHgViYr+C0qV7bVULpoN2vkcEdeKPq7B8=",
|
"narHash": "sha256-iYin3deklQrF6Hjk8bPzlKleLtBk3QWLfJqWdcqFyAs=",
|
||||||
"ref": "main",
|
"ref": "main",
|
||||||
"rev": "65bb6b4d5f1f3e6f022b939b7feaf927c5c712cd",
|
"rev": "543cbf2c0e3ab3f64738987d818982f1b7446098",
|
||||||
"revCount": 588,
|
"revCount": 606,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
||||||
},
|
},
|
||||||
|
|
20
flake.nix
20
flake.nix
|
@ -5,6 +5,7 @@
|
||||||
nixpkgs.url = "github:nixos/nixpkgs";
|
nixpkgs.url = "github:nixos/nixpkgs";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main";
|
poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main";
|
||||||
|
poonam.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, poonam }:
|
outputs = { self, nixpkgs, flake-utils, poonam }:
|
||||||
|
@ -12,15 +13,19 @@
|
||||||
(system:
|
(system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
my-python = pkgs.python3;
|
my-python = pkgs.python39;
|
||||||
python-with-my-packages = my-python.withPackages (p: with p; [
|
finalPython = my-python.override { packageOverrides = poonam.overlays.default; };
|
||||||
|
python-with-my-packages = finalPython.withPackages (p: with p; [
|
||||||
jinja2
|
jinja2
|
||||||
click
|
click
|
||||||
pytest
|
pytest
|
||||||
|
poonam
|
||||||
|
python-ctags3
|
||||||
# other python packages you want in the devShell
|
# 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
|
# Packages necessary at runtime to run build script
|
||||||
|
poonam
|
||||||
jinja2
|
jinja2
|
||||||
python-ctags3
|
python-ctags3
|
||||||
];
|
];
|
||||||
|
@ -31,17 +36,18 @@
|
||||||
python-with-my-packages
|
python-with-my-packages
|
||||||
pkgs.pandoc
|
pkgs.pandoc
|
||||||
self.packages.x86_64-linux.basant
|
self.packages.x86_64-linux.basant
|
||||||
|
poonam.packages.${system}.poonam
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
# PYTHONPATH=${python-with-my-packages}/${python-with-my-packages.sitePackages}
|
# PYTHONPATH=${python-with-my-packages}/${python-with-my-packages.sitePackages}
|
||||||
# maybe set more env-vars
|
# maybe set more env-vars
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
packages.basant = pkgs.python3Packages.buildPythonPackage {
|
packages.basant = finalPython.pkgs.pythonPackages.buildPythonApplication {
|
||||||
pname = "basant";
|
pname = "basant";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
version = "0.1";
|
version = "0.2";
|
||||||
propagatedBuildInputs = [ python-deps ];
|
propagatedBuildInputs = [ poonam.packages.${system}.poonam python-deps ];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
packages.site = pkgs.stdenv.mkDerivation {
|
packages.site = pkgs.stdenv.mkDerivation {
|
||||||
|
@ -50,7 +56,7 @@
|
||||||
buildInputs = [ poonam.defaultPackage.${system} self.packages.${system}.basant ];
|
buildInputs = [ poonam.defaultPackage.${system} self.packages.${system}.basant ];
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
cp -r ${poonam.defaultPackage.${system}}/public/ ./
|
cp -r ${poonam.defaultPackage.${system}}/public/ ./
|
||||||
cp -r ${poonam.defaultPackage.${system}}/assets/ ./
|
cp -r ${poonam.defaultPackage.${system}}/media/ ./
|
||||||
'';
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${self.packages.${system}.basant}/bin/main.py
|
${self.packages.${system}.basant}/bin/main.py
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -2,8 +2,9 @@ from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='basant',
|
name='basant',
|
||||||
version='0.1',
|
version='0.2',
|
||||||
author='Anish Lakhwara',
|
author='Anish Lakhwara',
|
||||||
|
install_requires = [ "jinja2" ],
|
||||||
# TODO: broken because of import stuff, need to refactor app somehow
|
# TODO: broken because of import stuff, need to refactor app somehow
|
||||||
project_urls={"Source code": "https://git.sealight.xyz/aynish/basant"},
|
project_urls={"Source code": "https://git.sealight.xyz/aynish/basant"},
|
||||||
url="https://git.sealight.xyz/aynish/basant",
|
url="https://git.sealight.xyz/aynish/basant",
|
||||||
|
|
Loading…
Reference in a new issue