Company Logo

FrameMaker Remove Hard Code Paragraph Numbers

#! /bin/sh
SRC_ID='@(#) $Header: remove_numbering,v 1.0 93/11/10 14:56:15
    uid=135(dhighley) gid=10(staff) groups=10(staff) Exp $'
# Author: David Highley
# Copyright (c) 1993 Highley Recommended, Inc.
# All Rights Reserved.  This copyright and the "SRC_ID" string(s)
# included in the source must not be removed.  Permission is granted
# for licensed systems.

#
# $Log$
# Initial Edit: 93/11/10 14:56:15
#


        Rev='$Revision: 1.0 $'


nawk ' BEGIN{ChapterNo="'"$1"'"}
{

################################################################
#  This section extracts the Catalog at the start of the file  #
################################################################
	True = "True"
	print $0

	while ( True == "True" ) {
		getline

		if ( $0 == "> # End of Catalog" ) {
			print $0
			break}

		print $0
	}

################################################################
#  This section replaces the first paragraph number with the   #
#  chapter number.  It then removes all other paragraph numbers #
#  so auto numbering will work.                                #
################################################################
	Quote = "\047"
	getline

	while ( match($0,"<PgfNumFormat") == 0 ) {
		print $0
		getline }
	printf("  <PgfNumFormat `<n=%s\\>. %s>\n", ChapterNo, Quote)


	while ( getline >> 0 ) {
		if ( match($0,"<PgfNumFormat") >0 || match($0,"<PgfNumString") >0 ) {
			continue }
	print $0
	if ($0 == "# End of MIFFile") { exit }
	}
}'