0 Replies Latest reply on Nov 29, 2012 10:08 AM by SLTyPete

    [js][cs6] Need startup help: adding tags to existing document structure

    SLTyPete

      Wow, what a great community here! I've been browsing through and learned much. (Me: experienced SW dev/architect but quite new to INDD scripting.)

       

      Context for my question: we have a large quantity of documents that are reasonably well formatted using para/char styles and few overrides. My job is to add XML structure to the document. I've written some nice scripts that translate styles into tags and such, but I have some richer auto-tagging to do and have no idea how to get from here to there. I suspect that some kind of range management and/or grep-based search might help, but as a noob I don't know how to script that, have not found any examples after hours of searching/reading, and would love a few hints to get me going.

       

      Here's a (fake) example as a starting point. I'm placing paragraph styles in ## and character styles in {}. All styles can be converted to tags of course if that helps.

      #header#Topic A Header#/header#

         #subhead#A.1 subhead#/subhead#

            #Content1#Intro: Day 1 topic#/Content1#

            #ContentNormal#Blah {boldblah}blah{/boldblah} blah#/ContentNormal#

         #subhead#A.2 subhead#/subhead#

            #ContentTricky#Blah blah blah#/ContentTricky#

      #headerX#Topic B Header#/headerX#

           #ContentNormal#This section has a slightly different header style, as you can see#/ContentNormal#

      So, the kinds of things I want to do:

       

      * Tag all content after the #header# paragraph and before any other #header*# para as a <TopicContent> section

      * Tag all content from #subhead# (including the #subhead# para) up to the next #subhead# as a <SubTopic> section

      * Tag the word "Intro" within a #Content1# para as a <SpecialItem>

       

      While I'm at it (should I make this separate?)... I feel like I am missing something. In a table, each <Cell> is tagged but how do I discover the end of one row and the start of the next??? I have content in the first cell of rows, etc... not all rows have the same number of cells so simple counting won't be easy...

       

      Thanks MUCH for any hints anybody can provide. Pointers to documents or tutorials would be fine. I just haven't found any examples that addres these kinds of things.

       

      Blessings,

      Pete