On Mon, 4 Jan 2016 20:05:05 +0100, Sönke Ludwig wrote:

Am 04.01.2016 um 19:55 schrieb Uiy Uiy:

I have a nifty idea for you guys to make life easier and more fun!

Write a utility that

  1. Converts Deit files to html and stores a placeholder for the D code blocks in a meta-comment. The D code blocks are stored in a side file with proper indexing.

  2. Converts the modified html file back to to Deit by replacing the meta-commend blocks with their corresponding code.

This way, one can edit deit files in any old html editor without having to write an editor/parser.

It seems like it would be a day or two worth of work by an experienced programmer?

That would certainly be doable, but in that case I'd rather avoid the
intermediate steps and take a look at one of the plain text based
template systems: http://code.dlang.org/search?q=template

They mostly use or can be made to use a syntax that is compatible with
HTML. Some of them have explicit vibe.d integration, but generally all
of them should work.

I'm not sure I follow, the goal is to be able to use the common visual html editors that exist(leverage preexisting power). This is the downside I am having with vibe.d right now. I really like the idea of Deit, but I don't want to have to create visual pages using a non-visual methods(text editor).

Since none of them, AFAIK, will accept deit files, deit files can't be used directly.

I believe there is jade2html program floating around?

http://stackoverflow.com/questions/14426436/jade-to-html-converter

If so, would it not be possible to simply encode all D code in the Deit file as meta comments then convert to html through jade2html(since you say deit is essentially jade)? This would allow one to edit the html file, then easily convert back using html2jade and converting the meta comment.

e.g.,

doctype html
html

head
	title <!-- !dcode #{id} !dcode --> - WebChat
	style.
		textarea, input { width: 100%; }
		textarea { resize: vertical; }
body
	h1 Room '<!-- !dcode #{id} !dcode -->'

	textarea#history(rows=20, readonly=true)
	form(action="room", method="POST")
		input(type="hidden", name="id", value=id)
		input(type="hidden", name="name", value=name)
		input#inputLine(type="text", name="message", autofocus=true)


To html(The #{id} tags get removed by the conversion, for some reason, I added them back. Used http://jade-lang.com/demo/)

<!DOCTYPE html>
<html>
<head>

<title><!-- !dcode #{id} !dcode --> - WebChat</title>
<style>
  textarea, input { width: 100%; }
  textarea { resize: vertical; }
</style>

</head>
<body>

<h1>Room '<!-- !dcode #{id} !dcode -->'</h1>
<textarea id="history" rows="20" readonly></textarea>
<form action="room" method="POST">
  <input type="hidden" name="id">
  <input type="hidden" name="name" value="Bob">
  <input id="inputLine" type="text" name="message" autofocus>
</form>

</body>
</html>

Then simply convert back to jade and remove <!-- !dcode and !docde -->.

This is a lot of work to do manually but seems like it could easily be automated by leveraging the pre-existing deit compiler.