Skip to content

Instantly share code, notes, and snippets.

@mkaatman
mkaatman / csv2table.html
Last active Dec 29, 2015
Convert from CSV data to DITA XML Table
View csv2table.html
<!-- http://jsfiddle.net/vHQwN/8/ -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Convert CSV to Table</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style>
/* CSS source: http://24ways.org/2009/have-a-field-day-with-html5-forms */
html, body, h1, form, fieldset, legend, ol, li {
@mkaatman
mkaatman / list2fotable
Last active Sep 6, 2018
XSL templates to transform a DITA list to a dynamic FO table via outputclass.
View list2fotable
<!--
It works with both simple list and unordered list. The output can be sorted across rows or columns.
The outputclass supports the number of columns and you can specify if you want it to be ordered vertically across rows or horizontally across columns.
Format: <number of columns>column(optional: _vert)
Examples:
3 column vertical sort – <sl outputclass=”3column_vert”>
2 column horizontal sort - <sl outputclass=”2column”>
You will need to define a "my" namespace in your stylesheet:
@mkaatman
mkaatman / Test.dita
Last active Dec 21, 2015
Gloss entry rendering duplicate ID
View Test.dita
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE glossentry PUBLIC "-//OASIS//DTD DITA Glossary//EN" "glossary.dtd">
<glossentry id="glossentry_Test">
<glossterm><keyword id="term_Test" >Test</keyword></glossterm>
<glossdef>Duplicate ID.</glossdef>
</glossentry>
View Broken CALS table
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="concept_s25_kyh_zh">
<title>Broken CALS table</title>
<conbody>
<p>
<table id="table_3A860165B5A748A79B06028C4CE30C5A" >
<title>Broken Table</title>
<tgroup cols="12">
@mkaatman
mkaatman / add_navtitles.rb
Last active Dec 15, 2015 — forked from wbrisett/add_navtitles.rb
Update to Wayne's script. Adds XML indentation on maps.
View add_navtitles.rb
# Version 3.0 March 2013
# Changed reading of files from binary back to text.
# Added backup folder "...just in case"
# Added fix for Vasont extract Maps
# Added .dita files to script
# Changed parsing of title to xpath via Nokogiri
require 'fileutils'
require 'nokogiri'
@mkaatman
mkaatman / findOrphans.php
Last active Oct 2, 2015
Find and optionally delete dita files that are not referenced from the ditamap.
View findOrphans.php
<?php
/**
* Find and optionally delete files that are not referenced from the ditamap as a topicref.
* Disclaimer: Not smart enough to look for keydef yet
*/
// Set this to the relative (to where you're executing script from) or absolute path
$dir_base = 'base/path/to/files/';
// Set this to directory name where dita files exist
$dir_read = 'user';
@mkaatman
mkaatman / convertTask.php
Created Mar 14, 2012
convert dita general task to strict task
View convertTask.php
<? php
/**
* Convert a DITA General Task to a Strict Task
* Backup your files
* Carefully review what this script is doing
* Expect manual post processing cleanup
* Be aware that it does change some IDs
*/
// Directory to read files from