[sword-devel] What markup format is SWORD's internal markup, and/or where is it documented?

Aaron Rainbolt arraybolt3 at gmail.com
Fri Dec 15 22:26:22 EST 2023


I didn't mean the actual compiled files - I meant the kind of markup you 
end up with if you use swModule->getRawEntry(). It's the same kind of 
markup you see if you use mod2imp on a module. So far the modules I've 
used this on seem to have some sort of pattern to them (there's <w> tags 
with "lemma" and "morph" attributes for Strong's numbers and morphology, 
<q> tags for... something, looks like it's part of how red-letter Bibles 
work because of the "who" attribute, and things like that). I assume 
it's this markup that is parsed by the existing filters, and that I 
would need to parse were I to write my own filter.

My text renderer does indeed support HTML, but it's ability to output 
Markdown is sorely lacking (I *can* tell it to give me whatever's in my 
text editor widget in Markdown format, but it loses information that 
Markdown is perfectly capable of containing). I need to be able to 
convert between Markdown and rich text both ways. On top of all of that 
I'm trying to support a particular flavor of Markdown that isn't normal 
(the variant Reddit uses in particular), so I have to do the parsing 
myself to implement things like superscripts and strikethroughs. 
Implementing a filter sounds like a good idea, but I think I'll have to 
parse this "internal markup format" to do so.

On 12/15/23 21:12, Greg Hellings wrote:
> The actual files are a custom binary format which is not documented 
> and is not intended to be any sort of standard accessed by anything 
> other than the library itself.
>
> Most newer works are imported from an OSIS file. Some older ones were 
> imported from GBF (I think?) or ThML (which is basically some basic 
> HTML display components mixed with a few tags for identifying things 
> like words of Christ or divine names). However, once they are imported 
> as modules some of that structure is lost to the proprietary binary 
> format of the SWORD module files.
>
> If you want the text in Markdown the best way is to create a filter 
> like the existing filters in the engine which can be used to generate 
> HTML, LaTeX, etc and write some which produce Markdown output.
>
> Although, since Markdown is basically simplified HTML that is 
> specifically intended to make HTML easier to write, why wouldn't you 
> just render out HTML from the existing filters and drop that into your 
> Markdown editor? Every md editor and renderer I've used will pass HTML 
> through unchanged, allowing the author to use its full syntax when 
> they wanted to.
>
> On Fri, Dec 15, 2023, 21:04 Aaron Rainbolt <arraybolt3 at gmail.com> wrote:
>
>     I had an idea of making a primarily Markdown-centric SWORD frontend
>     that would help with writing Bible studies and whatnot for
>     Markdown-based platforms like Reddit or Obsidian notes. For this
>     purpose, I want to parse the internal markup used by SWORD in its
>     modules, and then use my own custom code to generate Markdown from
>     that.
>
>     Obviously I can learn a lot about this markup by simply looking at
>     modules that use it, but I do wonder, is this markup at all
>     standardized? Is it documented anywhere? Does it have a name of some
>     sort that I can use to find handlers and tools for it in the SWORD API
>     docs?
>
>     Thanks,
>     Aaron
>     _______________________________________________
>     sword-devel mailing list: sword-devel at crosswire.org
>     http://crosswire.org/mailman/listinfo/sword-devel
>     Instructions to unsubscribe/change your settings at above page
>
>
> _______________________________________________
> sword-devel mailing list:sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20231215/87771858/attachment.htm>


More information about the sword-devel mailing list