Sha256: 34d3f61f915379386ac2fede3464c008591578e182fb5048bfd2d8afc896edb2
Contents?: true
Size: 1.08 KB
Versions: 14
Compression:
Stored size: 1.08 KB
Contents
require "roman-numerals" module IsoDoc::Function module XrefGen def hiersep "." end def hierfigsep "-" end class Counter def initialize @num = 0 @letter = "" @subseq = "" end def increment(node) return self if node["unnumbered"] if node["subsequence"] != @subseq @subseq = node["subsequence"] @num += 1 @letter = node["subsequence"] ? "a" : "" else if @letter.empty? @num += 1 else @letter = (@letter.ord + 1).chr.to_s end end self end def print "#{@num}#{@letter}" end def listlabel(depth) return @num.to_s if [2, 7].include? depth return (96 + @num).chr.to_s if [1, 6].include? depth return (64 + @num).chr.to_s if [4, 9].include? depth return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth return @num.to_s end end end end
Version data entries
14 entries across 14 versions & 1 rubygems