2010-02-10

Add Code to Blogger

A nice tutorial paste code (xml, java, cshape...) with highlighted syntax in bloger. See the reference.
XML


<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath"/>
</target>

CPP

ElementType FrontAndDequeue(Queue Q) {
ElementType X = 0;
if (IsEmpty(Q)) {
Error("FrontAndDequeue Error: The queue is empty.");
} else {
Q->Size--;
X = Q->Array[Q->Front];
Q->Front = Succ(Q->Front, Q);
}
return X;
}


SHELL

ls ./include/*.h | while read file; do
echo ${file} ...
( cat header.in; cat ${file} ) > ${file}.new
sed "s/\[filename\]/$file/g" ${file}.new
rm ${file}
mv ${file}.new ${file}
done

No comments:

Post a Comment