Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.077 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; '"this': 0.03; 'chunk': 0.09; 'obsolete': 0.09; 'python': 0.11; 'bit': 0.19; 'python?': 0.22; 'exists': 0.24; 'skip:{ 20': 0.24; 'server.': 0.24; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'perl': 0.31; 'plain': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'choosing': 0.36; 'similar': 0.36; 'feed': 0.38; 'to:addr:python-list': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'new': 0.61; 'complete': 0.62; 'great': 0.65; 'afraid': 0.65; 'success,': 0.65; 'side': 0.67; 'route': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=aEG2Ug78yA1Yo1NhWlCQDzpwyDihl7Ppq9j1clzYQmg=; b=RBx5LuX0xmxYfIJhOtqvJx1jJwO3IUV62sUQdJ9hh62Tfdgr+jhU9P7Fzdt0wUdK1u CaQ0NCipb2emnewhJ/siHQh/d55mk27SjmdgpZYRuAFV72q6V3LVzbr/pce/0Ww68FR8 BvzHaVylXSCwB1wtpfZdjVOigBaMIFOCx2sBDqPftwABwFW12qG3anDCO9DBConXUfb/ AnjUqd39XIHhj6Tx0fPTvBJ7/HY9pwL0wfq7OGz6vyOFTlxD4CP/Ns3Bgph9SIUwm/MF H3fQEG/4WrFPs5EQ9DBHZtspFrG0+yz6UGP1doMRfQZatFY83K4B1D4VsGvSRVjFiu84 L0Sw== MIME-Version: 1.0 X-Received: by 10.112.51.240 with SMTP id n16mr10191575lbo.10.1375098068602; Mon, 29 Jul 2013 04:41:08 -0700 (PDT) Date: Mon, 29 Jul 2013 13:41:08 +0200 Subject: Generating HTML From: Morten Guldager To: python-list@python.org Content-Type: multipart/alternative; boundary=001a1133bb30e93b3704e2a4f7e9 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375098077 news.xs4all.nl 15963 [2001:888:2000:d::a6]:50849 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51433 --001a1133bb30e93b3704e2a4f7e9 Content-Type: text/plain; charset=ISO-8859-1 'Aloha Friends! Still a bit new to python I'm afraid of choosing an obsolete route when it comes to generate some HTML in a Flask based micro web server. I come from the Perl side where I have been using HTML::Element with great success, and now I would like to know if something similar exists for Python? I would like to construct the complete page as a plain python structure and then feed it to a function to get a chunk of HTML ready to send to the client. Something like: table_struct = ['table', ['tr', ['td', {class=>"red"}, "this is red"],['td', {class=>"blue"}, "this is not red"]]] html = struct2html(table_struct) Suggestions? -- /Morten %-) --001a1133bb30e93b3704e2a4f7e9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 'Aloha Friends!

Still a bit new to python I'm af= raid of choosing =A0an obsolete route when it comes to generate some HTML i= n a Flask based micro web server.

I come from the = Perl side where I have been using HTML::Element with great success, and now= I would like to know if something similar exists for Python?

I would like to construct the complete page as a plain = python structure and then feed it to a function to get a chunk of HTML read= y to send to the client.

Something like:
=A0 table_struct =3D ['table', ['tr', ['td= 9;, {class=3D>"red"}, "this is red"],['td', = {class=3D>"blue"}, "this is not red"]]]
<= div> =A0 html =3D struct2html(table_struct)

Suggestions= ?


--
/Morten %-)=20
--001a1133bb30e93b3704e2a4f7e9--