Skip to content

jbampton/ruby-eclipse-cheatsheets-to-dita

Repository files navigation

Eclipse cheat sheets (XML) to DITA with Ruby, XSL, Nokogiri

The Ruby Story

This project uses Ruby and tries to be and easy to use tutorial on all things Ruby.

Ruby dates back to the 1990's and was first created by a Japanese man named Yukihiro "Matz" Matsumoto.

Hey come and check out the Ruby in 4 seconds video.

Ruby is very powerful, is growing in popularity and is currently ranked 11th on the TIOBE Index.

There are two types of Ruby files: .rb, .rbw

Matz made run Ruby fun and easy to learn, so don't be scared and first check out a short Ruby YouTube video I created.

Ruby in 29 seconds

Project Background

I worked on the open source Java based project Debrief the leading maritime analysis tool which is also on GitHub at https://github.com/debrief/debrief.

The Debrief project used Apache Ant, SaxonHE, XSLT 2.0 and XPath and ran inside Eclipse therefore requiring Java. The Debrief document publishing project has been extracted into its own self contained GitHub repository at https://github.com/jbampton/eclipse-cheatsheets-to-dita-to-pdf.

From Java, XSLT 2.0 with Saxon to Ruby, XSLT 1.0 with the Nokogiri Ruby gem

Using Ruby on this project allows use to harness the power of RubyGems particularly the Nokogiri gem along with XSLT 1.0 / XPath 1.0 to create the DITA XML files. Using Ruby eliminates the need to use Eclipse and Apache Ant and can be run standalone from the command line as long as you have Ruby installed. This project is only one step from the publishing pipeline that was built on Debrief project which produced a PDF as its final output.

The Ruby file: default.rb builds the output parent Ditamap map.ditamap (output/map.ditamap) and the 4 sub DITA tasks in the output/dita folder.

DITA Background

Darwin Information Typing Architecture (DITA) is an XML data model for authoring and using the DITA Open Toolkit (DITA-OT) you can publish those ideas.

The DITA standard is maintained by the OASIS DITA Technical Committee.

The Project

The Ruby code in default.rb has some XSL code embedded, as well as some XML markup in a interpolated string literal syntax.

The Eclipse cheat sheets test data folder - cheatsheets-xml-test-data is best viewed inside Eclipse, and is used as input when default.rb runs.

Short online courses

If you are still to afraid to dive in and try Ruby, how about some easy free web based interactive courses on Ruby and technology in general:

And then come train in the REAL DOJO and reach your highest potential, become faster, stronger and more powerful....JEDI MASTER LEVEL.....??!?!!

IDE Choice

You will by now want to write your own homegrown Ruby Code so some programmers use advanced integrated development environments (IDE's) that offer colored code markup or auto completion as you type.

Installation

As we are using Ruby you will need to see if it's installed on your system.

So now that you are the Chuck Norris of all things Ruby, open a terminal and type:

ruby -v

For further information on your local Ruby environment type:

ruby --help

ruby -v

ruby --help

man pages contain a lot of information about programs.

man ruby

man ruby

You can use the up and down arrows to navigate through the man page. Press q to quit

Ruby also ships with ri a tool used to display information about Ruby Classes, modules and methods from your terminal

A lot of people don't know ri exists and use google search instead.

man ri

man ri

Ruby also ships with a fantastic tool called IRB. IRB is the interactive Ruby shell where you can test out your Ruby commands inside a terminal. I made short video on IRB on Youtube to the magical sounds of Fon Leman.

man irb

man irb

And to use IRB type:

irb

irb

You type 'exit' to stop using irb and return to the standard terminal.

You can add 'tab' completion to irb by creating a .irbrc file

You can use the nano editor to create this by entering:

nano .irbrc

Then entering the next line:

require 'irb/completion'

This program uses the Nokogiri gem so you must install it by running:

gem install nokogiri

gem install nokogiri

For more information on the gem command:

gem -h

gem -h

I recommend running:

gem list --local

that shows which gems are currently installed on your system.

gem list --local

To see in further detail which gems are installed bring up a locally served web page at http://localhost:8808/ by typing:

gem server

gem server

gem server localhost

I used RubyMine and OS X for development. RubyMine is an integrated development environment (IDE) for Ruby and Rails projects and has Git functionality built in.

RubyMine is a very advanced code editor that is a commercial product from JetBrains. I also like PyCharm and IntelliJ from JetBrains.

Eclipse is a more general purpose IDE written mainly in Java.

Resources

Nokogiri - http://www.nokogiri.org/

JetBrains RubyMine - https://www.jetbrains.com/ruby/

Eclipse - https://eclipse.org/

Eclipse cheat sheets - http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-cheatsheets.htm

DITA - https://en.wikipedia.org/wiki/Darwin_Information_Typing_Architecture

XSLT FAQ. Docbook FAQ. Braille. - http://www.dpawson.co.uk/

W3C - The Extensible Stylesheet Language Family (XSL) - http://www.w3.org/Style/XSL/

The Organization for the Advancement of Structured Information Standards (OASIS) - https://en.wikipedia.org/wiki/OASIS_(organization)

Codecademy - Learn the Command Line - https://www.codecademy.com/courses/learn-the-command-line

Codecademy - Learn Ruby - https://www.codecademy.com/learn/ruby

CodeSchool - Got 15 minutes and want to learn Git? https://try.github.io/levels/1/challenges/1

CodeSchool Try Ruby - https://www.codeschool.com/courses/try-ruby

Ruby regular expression editor - http://rubular.com/

JetBrains Intellij - https://www.jetbrains.com/idea/

JetBrains PyCharm - https://www.jetbrains.com/pycharm/

Essential programmer training - http://www.codewars.com/

Help and documentation for the Ruby programming language - http://ruby-doc.org/

Ruby Programming Language - https://www.ruby-lang.org/en/

The Ruby Toolbox - https://www.ruby-toolbox.com/

Homebrew - The missing package manager for OS X - http://brew.sh/

Install Homebrew formulas - http://brewformulas.org/

Oracle Virtualbox - https://www.virtualbox.org/

RubyInstaller for Windows - http://rubyinstaller.org/

Ruby Version Manager (RVM) - https://rvm.io/

Installing Ruby - https://www.ruby-lang.org/en/documentation/installation/

Ruby success stories - https://www.ruby-lang.org/en/documentation/success-stories/

Ruby Motion success stories - http://www.rubymotion.com/references/success-stories/

The Top Ruby Jobs - https://toprubyjobs.com/

Australian companies using Rails - https://github.com/rails-oceania/roro/wiki/Australian-Companies-using-Ruby-on-Rails

IDE - Integrated Development Environment - https://en.wikipedia.org/wiki/Integrated_development_environment

Git (software) - https://en.wikipedia.org/wiki/Git_(software)

man page - https://en.wikipedia.org/wiki/Man_page

Terminal (OS X) - https://en.wikipedia.org/wiki/Terminal_(OS_X)

Mastering Markdown - https://guides.github.com/features/mastering-markdown/

One-Click rubyinstaller and DevKit - https://bintray.com/oneclick/rubyinstaller

MinGW - Minimalist GNU for Windows - http://www.mingw.org/

List of Ruby

https://github.com/ruby/ruby

https://twitter.com/matz_translated

https://twitter.com/yukihiro_matz

https://www.facebook.com/pages/Yukihiro-Matsumoto/109410772411674

https://plus.google.com/communities/101878695540653445908

Contributions

Fork and pull request. Simple.

About

Transforms Eclipse cheat sheets (XML) to DITA with Ruby, XSLT, XPath, Nokogiri

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages