Jump to content

Formatting text ahead of time to import as an Accordance Lexicon user tool


Steven MacDonald

Recommended Posts

Is is possible to pre-format a text file for importing into Accordance as a User Lexicon tool as opposed to having to change an import line by line so I don't have to do all of the below one word at a time?  In other words, is there a way to express this formatting in a text file before import to save time?  Thanks.

 

  • The hierarchical titles appear in the browser, and break the text up into articles.
  • The first line of the Edit window is always a title line. This is indicated by the red T (c-t.gif) in the left margin. The cursor changes to a red T (c-t.gif) when it moves into the left margin of the Edit window.
  • Add or Remove a Title: Click the cursor in the left margin to add or remove a T from the first line of the adjacent paragraph.
  • Add a Subtitle: Alt+Click in the left margin changes the cursor to T+ (c-t+.gif) and creates a subtitle indicated by a numeral.
  • The first level of subtitles are marked with a 1.
  • Alt+Click again to go up a level.
  • –Shift Alt+Click changes the cursor to T- (c-t-.gif) and moves the subtitle down a level.
  • Alt+Click on a line below a subtitle enters a new subtitle of the same level. 
  • You can also use font sizes and styles to distinguish major headings from subheadings.
  • Title Language and Length: The title must contain only English text. The limit for a title is 128 characters.
  • Use a carriage return to end the title and return to the Contents, or to start a second title if the title is too long. Changing to another field ends the text of the title.
  • The title can be left blank, in which case a blank line appears in the browser. The blank title can be used to break up sections of text which are too long for one article, but do not need another heading.
  • Like 2
Link to comment
Share on other sites

@Mark Allison Do you have any thoughts on this one? I know you've done a lot with User Tools in the past. I can also ask @Ryan Mudge.

Link to comment
Share on other sites

If you use styles to create your text in something like Word or Pages, the Table of Contents and text styles will be retained. 

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

It may be helpful if a user tool could be exported as text or HTML to see what the actual formatting is.

 

Link to comment
Share on other sites

I haven't checked to see if a User Tool can be exported as a HTML. I think it can be exported as a text file. Has anyone else tried this?

Link to comment
Share on other sites

On 6/17/2023 at 5:18 PM, Nathan Parker said:

I haven't checked to see if a User Tool can be exported as a HTML. I think it can be exported as a text file. Has anyone else tried this?

There is not any menu item to export a User Tool that I can find. There are these options: you can print, and then save a PDF from the print dialog (this is easy on macOS, and I've seen a "Save as PDF" printer on Windows). You can do Edit > Select All and then File > Save Text Selection > Plain Text… or RTF…

 

So if you want to see the formatting, the best you can do at present is to save an RTF file of the User Tool or of a selected part.

Link to comment
Share on other sites

Thanks for this!

Link to comment
Share on other sites

  • 2 weeks later...

Okay, more specifics.  I was able to produce a nice sample Greek Lexicon based on the word roots.  You can then expand each word root to see the words below it.  I have a lot more words I want to add and it is very tedious to have to click through each line to set it as a "T" or a "1".  Can an option be added to import a specific file format where it would understand the T and 1 formatting at import?  I tried copying and pasting within the editor as well to see if I could speed things up and it will not preserve the T or 1 formatting.  Can this type of enhanced functionality be added?  Otherwise it's very tedious which I am willing to do if necessary.  I am glad for what the tool can do 🙂

 

 

Screenshot 2023-07-01 at 4.50.31 PM.png

Screenshot 2023-07-01 at 4.52.59 PM.png

  • Like 1
Link to comment
Share on other sites

Let me ask on this one.

  • Like 1
Link to comment
Share on other sites

28 minutes ago, Nathan Parker said:

Let me ask on this one.

Thank you!

Link to comment
Share on other sites

When you import HTML, <h1> elements should become T, and <h2> elements should become 1.  You can use a plain text editor like BBEdit (macOS) or Notepad++ (Windows) to make an HTML file.

 

<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>δεικ, δειγ</h1>
<h2>δείκνυμι</h2>
<p>I show (metaphorically: I give evidence or proof) (English “indicate”
comes from this root)</p>
<h2>δεῖγμα</h2>
<p>a firm example that demonstrates the inviolable nature of God’s
design (only used in Jude 1:7 in OT and NT, see 2 Peter 2:6
ὑπόδειγμα)</p>
</body>
</html>

 

Many people find it easier to produce HTML with Markdown instead of directly typing the  more verbose HTML syntax:

 

# δεικ, δειγ

## δείκνυμι

I show (metaphorically: I give evidence or proof) (English
"indicate" comes from this root)

##  δεῖγμα

a firm example that demonstrates the inviolable nature of God's
design (only used in Jude 1:7 in OT and NT, see 2 Peter 2:6 ὑπόδειγμα)

There are innumerable tools that will convert Markdown to HTML. I use pandoc on the  command line, but there are lots of Markdown editors for various platforms.

Edited by jlm
Removed unnecessary id attrbute from h1 and h2 elements.
  • Like 1
Link to comment
Share on other sites

5 minutes ago, jlm said:

When you import HTML, <h1> elements should become T, and <h2> elements should become 1.  You can use a plain text editor like BBEdit (macOS) or Notepad++ (Windows) to make an HTML file.

 

<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1 id="δεικ-δειγ">δεικ, δειγ</h1>
<h2 id="δείκνυμι">δείκνυμι</h2>
<p>I show (metaphorically: I give evidence or proof) (English “indicate”
comes from this root)</p>
<h2 id="δεῖγμα">δεῖγμα</h2>
<p>a firm example that demonstrates the inviolable nature of God’s
design (only used in Jude 1:7 in OT and NT, see 2 Peter 2:6
ὑπόδειγμα)</p>
</body>
</html>

 

Many people find it easier to produce HTML with Markdown instead of directly typing the  more verbose HTML syntax:

 

# δεικ, δειγ

## δείκνυμι

I show (metaphorically: I give evidence or proof) (English
"indicate" comes from this root)

##  δεῖγμα

a firm example that demonstrates the inviolable nature of God's
design (only used in Jude 1:7 in OT and NT, see 2 Peter 2:6 ὑπόδειγμα)

There are innumerable tools that will convert Markdown to HTML. I use pandoc on the  command line, but there are lots of Markdown editors for various platforms.

Thank you much.  I will need to investigate.

Link to comment
Share on other sites

Good info. Thanks!

Link to comment
Share on other sites

On 7/2/2023 at 8:48 AM, jlm said:

When you import HTML, <h1> elements should become T, and <h2> elements should become 1.  You can use a plain text editor like BBEdit (macOS) or Notepad++ (Windows) to make an HTML file.

 

<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>δεικ, δειγ</h1>
<h2>δείκνυμι</h2>
<p>I show (metaphorically: I give evidence or proof) (English “indicate”
comes from this root)</p>
<h2>δεῖγμα</h2>
<p>a firm example that demonstrates the inviolable nature of God’s
design (only used in Jude 1:7 in OT and NT, see 2 Peter 2:6
ὑπόδειγμα)</p>
</body>
</html>

 

Many people find it easier to produce HTML with Markdown instead of directly typing the  more verbose HTML syntax:

 

# δεικ, δειγ

## δείκνυμι

I show (metaphorically: I give evidence or proof) (English
"indicate" comes from this root)

##  δεῖγμα

a firm example that demonstrates the inviolable nature of God's
design (only used in Jude 1:7 in OT and NT, see 2 Peter 2:6 ὑπόδειγμα)

There are innumerable tools that will convert Markdown to HTML. I use pandoc on the  command line, but there are lots of Markdown editors for various platforms.

I was able to successfully create a basic MD file using MacOS TextEdit.  However, after converting to HTML using Panda, it results in the Greek font being lost and replaced with gibberish as shown below.  Note:  I am using the SBL Greek font and the html output contains gibberish before I import as a Greek lexicon.  Any suggestions?

Screenshot 2023-07-03 at 2.05.25 PM.png

Link to comment
Share on other sites

39 minutes ago, Steven MacDonald said:

I was able to successfully create a basic MD file using MacOS TextEdit.  However, after converting to HTML using Panda, it results in the Greek font being lost and replaced with gibberish as shown below.  Note:  I am using the SBL Greek font and the html output contains gibberish before I import as a Greek lexicon.  Any suggestions?

Screenshot 2023-07-03 at 2.05.25 PM.png

This tag must be included in the html head (as in the example above in this thread) in order for Accordance to recognize the encoding as Unicode: 

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

If it’s missing from the HTML file, the Greek will be gibberish. So open your HTML file with a plain text editor and add this tag in the appropriate place.

 

TextEdit is not ideal, because it can also save in RTF in addition to plain text, but it can work if you’re careful.

Link to comment
Share on other sites

1 hour ago, jlm said:

This tag must be included in the html head (as in the example above in this thread) in order for Accordance to recognize the encoding as Unicode: 

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

If it’s missing from the HTML file, the Greek will be gibberish. So open your HTML file with a plain text editor and add this tag in the appropriate place.

 

TextEdit is not ideal, because it can also save in RTF in addition to plain text, but it can work if you’re careful.

I appreciate your willingness to help.  I naively thought I could just write my document in an MD file and do a "simple" conversion 🙂. But I have made improvements and the results are at least readable.  I added the DOCTYPE and HEAD to my sections as shown below but was still having conversion issues.  So I tried the Pandora online converter so I could adjust settings.  It looks like I needed to choose the markdown_strict to basic HTML conversion as opposed to HTML5.  It looks much better now except for a minor issue with the justification. The H1 sections ended up centered and the H2 ended up left justified EXCEPT for the first instance of the H2 after the H1.  If you have any further hints I'd appreciate it.  I am definitely learning a lot.  I've added the screenshots in case it may benefit someone else who may want to give it a try.

 

 

 

 

 

 

Screenshot 2023-07-03 at 4.26.32 PM.png

Screenshot 2023-07-03 at 4.42.25 PM.png

Screenshot 2023-07-03 at 4.22.26 PM.png

Edited by Steven MacDonald
wrong picture
  • Like 1
Link to comment
Share on other sites

2 hours ago, Steven MacDonald said:

I appreciate your willingness to help.  I naively thought I could just write my document in an MD file and do a "simple" conversion 🙂. But I have made improvements and the results are at least readable.  I added the DOCTYPE and HEAD to my sections as shown below but was still having conversion issues.  So I tried the Pandora online converter so I could adjust settings.  It looks like I needed to choose the markdown_strict to basic HTML conversion as opposed to HTML5.  It looks much better now except for a minor issue with the justification. The H1 sections ended up centered and the H2 ended up left justified EXCEPT for the first instance of the H2 after the H1.  If you have any further hints I'd appreciate it.  I am definitely learning a lot.  I've added the screenshots in case it may benefit someone else who may want to give it a try.

In theory, you ought to be able to do a simple conversion. That would probably have worked if you weren't using Greek or Hebrew. Since you are, more care is needed to avoid the rough edges of Accordance's HTML import functionality.

 

The markdown_strict setting turns off a lot of functionality, most of which you aren't using anyway, but the important thing it turns off is automatic ID generation for headings. When the headings contain non-Latin letters, so do the IDs, and non-Latin characters in IDs confuse Accordance's HTML importer.

 

I can't tell you how to stop the centering: that's not something specified in the HTML, so it must be Accordance that decides to do it. My guess is that if there was a paragraph after the <h1>, the following <h2> wouldn't be centered, but it might not make sense to put text there.

 

The only improvement I can suggest to what you're doing is to give pandoc a simple template and tick the standalone box. That way you'll get a complete HTML file instead of a fragment to paste into a file. It will give you warnings about missing lang and title metadata, but you can't specify them with markdown_strict, and I don't think Accordance would use them anyway.

 

Here's a minimal template:

<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
$body$
</body>
</html>

 

IMG_DF0ECFE6F3C2-1.thumb.jpeg.fa061e5815840e433d77b8399d07bfcd.jpeg

 

If you want to use pandoc locally and avoid the command line, Quarto is a GUI for pandoc oriented toward scientific writing. I haven't used it, though.

 

Addendum:

According to list of supported tags in the help, which I've found to have some errors, <h1>, <h2>, <h3>, … tags will always produce centered titles.

Edited by jlm
Added link to help.
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...