views:

28

answers:

2

I have a pet project where I build a text-to-HTML translator. I keep the content and the converted output in a directory tree, mirroring the structure via the filesystem hierachy. Chapters go into directories and subchapters go into subdirectories. I get the chapter headings from the directory and file names. I want to keep all data in files, no database or so.

Kind of a keep-it-simple approach, no need to deal with meta-data.

All works well, except for the sort order of the directories and files to be included. I need sort of an arbitrary key for sorting directories and files in my application. That would determine the order the content goes into the output.

I have two solutions, both not really good:

1) Prepend directories and files with a sort key (e.g. "01_") and strip that in the output files in order not to pollute the output file names. That works badly for directories since they must keep the key data in order not to break the directory structure. That ends with an ugly "01_Introduction"...

2) put an config file into each directory with information on how to sort the directory content, to be used from my applications. That is error-prone and breaks the keep-it-simple no meta-data approach.

Do you have an idea? What would you do?

A: 

If your goal is to effectively avoid metadata, then I'd go with some variation of option 1.

inkedmn
A: 

I really do not find 01_Introduction to be ugly., at all.

Vinko Vrsalovic