A chronological documentation test project, nothing serious, really!

12 Jun 2009 Replace specific HTML tags using sed and regular expression

In this post I would like to replace all <embed> HTML tags in a HTML file with a <strong> tag.

# sed -e 's/<embed[^>]*>/<strong>/g' filename.html > newfile.html

And if you would like to remove the <embed> tag altogether

# sed -e 's/<embed[^>]*>//g' filename.html > newfile.html

To remove all HTML tags in a file

# sed -e 's/<[^>]*>//g' filename.html > newfile.html

The result file newfile.html is now without any < HTML tags >.

Tags: , , ,

Posted by

16 Mar 2009 Valid Flash

I’ve gotten tired of my Flashpresentation movies not being valid HTML. After some research and a tip from a friend of mine I found this solution to the problem.

<object type="application/x-shockwave-flash" data="images/banner.swf" width="288" height="128">
<param name="movie" value="images/banner.swf" />
<img src="banner.gif" width="288" height="128" alt="banner" />

It works great and shows a image file if Flash support isn’t available.


Tags: ,

Posted by

22 Nov 2007 Create a year calendar for 2008 using pcal

I wanted to make a whole year calendar and found pcal, a command line tool.

pcal -F 1 -E -B -O -p -w -o 2008

  • -F starting weekday; 1 is Monday
  • -E specifies European formatted dates
  • -B leave unused date boxes blank, default is grey
  • -O selected days will be printed as outlined characters
  • -p output in portrait mode
  • -o specifies an output file in PostScript format.
  • 2008 is the year I want to print the calendar. PCAL’s default option is to produce the calendar for the current year.

It is also possible to generate a calendar as HTML table using the -H switch.

This program can be installed in Debian/Ubuntu
apt-get install pcal

Tags: , ,

Posted by

23 Oct 2007 Premailer: preflight for HTML e-mail

Premailer is a script accessible from the web that turns external CSS webpage into inline, improving the rendering of HTML e-mail.

This makes it possible to make a webpage and then run it througt this script to make a HTML e-mail.

Tags: , ,

Posted by

05 Oct 2007 Left and Right align text on the same line

It can sometimes be useful to have some text be aligned to the left and some text be aligned to the right on the same line, eg in a footer.

Here is how this can be done in HTML:

<div id="footer">
  <p class="leftalign">Text on the left.</p>
  <p class="rightalign">Text on the right.</p>

If you were to then give your CSS classes leftalign and rightalign values of text-align: left; and text-align: right; respectively, you would get close to your desired result, but your right-aligned text would be bumped down one line because of the new paragraph. Instead, just float your paragraphs:

.leftalign {
float: left;
.rightalign {
float: right;

Then just remember to clear your float:

<div style="clear: both;"></div>

Tags: ,

Posted by