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/* raw/*
result/* result/*
./result/* ./result/*
result
.envrc

View File

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

View File

@ -1,12 +1,13 @@
from ctags import CTags, TagEntry from ctags import CTags, TagEntry
import sys import sys
from os import listdir, path from os import listdir, path
# from shared.censor import privateList from . import config
from .censor import privateList
def getAllFiles(): def getAllFiles():
files = [f for f in listdir( 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) files = set(files)
return files return files
@ -25,7 +26,7 @@ def untaggedFiles(AllFileList=getAllFiles()):
return set.difference(AllFileList, doNotTakeFiles) 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: # 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

View File

@ -3,7 +3,7 @@ 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 = '' # TODO files_folder = '/home/anish/vimwiki'
build_folder = "output/" build_folder = "output/"
assets_folder = "assets/" assets_folder = "assets/"
medias_folder = "media/" medias_folder = "media/"

View File

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