Wiki

Clone wiki

Okapi / ResourceCase001

Text and localizable properties inside inline codes

In this case an HTML paragraph has an img inline element with a translatable alt attribute attribute and a modifiable href attribute.

<p>Before <img href='img.png' alt='text'/> after.</p>

TextUnit model

Event -> Resource (with GenericSkeleton):

DOCUMENT_PART -> DocumentPart={
   id=dp1
   properties={
      prop[href]='img.png' (localizable)
   }
   isReference=true
   skeleton={
   }
}
TEXT_UNIT -> TextUnit={
   id=t1
   properties={
   }
   isReference=true
   text=[text]
   skeleton={
   }
}
TEXT_UNIT -> TextUnit={
   id=t2
   properties={
   }
   isReference=false
   text=[Before <img href='{#$dp1@%href}' alt='{#$t1}'/> after.]
   skeleton={
      part='<p>'
      part='{#$$self$}'
      part='</p>'
   }
}

Maximalist TextFlow Model

<p>Before <img href='img.png' alt='text'/> after.</p>

becomes

TextFlow[id=1]{
  Properties{}
  Content(
    TextFragment[id=2]{'Before '}
    ResourceFragment[id=3]{
      ref:DataPart[ref-id=4]
    }
    TextFragment[id=8]{' after.'}
  )
}

DataPart[id=4]{
  Properties{
    ref:DataPart[ref-id=5]
    ref:TextFlow[ref-id=6]
  }
}

DataPart[id=5]{}

TextFlow[id=6]{
  Properties{}
  Content(
    TextFragment[id=7]{'text'})
  )
}

Missing from this picture is annotations (e.g. feature, skeleton data)

Events (indentation shows stack):

StartTextFlow(textflow) // <p..
  StartProperties
    // if the <p> element had attributes, they would come here
  EndProperties
  StartTextFlowContent // child content of <p>
    StartTextFragment(fragment) // 'Before '
    EndTextFragment(fragment)
    StartResourceFragment(fragment) // inline
      StartDataPart(datapart) // <img
        StartProperties
          StartDataPart(datapart2) // src attribute
          EndDataPart(datapart2)
          StartTextFlow(textflow2) // alt attribute
            StartProperties
            EndProperties
            StartTextFlowContent // alt attribute content
              StartTextFragment(fragment2)
              EndTextFragment(fragment2)
            EndTextFlowContent
          EndTextFlow(textflow2)
        EndProperties
      EndDataPart(datapart)
    EndResourceFragment(fragment)
    StartTextFragment(fragment)  // ' after.'
    EndTextFragment(fragment)
  EndTextFlowContent
EndTextFlow(textflow)

Updated