logo       

Re: twiki format to docbook: msg#00074

Subject: Re: twiki format to docbook
--- Joshua Daniel Franklin <joshuadfranklin@xxxxxxxxx> wrote:
> > --- Karsten Wade <kwade redhat com> wrote:
> > > You just need to conform to the DocBook standards.  If you parse your
> > > document against the DTD, then indenting should be consistent.  I'm sure
> > > there are keybindings and other DocBook tools for Vi.  Perhaps someone
> > > who prefers to use Vi could make a tutorial on using Vi for DocBook with
> > > the Fedora docs project toolchain. :)
> 
> > I write DocBook with Vim, so I could probaby come up with something.
> 
> Sorry for the delay, this was finals week but now I'm done.
> This is a pretty basic guide, but it's enough to get started and has
> some pointers to more information. I just added a chapter after the
> emacs ones. I can work on fleshing it out with any suggestions.

Sorry, I attached the wrong xml file for the new chapter. Here is the
correct one which follows the naming convention.

__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
<!-- $Id$ -->

  <chapter id="ch-vim">
   <title>VIM and DocBook</title>
    
    <indexterm>
      <primary>VIM</primary>
    </indexterm>
    
    <para>
      VIM has many features to help you write XML content such as DocBook,
      including syntax highlighting and customizable key bindings.
      Additionally, one can easily use external programs from VIM for features
      such as spell-checking. 
      This chapter assumes you already know generally how to use VIM; if you
      want to learn how, try the <command>vimtutor</command> or by typing
      <userinput>:help tutor</userinput> from inside VIM.
    </para>
    
    <sect1 id="s1-vimrc-file">
      <title>Setting Up Your <filename>.vimrc</filename> File</title>

      <indexterm>
        <primary>VIM</primary>
        <secondary>configuration file</secondary>
      </indexterm>

      <para>
        Below is a short sample <filename>.vimrc</filename> file that turns on
        some VIM features useful for editing SGML or XML content such as 
        DocBook:
<screen>
<computeroutput>
" Turn off vi compatibility settings like limited undo
set nocompatible
" Syntax highlighting based on file extension
syntax on
" Automatically insert newlines after 80 characters
set textwidth=80
" Automatically indent
set autoindent
" Match SGML tags with %
source $VIMRUNTIME/macros/matchit.vim
</computeroutput>
</screen>
      </para>
      <note>
      <para>
      Some of these features require the <filename>vim-enhanced</filename>
      package to be installed.  If you are using or the
      <filename>vim-minimal</filename> package, or if you are using an older
      version of VIM, you may not have the
      <filename>$VIMRUNTIME/macros/matchit.vim</filename> file. You can still
      download <ulink
      url="http://vim.org/scripts/script.php?script_id=39";>matchit.zip from
      Vim.org</ulink> and load it separately.
      </para>
      </note>
    </sect1>

    <sect1 id="s1-vim-keymapping">
      <title>Keymapping with VIM</title>
      
      <para>
      VIM can speed up your DocBook creation by mapping frequently typed tags
      (or any words or phrases) onto short key combinations.  By default, the
      keymap leader is the backslash (<literal>\</literal>), but it can be
      redefined with a command like <userinput>let mapleader =
      ","</userinput>. There are two ways to use the following example;
      you can put it directly in your <filename>.vimrc</filename>, or you
      can save it in a separate file and load it with a 
      <userinput>source</userinput> command in your
      <filename>.vimrc</filename>.
      <screen>
      <programlisting>
      <![CDATA[
let mapleader = ","

" skip ahead to after next tag without leaving insert mode
imap <leader>e <esc>/><cr>:nohlsearch<cr>a

" common tags that start a new text block
imap<leader>pa <para><cr></para><esc>O
imap<leader>s1 <sect1 id=""><cr><para><esc>jo</sect1><esc>O
imap<leader>pl <programlisting><cr></programlisting><esc>O<esc>0i
imap<leader>cp <computeroutput></computeroutput><esc>O<esc>0i

" common tags that are placed inline
" use <esc>F>a
imap<leader>en <envar></envar><esc>F>a
imap<leader>fi <filename></filename><esc>F>a
imap<leader>lt <literal></literal><esc>F>a
imap<leader>re <replaceable></replaceable><esc>F>a
imap<leader>ui <userinput></userinput><esc>F>a
imap<leader>ul <ulink url=""></ulink><esc>F>a
imap<leader>si <systemitem></systemitem><esc>F>a
imap<leader>us <systemitem class="username"></systemitem><esc>F>a
imap<leader>sy <systemitem class="systemname"></systemitem><esc>F>a
imap<leader>cm <command></command><esc>F>a                                  
" entities
imap <leader>> &gt;
imap <leader>< &lt;
]]>
      </programlisting>
      </screen>
      </para>
      <para>
      Unfortunately, there is not currently a complete macro set for all
      DocBook commands, so you will need to define them yourself or customize
      the definitions in the examples from <xref
      linkend="s1-vim-additional-resources"></xref>.
      </para>
    </sect1>

    <sect1 id="s1-vim-additional-resources">
      <title>Additional VIM Resources</title>

      <para>
      Additional information about VIM may be found from:
      </para>

      <itemizedlist>
        <listitem>
          <para><ulink url=
          "http://newbiedoc.sourceforge.net/text_editing/vim.html#JESSE-SGMLRC";>
          Example sgml-vimrc</ulink> from the <citetitle>Beginner's guide to
          Vi Improved (VIM)</citetitle> 
          </para>
        </listitem>
        <listitem> 
          <para>The <ulink url="http://tnerual.eriogerg.free.fr/vim.html";>VIM 
          Quick Reference Card</ulink> 
          </para>
        </listitem>
        <listitem>
          <para>
          <ulink url="http://www.pinkjuice.com/howto/vimxml/";>Vim as XML
          Editor</ulink>
          </para>
        </listitem>
        <listitem>
          <para>
          The <citetitle>VIM REFERENCE MANUAL</citetitle>, which comes with
          the <filename>vim-common</filename> package &mdash;
          
<filename>/usr/share/vim/<replaceable>&lt;version&gt;</replaceable>/doc/intro.txt</filename>
          or type <userinput>:help intro</userinput> from within VIM
          </para>
        </listitem>
        
      </itemizedlist>

    </sect1>
  </chapter>
-- 
fedora-docs-list mailing list
fedora-docs-list@xxxxxxxxxx
To unsubscribe: 
http://www.redhat.com/mailman/listinfo/fedora-docs-list
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe