remove references to relative paths

main
Anish Lakhwara 2022-04-03 22:57:45 +10:00
parent 1ace609d68
commit 155513a8bd
6 changed files with 18 additions and 14 deletions

2
.envrc
View File

@ -1 +1 @@
use nix
use flake

2
.gitignore vendored
View File

@ -12,3 +12,5 @@ censor.py
raw/*
result/*
./result/*
result
.envrc

View File

@ -5,8 +5,8 @@
# censor - burn all mentions of this word wherever it appears in Kitaab
# filter - leave names in tact but do not link to relevant documents
# create - list in an index file for website
from shared import TagHelper, config, helpers
import shared.censor
from basant.shared import TagHelper, config, helpers
from basant.shared.censor import privateList
from os import listdir, mkdir, path, remove
import shutil
from . import convert
@ -14,7 +14,7 @@ import os
# TODO: generalize based on headings(?) in index.wiki
censor = shared.censor.privateList
censor = privateList
# TODO put this in config too...
filter = ["dream", "gratitude", "review", "jrnl", "work", "job", "debt",
"people", "priv", "threatdefence", "info"]
@ -35,8 +35,8 @@ def filterFiles(AllFileList):
def copyFiles(fileList):
baseFilePath = '/home/anish/vimwiki/'
outputFilePath = '../raw/' # TODO relative path....
baseFilePath = config.files_folder
outputFilePath = outputBasePath
try:
mkdir(outputFilePath)
except FileExistsError:

View File

@ -1,12 +1,13 @@
from ctags import CTags, TagEntry
import sys
from os import listdir, path
# from shared.censor import privateList
from . import config
from .censor import privateList
def getAllFiles():
files = [f for f in listdir(
'/home/anish/vimwiki') if '.wiki' in f and path.isfile('/home/anish/vimwiki/' + f)]
config.files_folder) if '.wiki' in f and path.isfile(config.files_folder + f)]
files = set(files)
return files
@ -25,7 +26,7 @@ def untaggedFiles(AllFileList=getAllFiles()):
return set.difference(AllFileList, doNotTakeFiles)
def loadTagFile(path='/home/anish/vimwiki/.vimwiki_tags'):
def loadTagFile(path=config.files_folder + '.vimwiki_tags'):
# Available file information keys:
# opened - was the tag file successfully opened?
# error_number - errno value when 'opened' is false

View File

@ -3,7 +3,7 @@ nav_tags = ['dev', 'way', 'recipe', 'ops', 'blog',
'rock', 'phil', 'story', 'blog', 'untagged']
relative_build_url = ""
absolute_build_url = "https://anish.lakhwara.com/"
files_folder = '' # TODO
files_folder = '/home/anish/vimwiki'
build_folder = "output/"
assets_folder = "assets/"
medias_folder = "media/"

View File

@ -5,6 +5,7 @@ from ctags import CTags, TagEntry
import sys
from icecream import ic
import shutil
from . import config
def loadTagFile(path='.vimwiki_tags'):
@ -55,7 +56,7 @@ def loopThrough(tagFile):
def fixErrors(errors):
''' Replaces :: with :, which seems to be the error for many of the tags '''
fileBase = '/home/anish/vimwiki/'
fileBase = config.files_folder
for v in errors:
print("Fixing {}...".format(v))
fileName = fileBase + getFileName(v)
@ -73,7 +74,7 @@ def fixErrors(errors):
def printErrors(errors):
fileBase = '/home/anish/vimwiki/'
fileBase = config.files_folder
for v in errors:
fileName = fileBase + getFileName(v)
print("Reading {}...".format(v))
@ -87,8 +88,8 @@ def getFileName(f):
def getBackupFiles(errors):
fileBase = '/home/anish/vimwiki/'
backupBase = '/home/anish/vimwiki/jrnl/'
fileBase = config.files_folder
backupBase = config.files_folder + '/jrnl/'
for files in errors.values():
for f in files:
f = getFileName(f)