Skip to content

Commit

Permalink
Include index value in speech IDs to ensure they are unique.
Browse files Browse the repository at this point in the history
  • Loading branch information
seandstewart committed Jul 28, 2020
1 parent 7524862 commit 84cfc3d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions iambic/ast/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def id(self) -> NodeID:
return NodeID(
f"{self.scene}-{self.persona}-{self.type.lower()}-"
f"{'{0}-{1}'.format(*self.linerange)}"
f"-{self.index}"
)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "iambic"
packages = [{include = "iambic"}, {include = "docs"}]
version = "2.0.1"
version = "2.0.2"
description = "Data extraction and rendering library for Shakespearean text."
authors = ["Sean Stewart <[email protected]>"]
license = "MIT"
Expand Down
40 changes: 20 additions & 20 deletions tests/static/foo.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ <h2 class="prologue" id="prologue-0" data-index="0">Prologue</h2>
<p class="entrance" id="prologue-0-entrance-1">
<em data-index="1">Enter FOO</em>
</p>
<p class="speech" id="prologue-0-foo-speech-1-1">
<strong class="persona" id="foo-prologue-0-foo-speech-1-1">Foo</strong>
<p class="speech" id="prologue-0-foo-speech-1-1-3">
<strong class="persona" id="foo-prologue-0-foo-speech-1-1-3">Foo</strong>
<br/>
<span class="dialogue" id="foo-dialogue-1-0" data-index="3" data-lineno="1">Bar.<br/></span>
</p>
<p class="speech" id="prologue-0-a-bar-speech-2-2">
<strong class="persona" id="a-bar-prologue-0-a-bar-speech-2-2">A Bar</strong>
<p class="speech" id="prologue-0-a-bar-speech-2-2-5">
<strong class="persona" id="a-bar-prologue-0-a-bar-speech-2-2-5">A Bar</strong>
<br/>
<span class="dialogue" id="a-bar-dialogue-2-0" data-index="5" data-lineno="2">Bar!<br/></span>
</p>
<p class="speech" id="prologue-0-bar-s-foo-speech-3-3">
<strong class="persona" id="bar-s-foo-prologue-0-bar-s-foo-speech-3-3">Bar's Foo</strong>
<p class="speech" id="prologue-0-bar-s-foo-speech-3-3-7">
<strong class="persona" id="bar-s-foo-prologue-0-bar-s-foo-speech-3-3-7">Bar's Foo</strong>
<br/>
<span class="dialogue" id="bar-s-foo-dialogue-3-0" data-index="7" data-lineno="3">Foo!<br/></span>
</p>
Expand All @@ -64,8 +64,8 @@ <h3 class="prologue" id="act-i-prologue-10" data-index="10">Prologue</h3>
<p class="entrance" id="act-i-prologue-10-entrance-11">
<em data-index="11">Enter BAR</em>
</p>
<p class="speech" id="act-i-prologue-10-bar-speech-4-4">
<strong class="persona" id="bar-act-i-prologue-10-bar-speech-4-4">Bar</strong>
<p class="speech" id="act-i-prologue-10-bar-speech-4-4-13">
<strong class="persona" id="bar-act-i-prologue-10-bar-speech-4-4-13">Bar</strong>
<br/>
<span class="action" id="act-i-prologue-10-bar-action-13" data-index="13">
<em>[Aside]</em>
Expand All @@ -78,32 +78,32 @@ <h3 class="scene" id="act-i-scene-i-i" data-index="16">SCENE I</h3>
<p class="entrance" id="act-i-scene-i-i-entrance-17">
<em data-index="17">Enter FOO and BAR</em>
</p>
<p class="speech" id="act-i-scene-i-i-foo-speech-5-5">
<strong class="persona" id="foo-act-i-scene-i-i-foo-speech-5-5">Foo</strong>
<p class="speech" id="act-i-scene-i-i-foo-speech-5-5-19">
<strong class="persona" id="foo-act-i-scene-i-i-foo-speech-5-5-19">Foo</strong>
<br/>
<span class="action" id="act-i-scene-i-i-foo-action-19" data-index="19">
<em>[To BAR]</em>
<br/>
</span>
<span class="dialogue" id="foo-dialogue-5-0" data-index="20" data-lineno="5">Bar.<br/></span>
</p>
<p class="speech" id="act-i-scene-i-i-bar-speech-6-6">
<strong class="persona" id="bar-act-i-scene-i-i-bar-speech-6-6">Bar</strong>
<p class="speech" id="act-i-scene-i-i-bar-speech-6-6-22">
<strong class="persona" id="bar-act-i-scene-i-i-bar-speech-6-6-22">Bar</strong>
<br/>
<span class="dialogue" id="bar-dialogue-6-0" data-index="22" data-lineno="6">Foo.<br/></span>
</p>
<p class="speech" id="act-i-scene-i-i-foo-speech-7-7">
<strong class="persona" id="foo-act-i-scene-i-i-foo-speech-7-7">Foo</strong>
<p class="speech" id="act-i-scene-i-i-foo-speech-7-7-24">
<strong class="persona" id="foo-act-i-scene-i-i-foo-speech-7-7-24">Foo</strong>
<br/>
<span class="dialogue" id="foo-dialogue-7-1" data-index="24" data-lineno="7">Bar. ...<br/></span>
</p>
<p class="speech" id="act-i-scene-i-i-bar-speech-7-7">
<strong class="persona" id="bar-act-i-scene-i-i-bar-speech-7-7">Bar</strong>
<p class="speech" id="act-i-scene-i-i-bar-speech-7-7-26">
<strong class="persona" id="bar-act-i-scene-i-i-bar-speech-7-7-26">Bar</strong>
<br/>
<span class="dialogue" id="bar-dialogue-7-2" data-index="26" data-lineno="7">... Foo. ...<br/></span>
</p>
<p class="speech" id="act-i-scene-i-i-foo-speech-7-7">
<strong class="persona" id="foo-act-i-scene-i-i-foo-speech-7-7">Foo</strong>
<p class="speech" id="act-i-scene-i-i-foo-speech-7-7-28">
<strong class="persona" id="foo-act-i-scene-i-i-foo-speech-7-7-28">Foo</strong>
<br/>
<span class="dialogue" id="foo-dialogue-7-3" data-index="28" data-lineno="7">... Bar.<br/></span>
<span class="direction" id="act-i-scene-i-i-direction-29" data-index="29">
Expand All @@ -117,8 +117,8 @@ <h3 class="epilogue" id="act-i-epilogue-33" data-index="33">EPILOGUE</h3>
<p class="entrance" id="act-i-epilogue-33-entrance-34">
<em data-index="34">Enter FOO and BAR</em>
</p>
<p class="speech" id="act-i-epilogue-33-foo-speech-8-8">
<strong class="persona" id="foo-act-i-epilogue-33-foo-speech-8-8">Foo</strong>
<p class="speech" id="act-i-epilogue-33-foo-speech-8-8-36">
<strong class="persona" id="foo-act-i-epilogue-33-foo-speech-8-8-36">Foo</strong>
<br/>
<span class="action" id="act-i-epilogue-33-foo-action-36" data-index="36">
<em>[Reads]</em>
Expand Down

0 comments on commit 84cfc3d

Please sign in to comment.