Write it with the help of a DCG as a clean grammar.
Here is a start. More details, here.
:- use_module(library(double_quotes)).
:- set_prolog_flag(double_quotes,chars).
newline --> "\n".
pre --> "# ".
post --> " #".
button -->
pre,
"button",
post.
Now you can query it on the toplevel:
?- phrase(button, Xs).
Xs = "# button #".
And you can print it out directly:
?- phrase(button, Xs), atom_chars(A, Xs), write(A).