/    Sign up×
Community /Pin to ProfileBookmark

Document generation?

I’m wondering if there is a program that will take a marked file and generate another file from it?

I mean, in almost all websites, there is common code. Menus, headers, footers, etc. But if you want to change your menu, you need to change it in [i]every single file[/i]. That’s where a generator would come in. Maybe you could pass into a generator this file:

[code]
#menu.html
Content
#footer.html
[/code]

And it will generate from that an html file which contains the text of “menu.txt”, then the text “Content”, then the text of “footer.html”.

Does anyone know of a program that does this?

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@The_Little_GuyFeb 21.2006 — are you talking about an external style sheet?

Where you would put everything that normally would be between the <style> and </style> tags, and by changing one file it would change all of the files look and feel?
Copy linkTweet thisAlerts:
@klanga2049authorFeb 21.2006 — I did it.

<i>
</i>!out/index.html
#include/pre.html
#src/index.html
#include/post.html
!end

!out/about.html
#include/pre.html
#src/about.html
#include/post.html
!end

!out/projects.html
#include/pre.html
#src/projects.html
#include/post.html
!end

!out/projects/ms.html
#include/pre.html
#src/projects/ms.html
#include/post.html
!end


I wrote a script that takes that file and from it writes other files.

The first line "!out/index.html" says "OK, start writing a file named "index.html" in the directory "out".

The second line, "#include/pre.html", says "Write the contents of the file 'pre.html' of the folder 'include' into the file 'index.html'".

And "!end" means "OK, stop writing to the file."

Now, when I change "pre.html", all I have to do is run the script and all of the HTML files will have the change.
Copy linkTweet thisAlerts:
@welshFeb 21.2006 — im sooo lost.
Copy linkTweet thisAlerts:
@klanga2049authorFeb 21.2006 — Is it really that confusing? I'll try to explain it better.

On my site, all of the HTML files start out the same way:

<i>
</i>&lt;!--
Copyright (C) 2006 King Hajj (k i n g h a j j @ g m a i l . c o m)
--&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href="/css/kh.css" rel="stylesheet" type="text/css" media="screen" /&gt;
&lt;link href="/css/sidebar.css" rel="stylesheet" type="text/css" media="screen" /&gt;
&lt;link href="/css/content.css" rel="stylesheet" type="text/css" media="screen" /&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
&lt;title&gt;KingHajj.co.nr ::&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="page"&gt;
&lt;div id="title"&gt;
&lt;h1&gt;KingHajj.co.nr ::&lt;/h1&gt;
&lt;h2&gt;The Cool Place to Be!&lt;/h2&gt;
&lt;/div&gt;

&lt;div id="sidebar"&gt;
&lt;h1&gt;Menu&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/about.html"&gt;About Me&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/projects.html"&gt;Projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kinghajj.blogspot.com"&gt;Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Links&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.lingua-franca-nova.net"&gt;LFN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.slashdot.org"&gt;Slashdot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.wikipedia.org"&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.osdever.net/"&gt;Bona Fide OSDev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Ads&lt;/h1&gt;
&lt;a href="http://www.co.nr"&gt;
&lt;img src="http://kinghajj.home.comcast.net/anima.gif" alt="Free Domains!" /&gt;
&lt;/a&gt;
&lt;/div&gt;

&lt;div id="content"&gt;


But if I want to change this, I would need to change each file. With my script, all I need to do is change "pre.html" and then run it. The script will automatically make the changes to all files.
Copy linkTweet thisAlerts:
@Orc_ScorcherFeb 21.2006 — I don't want to ruin your party but the rest of the world lets the server do this automatically on each request, with tools ranging from quite simple like Server Side Includes to feature overkill like ASP.NET.
Copy linkTweet thisAlerts:
@klanga2049authorFeb 21.2006 — I don't have server-side scripting. I use my ISP's crappy hosting service they give for free when you get a cable modem. Besides, why put the burden on the server?
×

Success!

Help @klanga2049 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...