divinum-officium icon indicating copy to clipboard operation
divinum-officium copied to clipboard

Separate Logic from Display

Open edbrannin opened this issue 8 years ago • 11 comments

Would you be open to PRs that start to separate logic from display?

For example, instead of interleaved "Determine today's reading" and "print HTML for the reading", the result of this would be one function that determines what content should appear on the page, and another function that injects that content into an HTML file, probably with Template::Semantic or something similar.

(Long-term, I'd like to try making a more modern-styled version of this site, and slowly doing this would be the first step to having a JSON API.)

edbrannin avatar Nov 02 '16 21:11 edbrannin

Yes, please! The current implementation is extremely fragile, so I would suggest making very small, incremental changes. You might also be interested in the work on the calcalc branch that I'm determined to merge one day.

For regression testing, you might be interested in the scripts in regress directory.

gregordick avatar Nov 02 '16 22:11 gregordick

Is that branch actively developed? The last pushed commit is one year old.

osoftware avatar Nov 16 '16 20:11 osoftware

I haven't had time to work on it recently, but it hasn't been abandoned. The present difficulty is that it requires a change to the data-file format. I started doing it manually, but I can't keep up with the changes on master; when I get time, the next thing I'll do is to automate the change to the files so that I can do it atomically. Pull requests are always welcome, but if there are people interested in working on that branch, it might be helpful if I were to write some documentation first.

gregordick avatar Nov 16 '16 23:11 gregordick

Do you think it would be a better idea to do a change like this against master or calcalc?

(Thinking mainly of merge issues own the line)

edbrannin avatar Nov 17 '16 00:11 edbrannin

master would be better. calcalc doesn't really touch the presentation logic (such as it is!), so I would expect minimal merge pain.

gregordick avatar Nov 17 '16 07:11 gregordick

I would gladly help with creating a converter to the new data format.

osoftware avatar Nov 19 '16 12:11 osoftware

Thank you: that would be very welcome. If you're still interested (sorry for my delay...) I can document the required transformation. The essence of the change is that separate offices on a single day need to live in separate files.

gregordick avatar Dec 15 '16 22:12 gregordick

Still interested.

osoftware avatar Dec 16 '16 15:12 osoftware

bump

osoftware avatar May 13 '17 13:05 osoftware

@osoftware I tried to contact with @gregordick, with no success. I can suggest reading this wiki page: link. I don't know if it's still valid, unfortunately. I'm sorry I can't help more. I don't want you to remain without any answer.

DLakomy avatar Jun 23 '17 11:06 DLakomy

I think that adding well-thought-out class names to the HTML output (in the spirit of semantic HTML) could go a long way towards making the output more machine-friendly. We could then bolt on an adapter to convert the output to any format we like.

ewcole avatar Aug 13 '20 12:08 ewcole