Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combbine into master #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Bamboo/Install_Paratext_Bamboo_Views.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@echo off
set viewgrp=TNDD
if exist user-views-manager.cmd call user-views-manager.cmd install %viewgrp% & exit
if exist ..\user-views-manager.cmd (
cd ..
call user-views-manager.cmd install %viewgrp%
echo %cd%
cd %viewgrp%
echo %cd%
)



92 changes: 92 additions & 0 deletions Bamboo/TNDD-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Paratext TNDD Views release

This additional tool for Paratext is designed to help content creators and checkers to VIEW (but not edit) the TNDD Paratext Project data in different ways. There are 5 views as explained below:

## Views

- **TNDD-table view** -- This displays up to four columns. The source language in the left most column, then the first meaning from the \ml1, then the second meaning and finally the third meaning.
- **TNDD-1st-mng-line** -- This displays the 1st meaning line preceded by the verse reference. Each verse starts on a new line.
- **TNDD-2nd-mng-line** -- This displays the 2nd meaning line and is similar to the 1st line, but if there no data for a second meaning (\ml1) line the then that data from the 1st meaning is displayed in (( )) with text in a red-brown color.
- **TNDD-3rd-mng-line** -- This displays the 3rd meaning line and is similar to the 1st and 2nd line, but if there no data for a third meaning (\ml1) line the then that data is displayed in (( with a brown color if it comes from the 2nd meaning and a red-brown if it come from he 1st first line.
- **TNDD-tag-errors** -- This aids content creators to see that there is a markup error that PT does not catch. This view may still have some false labeling.
- **TNDD-word-count-1st-mng-line** - This counts words per sentence. It marks sentence counts of more than 17 in orange and more than 30 words in tomato-red. Now includes chapter:verse and verse segment to ease comparison.
- **TNDD-word-count-2nd-mng-line** - This counts words per sentence. It marks sentence counts of more than 17 in orange and more than 30 words in tomato-red. If there is no 2nd meaning line then the 1st meaning line is included. Now includes chapter:verse and verse segment to ease comparison.

## How to Install these Views for Paratext



### Option 1: Use the Paratext-TNDD-Views-installer.exe
- Download Paratext-TNDD-Views-installer.exe from the [Assets section of the latest release](https://github.com/SILAsiaPub/PT-Views/releases/latest)
- Close Paratext if open.
- Run the installer and follow the usual steps to Install the Paratext Views. Your antivirus may tell you this program is rarely downloaded. That is true, but you can ignore the warning. (Previous versions were not signed. This version is signed.)
- Start Paratext and the new views should be available in the Ctrl+E menu or the projects hamburger menu.


### Option 2: Run a script to install
- Download TNDD-Views.zip from the [Assets section of the latest release](https://github.com/SILAsiaPub/PT-Views/releases/latest)
- Close Paratext if open.
- Select the option "Show in folder", and then in your Downloads folder, right click on the Views.zip file
- Then select your preferred UNZIP tool to Extract all... (preferably to a new folder called Views).
(if given the option, ensure that "Show extracted files when complete" is checked).
- Double click on the **install_Paratext_TNDD_Views.cmd**
- If all went well the black box dissappears. If not it will stay and give failure info
- Start Paratext and the new views should be available in the Ctrl+E menu or the projects hamburger menu.



## Using the TNDD Views within Paratext

- If the installation was successful, the new views should be available as shown below:
via the Ctrl+E popup menu: ![views list control e](images/views-list-ctrl-e.png) or via the project's View menu: ![views-list-proj-view](images/views-list-proj-view-sml.png)
- Note that you cannot edit the text in *any* of these VIEWS - it is purely an aid for reading and checking the text (one meaning line at a time) without the clutter of markers.

- If you are using Paratext 9, then it is highly recommended to open an additional TNDD window as an Autohide window:
![PT-auto-hide-setup](images/PT-auto-hide-setup.png)
- This will enable you to keep your normal workspace uncluttered, but the Table view will be easy to access from the right-hand column:
![PT-show-view](images/PT-show-view.png)


## There are four **Tools > Custom Tools > Custom Views**
- Hide TNDD Views
- Show TNDD Views
- Uninstall TNDD Views
- Update TNDD Views

### Hiding TNDD Views
- In Paratext click on the hamburger icon in any project.
- In the **Tools** menu hover over or click on **Custom tools**
- In **Custom tools** click on **Custom Views**
- Click on **Hide TNDD Views**
- Click the **OK** on the **Hide TNDD Views** dialog
- Restart Paratext

### Show TNDD Views tha were previously hidden
- In Paratext click on the hamburger icon in any project.
- In the **Tools** menu hover over or click on **Custom tools**
- In **Custom tools** click on **Custom Views**
- Click on **Show TNDD Views**
- Click the **OK** on the **Show TNDD Views** dialog
- Restart Paratext

## Uninstall TNDD Views
- Just double click the **Uninstall-TNDD-Views.cmd** in original extracted View.zip folder.
- Or find in: **C:\Users\Public\TNdd-Views** folder, the file **Uninstall-TNDD-Views.cmd** and double click that
- or You could just delete the Views folder if you only have TNDD views,
- or You could just delete the .xml files in the Views folder and those views would no longer appear,
- or you could delete all the files in the Views folder.
- also delete all files starting with TNDD from the **My Paratext 8(or 9) Projects\cms** folder if not using the uninstaller.

## Update the TNDD Views from the Github source
- In Paratext click on the hamburger icon in any project.
- In the **Tools** menu hover over or click on **Custom tools**
- In **Custom tools** click on **Custom Views**
- Click on **Update TNDD Views**
- Click the **OK** on the **Show TNDD Views** dialog
- Restart Paratext


---
Credits: Concept by Mark Penny, Design and Programming by Ian McQuay, TNDD direction by Steve Christensen

More details and further [updates](https://github.com/SILAsiaPub/PT-Views/releases) will be available at the [TNDD Views GitHub](https://github.com/SILAsiaPub/PT-Views/tree/master/TNDD) site.
9 changes: 9 additions & 0 deletions Bamboo/Uninstall_Paratext_Bamboo_Views.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
set viewgrp=Bamboo
if exist user-views-manager.cmd call user-views-manager2.cmd uninstall %viewgrp% & exit
if exist ..\user-views-manager.cmd (
cd ..
call user-views-manager.cmd uninstall %viewgrp%
cd %viewgrp%
)

3 changes: 3 additions & 0 deletions Bamboo/Views/TNDD-1st-mng-line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<ScriptureViewSettings>
</ScriptureViewSettings>
178 changes: 178 additions & 0 deletions Bamboo/Views/TNDD-1st-mng-line.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
#############################################################
# Name: TNDD-1st-mng-line.xslt
# Purpose: Provide a view of the first \ml1 after the \sl1 .
# Part of: PT-Views - https://github.com/SILAsiaPub/PT-Views
# Concept: Mark Penny
# XSLT & CSS: Ian McQuay <ian_mcquay@sil.org>
# Created: 2019-12-05
# Modified: 2020-11-04; 2021-07-27; 2024-01-22
# Copyright: (c) 2019 SIL International
# Licence: <MIT>
################################################################ -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="5" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="get-ml1" select="1"/>
<xsl:variable name="show-chap" select="'false'"/>
<xsl:variable name="ml1-pos">
<xsl:choose>
<xsl:when test="$get-ml1 = '1'">
<xsl:text>1st</xsl:text>
</xsl:when>
<xsl:when test="$get-ml1 = '2'">
<xsl:text>2nd</xsl:text>
</xsl:when>
<xsl:when test="$get-ml1 = '3'">
<xsl:text>3rd</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$get-ml1"/>
<xsl:text>th</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="/*">
<div class="usfm">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="para|book">
<!-- Do nothing with most para, except find verses to break lines -->
<xsl:apply-templates select="verse"/>
</xsl:template>
<xsl:template match="para[@style='sl1']">
<xsl:variable name="cur-sl1-pos" select="position()"/>
<xsl:variable name="ml1-target-pos" select="count(following-sibling::*[@style = 'ml1'][number($get-ml1)]/preceding-sibling::*) + 1"/>
<xsl:variable name="ml1-prev1-pos" select="count(following-sibling::*[@style = 'ml1'][number($get-ml1) -1]/preceding-sibling::*) + 1"/>
<xsl:variable name="ml1-prev2-pos" select="count(following-sibling::*[@style = 'ml1'][number($get-ml1) -2]/preceding-sibling::*) + 1"/>
<xsl:variable name="ml1-first" select="count(following-sibling::*[@style = 'ml1'][1]/preceding-sibling::*) + 1"/>
<xsl:variable name="p-first" select="count(following-sibling::*[@style = 'p'][1]/preceding-sibling::*) + 1"/>
<xsl:variable name="next-sl1-pos" select="count(following-sibling::*[@style = 'sl1'][1]/preceding-sibling::*) + 1"/>
<xsl:variable name="chap" select="substring-before(text()[1],':')"/>
<xsl:if test="count(preceding-sibling::*[@style='sl1']) = 0">
<!-- Provide styles once weather for the whole book or for chapter by chapter like in Paratext -->
<xsl:call-template name="styles"/>
</xsl:if>
<xsl:text> </xsl:text>
<span class="verse">
<xsl:apply-templates select="text()[1]" mode="verse">
<xsl:with-param name="chap" select="$chap"/>
</xsl:apply-templates>
<xsl:text> </xsl:text>
</span>
<xsl:choose>
<xsl:when test="number($next-sl1-pos) = 1 and $ml1-target-pos &gt; $cur-sl1-pos">
<!-- This handles end of book where there is no next \sl1. Next \sl1 position returns 1 -->
<xsl:apply-templates select="following-sibling::*[@style = 'ml1'][number($get-ml1)]" mode="meaning"/>
</xsl:when>
<xsl:when test="$next-sl1-pos &gt; $cur-sl1-pos and $ml1-first &gt; $next-sl1-pos and $p-first &lt; $next-sl1-pos">
<!-- This handles when there is no \ml1 between the current \sl1 and the next \sl1 but there is a \p that can be used -->
<span class="reordered">
<xsl:text> (( (reordered) </xsl:text>
<xsl:apply-templates select="following-sibling::*[@style = 'p'][1]" mode="meaning"/>
<xsl:text> )) </xsl:text>
</span>
</xsl:when>
<xsl:when test="$ml1-target-pos &lt; $next-sl1-pos">
<!-- This is for when the target \ml1 exists -->
<span class="ml1">
<xsl:apply-templates select="following-sibling::*[@style = 'ml1'][number($get-ml1)]" mode="meaning"/>
</span>
</xsl:when>
<xsl:otherwise>
<!-- This handles getting previous \ml1 lines -->
<span class="sub">
<xsl:text> (( </xsl:text>
<xsl:choose>
<xsl:when test="$ml1-prev1-pos &lt; $next-sl1-pos">
<!-- Handles when there is a previous line -->
<span class="ml1-prev1">
<xsl:apply-templates select="following-sibling::*[@style = 'ml1'][number($get-ml1) - 1]" mode="meaning"/>
</span>
</xsl:when>
<xsl:otherwise>
<!-- Handles when there is a second previous line. Ie. \ml1[3] does not exist nor does \ml1[2] but \ml1[1] exists -->
<span class="ml1-prev2">
<xsl:apply-templates select="following-sibling::*[@style = 'ml1'][number($get-ml1) - 2]" mode="meaning"/>
</span>
</xsl:otherwise>
</xsl:choose>
<xsl:text> )) </xsl:text>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="para[@style='ml1' or @style = 'p']" mode="meaning">
<!-- Output the marker selected relative to preceding \sl1 -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">
<!-- Do nothing -->
</xsl:template>
<xsl:template match="chapter">
<xsl:if test="count(preceding::chapter) = 0">
<xsl:element name="h2">
<xsl:text>Version: 7 TNDD 1st meaning line view</xsl:text>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match="char">
<!-- handle character styles -->
<span class="{@style}">
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="verse[@number]">
<!-- Output a line break to separate verses handle USFM 2 and 3 -->
<xsl:element name="br"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="text()" mode="verse">
<xsl:param name="chap"/>
<!-- This is text we want to show -->
<xsl:variable name="v">
<xsl:choose>
<xsl:when test="string-length(substring-before(.,' ')) &gt; 0">
<xsl:value-of select="substring-before(.,' ')"/>
</xsl:when>
<xsl:when test="string-length(substring-after(.,':')) = 0">
<xsl:value-of select="concat($chap,':',.)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$show-chap = 'true'">
<xsl:value-of select="normalize-space($v)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(substring-after($v,':'))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="table">
<xsl:element name="h2">
<xsl:value-of select="*/*/*[@style = 'sbx'][1]"/>
</xsl:element>
</xsl:template>
<xsl:template match="annot">
<xsl:apply-templates select="node()"/>
</xsl:template>
<xsl:template name="styles">
<style type="text/css">
.sub {color:saddlebrown}
.ml1 {}
.ml1-prev1 {color:saddlebrown}
.ml1-prev2 {color:firebrick}
.reordered {color:purple}
.imp {color:blue}
.brk {vertical-align: sub;font-size:70%;color:gray}
.verse {vertical-align: super; color:forestgreen;font-size:85%}
.rgi , .rgm {vertical-align: super;}
</style>
</xsl:template>
</xsl:stylesheet>
3 changes: 3 additions & 0 deletions Bamboo/Views/TNDD-2nd-mng-line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<ScriptureViewSettings>
</ScriptureViewSettings>
Loading