I built a nice html templater!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derick van Niekerk

    I built a nice html templater!

    Ok - so it's not really an awesome achievement and only handles basic
    templating needs (no loops and other programming constructs) but maybe
    someone will find it useful.

    It replaces any xml block where the id attribute is specified with
    contents provided - a description is provided in the comments.

    Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.


    My knowledge of python is limited and I would like someone to help me
    with wrapping a command line interface around this function. I need
    switches to specify input file, output file, key/value pairs for
    variable substitution and key/value pairs for substituting blocks with
    file contents (there is some clarification in the comments)

    Any help would be appreciated.

    Of course - feel free to use the code as you wish when you wish if you
    wish :)

    -d-
  • Tim Roberts

    #2
    Re: I built a nice html templater!

    Derick van Niekerk <derickvn@gmail .comwrote:
    >
    >Ok - so it's not really an awesome achievement and only handles basic
    >templating needs (no loops and other programming constructs) but maybe
    >someone will find it useful.
    <sarcasm>
    Sure, that's what the world needed. We didn't have enough Python HTML
    templaters already.
    </sarcasm>

    Did you take even 3 minutes to look for a solution before you wrote this?
    There is even a nearly identical solution in the Python cookbook.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    • Steve Holden

      #3
      Re: I built a nice html templater!

      Tim Roberts wrote:
      Derick van Niekerk <derickvn@gmail .comwrote:
      >Ok - so it's not really an awesome achievement and only handles basic
      >templating needs (no loops and other programming constructs) but maybe
      >someone will find it useful.
      >
      <sarcasm>
      Sure, that's what the world needed. We didn't have enough Python HTML
      templaters already.
      </sarcasm>
      >
      Did you take even 3 minutes to look for a solution before you wrote this?
      There is even a nearly identical solution in the Python cookbook.
      While I agree it was a little naive to expect a huge amount of interest
      I think there's educational value in building a templating system of
      your own. Sarcasm id the lowest form of wit, and there's no real need
      for it here. You'd have been better saving your ire for someone who
      really deserves it. Sadly there are plenty around.

      regards
      Steve
      --
      Steve Holden +1 571 484 6266 +1 800 494 3119
      Holden Web LLC http://www.holdenweb.com/

      Comment

      • Eric S. Johansson

        #4
        Re: I built a nice html templater!

        Steve Holden wrote:
        Tim Roberts wrote:
        >Derick van Niekerk <derickvn@gmail .comwrote:
        >>Ok - so it's not really an awesome achievement and only handles basic
        >>templating needs (no loops and other programming constructs) but maybe
        >>someone will find it useful.
        ><sarcasm>
        >Sure, that's what the world needed. We didn't have enough Python HTML
        >templaters already.
        ></sarcasm>
        >>
        >Did you take even 3 minutes to look for a solution before you wrote this?
        >There is even a nearly identical solution in the Python cookbook.
        >
        While I agree it was a little naive to expect a huge amount of interest
        I think there's educational value in building a templating system of
        your own. Sarcasm id the lowest form of wit, and there's no real need
        for it here. You'd have been better saving your ire for someone who
        really deserves it. Sadly there are plenty around.
        my replication of work was motivated by a very different need. I built a web
        framework that is friendly to speech recognition users. It uses plain English
        words and very little special punctuation. the internal CGI environment is also
        very simple in case you have a memory deficit and need to refresh your memory on
        the functionality between uses. Almost every HTML template system, and web
        framework I've seen look like they are designed to exclude disabled users.
        Special punctuation, special spacing rules, non-English character sequences,
        complex APIs, and lots of APIs say to the world "no disabled need apply".

        Before you protest and say that disabled users are a special case, remember that
        almost everyone becomes disabled as a result of aging or accident. a simple
        broken wrist or arm could keep you from doing your job. arthritis and other
        joint disorders will make keyboards something you cannot stand the touch. you
        will not escape needing some form of accessibility tools if you decide to keep
        using computers.

        Now you're faced with a choice. Do you want to design and build things that you
        will not be able to use at some point or do you want to build systems that can
        be used by you now, and you in the future. let me play from personal
        experience, it's far easier to build accessible systems before you need them
        than after.

        Comment

        • Carl Banks

          #5
          Re: I built a nice html templater!

          On Oct 2, 3:18 am, Tim Roberts <t...@probo.com wrote:
          Derick van Niekerk <deric...@gmail .comwrote:
          Ok - so it's not really an awesome achievement and only handles basic
          templating needs (no loops and other programming constructs) but maybe
          someone will find it useful.
          >
          <sarcasm>
          Sure, that's what the world needed.  We didn't have enough Python HTML
          templaters already.
          </sarcasm>
          >
          Did you take even 3 minutes to look for a solution before you wrote this?
          There is even a nearly identical solution in the Python cookbook.
          He probably wrote his own faster than it would have taken him to
          search for existing systems, and as an added bonus wouldn't have had
          to work around all those things that are almost but not quite the way
          he wanted.

          Cut him some slack.


          Carl Banks

          Comment

          Working...