build from poonam, and build the site somewhat correctly
This commit is contained in:
parent
a50b56d7e4
commit
d52b9ddd9d
|
@ -119,11 +119,11 @@ def generate_html_pages(site_folder, entries, template, sub_pages_list, template
|
||||||
name_of_site="Kitaab", page_navigation=nav_html, page_title=entry['title'], build_url=entry['parent_text'], config=config)
|
name_of_site="Kitaab", page_navigation=nav_html, page_title=entry['title'], build_url=entry['parent_text'], config=config)
|
||||||
|
|
||||||
# Checking if content folder exists
|
# Checking if content folder exists
|
||||||
folderExists = os.path.exists(site_folder+entry['folder'])
|
folderExists = os.path.exists(site_folder + entry['folder'])
|
||||||
# If not, create it
|
# If not, create it
|
||||||
if config.flat_build == False:
|
if config.flat_build == False:
|
||||||
if not folderExists:
|
if not folderExists:
|
||||||
os.mkdir(site_folder+entry['folder'])
|
os.mkdir(site_folder + entry['folder'])
|
||||||
|
|
||||||
# Write the HTML file
|
# Write the HTML file
|
||||||
slug_file = site_folder + entry['slug']
|
slug_file = site_folder + entry['slug']
|
||||||
|
@ -284,7 +284,7 @@ def replacement_function(replace):
|
||||||
# TODO gross hardcoded
|
# TODO gross hardcoded
|
||||||
lines = []
|
lines = []
|
||||||
# this file should probably be an asset??
|
# this file should probably be an asset??
|
||||||
with open('raw/210124-0033.wiki') as f:
|
with open(config.content_folder[0] + '210124-0033.wiki') as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
lines = lines[-2:]
|
lines = lines[-2:]
|
||||||
line1 = lines[0].split(',')
|
line1 = lines[0].split(',')
|
||||||
|
@ -383,11 +383,12 @@ 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 assets:
|
if assets:
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
asset = os.path.join(path, asset)
|
asset = os.path.join(path, asset)
|
||||||
if os.path.isfile(asset):
|
if os.path.isfile(asset):
|
||||||
shutil.copy(asset, site_folder+path)
|
shutil.copy(asset, site_folder + to_copy_to)
|
||||||
else:
|
else:
|
||||||
print("No assets found!")
|
print("No assets found!")
|
||||||
|
|
||||||
|
@ -443,7 +444,7 @@ def clean_path(path):
|
||||||
# last_edit = str(subprocess.check_output('git log -1 --format="%ci" ' + path, shell=True)).replace("b'", "").replace("\\n'", '')
|
# last_edit = str(subprocess.check_output('git log -1 --format="%ci" ' + path, shell=True)).replace("b'", "").replace("\\n'", '')
|
||||||
# get last edited time from system
|
# get last edited time from system
|
||||||
try:
|
try:
|
||||||
last_edit = os.path.getmtime('/home/anish/'+path)
|
last_edit = os.path.getmtime('/home/anish/' + path)
|
||||||
last_edit_iso = datetime.fromtimestamp(last_edit)
|
last_edit_iso = datetime.fromtimestamp(last_edit)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
last_edit_iso = datetime.fromtimestamp(0)
|
last_edit_iso = datetime.fromtimestamp(0)
|
||||||
|
@ -556,8 +557,8 @@ def generate_website():
|
||||||
shutil.rmtree(config.build_folder)
|
shutil.rmtree(config.build_folder)
|
||||||
|
|
||||||
# Make new folders
|
# Make new folders
|
||||||
os.makedirs(config.build_folder + config.assets_folder)
|
os.makedirs(config.build_folder + 'assets/')
|
||||||
os.makedirs(config.build_folder + config.medias_folder)
|
os.makedirs(config.build_folder + 'media/')
|
||||||
|
|
||||||
# Get main html template
|
# Get main html template
|
||||||
file_loader = FileSystemLoader('')
|
file_loader = FileSystemLoader('')
|
||||||
|
|
|
@ -22,6 +22,8 @@ media="screen" title="no title" charset="utf-8">
|
||||||
<meta name="twitter:title" content="page_title | config.name_of_site">
|
<meta name="twitter:title" content="page_title | config.name_of_site">
|
||||||
<meta name="twitter:image" content="build_urlassets/social.png">
|
<meta name="twitter:image" content="build_urlassets/social.png">
|
||||||
<meta name="twitter:image:alt" content="page_title | config.name_of_site">
|
<meta name="twitter:image:alt" content="page_title | config.name_of_site">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="assets/main.css">
|
||||||
--!>
|
--!>
|
||||||
<link rel="apple-touch-icon" sizes="57x57" href="build_urlassets/apple-icon-57x57.png">
|
<link rel="apple-touch-icon" sizes="57x57" href="build_urlassets/apple-icon-57x57.png">
|
||||||
<link rel="apple-touch-icon" sizes="60x60" href="build_urlassets/apple-icon-60x60.png">
|
<link rel="apple-touch-icon" sizes="60x60" href="build_urlassets/apple-icon-60x60.png">
|
||||||
|
@ -40,7 +42,6 @@ media="screen" title="no title" charset="utf-8">
|
||||||
<meta name="msapplication-TileImage" content="build_urlassets/ms-icon-144x144.png">
|
<meta name="msapplication-TileImage" content="build_urlassets/ms-icon-144x144.png">
|
||||||
<meta name="theme-color" content="#5927e0">
|
<meta name="theme-color" content="#5927e0">
|
||||||
<link rel="canonical" href="{{build_url}}">
|
<link rel="canonical" href="{{build_url}}">
|
||||||
<link rel="stylesheet" href="assets/main.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="flow-large container">
|
<body class="flow-large container">
|
||||||
|
|
|
@ -10,37 +10,38 @@
|
||||||
<meta property="og:description"
|
<meta property="og:description"
|
||||||
content="config.site_meta_description">
|
content="config.site_meta_description">
|
||||||
<meta property="og:site_name" content="{{config.name_of_site}}">
|
<meta property="og:site_name" content="{{config.name_of_site}}">
|
||||||
<meta property="og:url" content="build_url">
|
<meta property="og:url" content="{{build_url}}">
|
||||||
<meta property="og:image" content="build_urlassets/social.png">
|
<meta property="og:image" content="assets/social.png">
|
||||||
<meta property="og:image:height" content="300">
|
<meta property="og:image:height" content="300">
|
||||||
<meta property="og:image:width" content="300">
|
<meta property="og:image:width" content="300">
|
||||||
<meta property="og:image:type" content="image/jpeg">
|
<meta property="og:image:type" content="image/jpeg">
|
||||||
<link rel="stylesheet" href="asset/style.css" type="text/css"
|
<link rel="stylesheet" href="assets/style.css" type="text/css"
|
||||||
media="screen" title="no title" charset="utf-8">
|
media="screen" title="no title" charset="utf-8">
|
||||||
<!-- Mastodon stuff should go here
|
<!-- Mastodon stuff should go here
|
||||||
<meta name="twitter:site" content="config.twitter_name">
|
<meta name="twitter:site" content="config.twitter_name">
|
||||||
<meta name="twitter:title" content="page_title | config.name_of_site">
|
<meta name="twitter:title" content="page_title | config.name_of_site">
|
||||||
<meta name="twitter:image" content="build_urlassets/social.png">
|
<meta name="twitter:image" content="{{build_url}}assets/social.png">
|
||||||
<meta name="twitter:image:alt" content="page_title | config.name_of_site">
|
<meta name="twitter:image:alt" content="page_title | config.name_of_site">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="assets/main.css" type="text/css">
|
||||||
--!>
|
--!>
|
||||||
<link rel="apple-touch-icon" sizes="57x57" href="build_urlassets/apple-icon-57x57.png">
|
<link rel="apple-touch-icon" sizes="57x57" href="{{build_url}}assets/apple-icon-57x57.png">
|
||||||
<link rel="apple-touch-icon" sizes="60x60" href="build_urlassets/apple-icon-60x60.png">
|
<link rel="apple-touch-icon" sizes="60x60" href="{{build_url}}assets/apple-icon-60x60.png">
|
||||||
<link rel="apple-touch-icon" sizes="72x72" href="build_urlassets/apple-icon-72x72.png">
|
<link rel="apple-touch-icon" sizes="72x72" href="{{build_url}}assets/apple-icon-72x72.png">
|
||||||
<link rel="apple-touch-icon" sizes="76x76" href="build_urlassets/apple-icon-76x76.png">
|
<link rel="apple-touch-icon" sizes="76x76" href="{{build_url}}assets/apple-icon-76x76.png">
|
||||||
<link rel="apple-touch-icon" sizes="114x114" href="build_urlassets/apple-icon-114x114.png">
|
<link rel="apple-touch-icon" sizes="114x114" href="{{build_url}}assets/apple-icon-114x114.png">
|
||||||
<link rel="apple-touch-icon" sizes="120x120" href="build_urlassets/apple-icon-120x120.png">
|
<link rel="apple-touch-icon" sizes="120x120" href="{{build_url}}assets/apple-icon-120x120.png">
|
||||||
<link rel="apple-touch-icon" sizes="144x144" href="build_urlassets/apple-icon-144x144.png">
|
<link rel="apple-touch-icon" sizes="144x144" href="{{build_url}}assets/apple-icon-144x144.png">
|
||||||
<link rel="apple-touch-icon" sizes="152x152" href="build_urlassets/apple-icon-152x152.png">
|
<link rel="apple-touch-icon" sizes="152x152" href="{{build_url}}assets/apple-icon-152x152.png">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="build_urlassets/apple-icon-180x180.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="{{build_url}}assets/apple-icon-180x180.png">
|
||||||
<link rel="icon" type="image/png" sizes="192x192" href="build_urlassets/android-icon-192x192.png">
|
<link rel="icon" type="image/png" sizes="192x192" href="{{build_url}}assets/android-icon-192x192.png">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="build_urlassets/favicon-32x32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="{{build_url}}assets/favicon-32x32.png">
|
||||||
<link rel="icon" type="image/png" sizes="96x96" href="build_urlassets/favicon-96x96.png">
|
<link rel="icon" type="image/png" sizes="96x96" href="{{build_url}}assets/favicon-96x96.png">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="build_urlassets/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="{{build_url}}assets/favicon-16x16.png">
|
||||||
<meta name="msapplication-TileColor" content="#5927e0">
|
<meta name="msapplication-TileColor" content="#5927e0">
|
||||||
<meta name="msapplication-TileImage" content="build_urlassets/ms-icon-144x144.png">
|
<meta name="msapplication-TileImage" content="{{build_url}}assets/ms-icon-144x144.png">
|
||||||
<meta name="theme-color" content="#5927e0">
|
<meta name="theme-color" content="#5927e0">
|
||||||
<link rel="canonical" href="{{build_url}}">
|
<link rel="canonical" href="{{build_url}}">
|
||||||
<link rel="stylesheet" href="assets/main.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="flow-large container">
|
<body class="flow-large container">
|
||||||
|
|
|
@ -27,7 +27,7 @@ def untaggedFiles(AllFileList=getAllFiles()):
|
||||||
return set.difference(AllFileList, doNotTakeFiles)
|
return set.difference(AllFileList, doNotTakeFiles)
|
||||||
|
|
||||||
|
|
||||||
def loadTagFile(path=config.files_folder + '/.vimwiki_tags'):
|
def loadTagFile(path=config.files_folder + '.vimwiki_tags'):
|
||||||
# Available file information keys:
|
# Available file information keys:
|
||||||
# opened - was the tag file successfully opened?
|
# opened - was the tag file successfully opened?
|
||||||
# error_number - errno value when 'opened' is false
|
# error_number - errno value when 'opened' is false
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
content_folder = ['raw']
|
content_folder = ['public/']
|
||||||
nav_tags = ['dev', 'way', 'recipe', 'ops', 'blog',
|
nav_tags = ['dev', 'way', 'recipe', 'ops', 'blog',
|
||||||
'rock', 'phil', 'story', 'blog', 'untagged']
|
'rock', 'phil', 'story', 'blog', 'untagged']
|
||||||
relative_build_url = ""
|
relative_build_url = ""
|
||||||
absolute_build_url = "https://anish.lakhwara.com/"
|
absolute_build_url = "https://anish.lakhwara.com/"
|
||||||
files_folder = '/home/anish/vimwiki2'
|
files_folder = 'public/'
|
||||||
build_folder = "output/"
|
build_folder = "output/"
|
||||||
assets_folder = "./basant/assets/"
|
assets_folder = "basant/assets/"
|
||||||
medias_folder = "./basant/media/"
|
medias_folder = "basant/media/"
|
||||||
raw_folder = "raw/"
|
raw_folder = "raw/"
|
||||||
template_main = "./basant/partial/main.html"
|
template_main = "./basant/partial/main.html"
|
||||||
template_nav = "./basant/partial/nav.html"
|
template_nav = "./basant/partial/nav.html"
|
||||||
|
|
37
flake.lock
37
flake.lock
|
@ -30,10 +30,45 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1649667661,
|
||||||
|
"narHash": "sha256-9cbstidkXdAC3ZzokV6clgCoeLSbbs2tis9KFsqCzTM=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a48aeae76ad50bb15ad9bda2cf51d7ae5c621853",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"poonam": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1649834414,
|
||||||
|
"narHash": "sha256-Wu/PJQ+4KBL7GkAJWDLY6CG7n/GIP9keB1nLvFsEpAw=",
|
||||||
|
"ref": "main",
|
||||||
|
"rev": "5e217728465fdd0617c8496dd4059d631b7394ae",
|
||||||
|
"revCount": 302,
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"ref": "main",
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"poonam": "poonam"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
26
flake.nix
26
flake.nix
|
@ -4,21 +4,24 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
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";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs = { self, nixpkgs, flake-utils, poonam }:
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
my-python = pkgs.python3;
|
my-python = pkgs.python3;
|
||||||
python-with-my-packages = my-python.withPackages (p: with p; [
|
python-with-my-packages = my-python.withPackages (p: with p; [
|
||||||
icecream
|
|
||||||
python-ctags3
|
|
||||||
jinja2
|
jinja2
|
||||||
click
|
click
|
||||||
pypandoc
|
# other python packages you want in the devShell
|
||||||
# other python packages you want
|
|
||||||
]);
|
]);
|
||||||
|
python-deps = with pkgs.python3Packages; [
|
||||||
|
# Packages necessary at runtime to run build script
|
||||||
|
jinja2
|
||||||
|
python-ctags3
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
|
@ -33,26 +36,29 @@
|
||||||
# maybe set more env-vars
|
# maybe set more env-vars
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
defaultPackage = pkgs.python3Packages.buildPythonPackage {
|
packages.basant = pkgs.python3Packages.buildPythonPackage {
|
||||||
# We should probably only call grab from main.py here
|
|
||||||
pname = "basant";
|
pname = "basant";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
version = "0.1";
|
version = "0.1";
|
||||||
propagatedBuildInputs = [ python-with-my-packages ];
|
propagatedBuildInputs = [ python-deps ];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
packages.site = pkgs.stdenv.mkDerivation {
|
packages.site = pkgs.stdenv.mkDerivation {
|
||||||
name = "anish-lakhwara-site";
|
name = "anish-lakhwara-site";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
buildInputs = [ pkgs.python3 ];
|
buildInputs = [ poonam.defaultPackage.${system} self.packages.${system}.basant ];
|
||||||
|
configurePhase = ''
|
||||||
|
cp -r ${poonam.defaultPackage.${system}}/public/ ./
|
||||||
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${self.defaultPackage.${system}}/bin/main.py
|
${self.packages.${system}.basant}/bin/main.py
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -R output/* $out/
|
cp -R output/* $out/
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
defaultPackage = self.packages.${system}.site;
|
||||||
#nixosModule = { options, lib, config, pkgs, ... }:
|
#nixosModule = { options, lib, config, pkgs, ... }:
|
||||||
# let
|
# let
|
||||||
# serverName = "anish.lakhwara.com";
|
# serverName = "anish.lakhwara.com";
|
||||||
|
|
Loading…
Reference in a new issue