Loading ...
Sorry, an error occurred while loading the content.

Re: make vim quiet as filter

Expand Messages
  • Marc Chantreux
    ... So let see all the lines : 1. Makefile: # sources is a repository for my sources SRCS=$(wildcard sources/*) # i store temporary html chunks into
    Message 1 of 3 , Mar 31 10:55 AM
    • 0 Attachment
      >
      >Thanks for providing these, they hint me at studying some
      >details a bi more deeply. :-)
      >
      >

      So let see all the lines :
      1. Makefile:
      # sources is a repository for my sources
      SRCS=$(wildcard sources/*)


      # i store temporary html chunks into htmlchunks/
      # every source has its chunk

      CHUNKDIR=htmlchunks
      HTMLCHUNKS=$(addprefix $(CHUNKDIR)/,$(notdir $(SRCS)))

      all: $(HTMLCHUNKS)

      $(HTMLCHUNKS) : source2chunks.vim

      # do not remove partfiles
      # its timestamp is important for make

      source2chunks.vim: $(SRCS)
      @echo generating blocs $?
      @./vimsyn2html.sh $(CHUNKDIR) $? > $@
      @echo still alive
      vi --noplugin -fNnu $@ 2>/dev/null

      clean:
      rm *part source2chunks.vim

      2. vimsyn2html.sh# generate a vim script to create html chunks that that
      are syn highlight
      # for sourcecode

      dest=$1
      shift


      # initialize vim
      # set background=light can be usefull to see default syn
      # set nocompatible if not -N

      cat << START
      syntax on
      let html_use_css='yes'
      START

      # for every source code ....

      for src in $@; do

      # open and htmlize it !
      echo edit $src
      echo source $VIMRUNTIME/syntax/2html.vim

      # at the end of 2html, the current buffer is the html page
      # the code itself is between a ^<pre> and a ^</pre>
      # we just write it in another file :-)

      echo '/^<pre>/+1,/<\/pre>/-1w '$dest/${src##*/}

      # then we delete the code and html buffers ( without quit vim)
      echo 'bd!'
      echo 'bd!'
      done

      # it will be back ....
      echo 'wqa!'

      That's all ... note that vim is called only one time for all the files,
      i think this
      can speed up file generation.

      >
      >I do not know if the following fragment of code is any useful to you,
      >I blindly extract it from a bigger script. It produces the body of an
      >HTML page batch-produced by Vim, in the context of highlighting source
      >code on my Web site.
      >
      >
      no help here ... just tips to speed more with -fn

      >This is Python however, not m4. Just my preference of the day, I've
      >nothing against m4 :-). (I maintained René Seindal's GNU m4 for many
      >years, this was one of the nicest source code I had to play with.)
      >
      >
      >
      I've produced m4 example because it's a well known tool but in fact, i'm
      using template-toolkit.
      http://template-toolkit.org It's an amazing tool i use every day !

      regards
      mc
    Your message has been successfully submitted and would be delivered to recipients shortly.