Better formatting for interlinears on the ZBB
-
- Avisaru
- Posts: 275
- Joined: Wed Dec 15, 2004 9:05 am
- Location: Nottingham, England
- Contact:
Better formatting for interlinears on the ZBB
I was wondering if it would be possible to add better support for formatting interlinear glosses to a phpbb board like the ZBB. A while ago I developed a small plugin for the dokuwiki software, that forced the morphemes in interlinear glosses to align by using tables. I've also build something similar into the new version of my blog. There's a page on that here, complete with PHP source code and an example of what it does:
http://www.chrisdb.me.uk/wiki/doku.php? ... oss_plugin
After you've packed everything into tables all you need is to apply some CSS to force the browser to display them inline and remove any borders. When I first looked at this a long time ago, I also looked at using the ruby tags, but a lot of browsers don't support them properly so inlined tables is a better approach.
It seems like this is something that would be pretty useful for something like the ZBB, given that we mostly talk about linguistics. It's a real pain when people do interlinears and the lengths of the morphemes don't line up, so it's hard to figure out which bit is which.
I've googled to find out what support phpBB has for custom tags, and it looks like it basically just done very simple find and replace using regexes. This wouldn't be enough to do the interlinears using tables. Since that's the case, it looks like you're probably have to just tag the interlinears using a span tag or similar, and then use some custom javascript to build the tables on the client-side.
Doing this shouldn't be too difficult. It would involve:
1. setting up custom tags [interlinear] which translate into <span class="interlinear">
2. writing a simple javascript function that scans through a page looking for <span class="interlinear"> and replaces it with the inlined tables, using approximately the algorithm outlined above. Each table needs to have class "interlinear"
3. adding a bit of css to inline tables with class "interlinear" and remove borders / other unwanted formatting
Is anyone else interested in this? Zompist, are you interested?
http://www.chrisdb.me.uk/wiki/doku.php? ... oss_plugin
After you've packed everything into tables all you need is to apply some CSS to force the browser to display them inline and remove any borders. When I first looked at this a long time ago, I also looked at using the ruby tags, but a lot of browsers don't support them properly so inlined tables is a better approach.
It seems like this is something that would be pretty useful for something like the ZBB, given that we mostly talk about linguistics. It's a real pain when people do interlinears and the lengths of the morphemes don't line up, so it's hard to figure out which bit is which.
I've googled to find out what support phpBB has for custom tags, and it looks like it basically just done very simple find and replace using regexes. This wouldn't be enough to do the interlinears using tables. Since that's the case, it looks like you're probably have to just tag the interlinears using a span tag or similar, and then use some custom javascript to build the tables on the client-side.
Doing this shouldn't be too difficult. It would involve:
1. setting up custom tags [interlinear] which translate into <span class="interlinear">
2. writing a simple javascript function that scans through a page looking for <span class="interlinear"> and replaces it with the inlined tables, using approximately the algorithm outlined above. Each table needs to have class "interlinear"
3. adding a bit of css to inline tables with class "interlinear" and remove borders / other unwanted formatting
Is anyone else interested in this? Zompist, are you interested?
Try the online version of the HaSC sound change applier: http://chrisdb.dyndns-at-home.com/HaSC
Re: Better formatting for interlinears on the ZBB
excellent it would be
Implemented, however, I think not
nevertheless with it best of luck
Implemented, however, I think not
nevertheless with it best of luck
Re: Better formatting for interlinears on the ZBB
If you want to try to do the work, go for it.
So long as spinn is hosting, I can change templates and stylesheets; I can't change any PHP files.
The thing is, the changes have to be isolated enough that they can be reapplied with phpbb updates. That is, if you change the code in a hundred places, it's not going to be easy to reapply.
So long as spinn is hosting, I can change templates and stylesheets; I can't change any PHP files.
The thing is, the changes have to be isolated enough that they can be reapplied with phpbb updates. That is, if you change the code in a hundred places, it's not going to be easy to reapply.
-
- Avisaru
- Posts: 275
- Joined: Wed Dec 15, 2004 9:05 am
- Location: Nottingham, England
- Contact:
Re: Better formatting for interlinears on the ZBB
I guess I'll probably try to code it up in Javascript in the next week or two. When I have something that works I'll post again and ask for volunteers to test it.
Try the online version of the HaSC sound change applier: http://chrisdb.dyndns-at-home.com/HaSC
Re: Better formatting for interlinears on the ZBB
Actually, PhpBB3 possesses the ability to add and create new BBCode through the admin panel, which essentially consists in creating rules to replace [tags][/tags] with appropriately formatted HTML. Though you wouldn't be able to use the php code linked, you could easily find an alternative solution mixing html and css.
http://www.phpbb.com/kb/article/adding- ... in-phpbb3/
http://www.phpbb.com/kb/article/adding- ... in-phpbb3/
Chances are it's Ryukyuan (Resources).
Re: Better formatting for interlinears on the ZBB
Instead of tables, might I recommend something like what I did on this page in the Novegradian grammar? The overall appearance is the same, but it has a number of advantages:
1) It wraps correctly. Long tables will need manual breaks or will stretch the page, whereas the method I used using definition tags + some CSS wraps all by itself
2) The code is a bit nicer, since it keeps the words and the glosses for each word together in the code. In a table, you would have a single row of the native language followed by a row of glosses, which for long sentences could mean the original language and gloss are confusingly far about in the HTML.
3) If you care at all, it's a bit more semantic than tables are, since definition lists come a bit closer to glosses than plain old tables do.
In the HTML, it just works as a long series of definition items, like this:
And the CSS is just:
1) It wraps correctly. Long tables will need manual breaks or will stretch the page, whereas the method I used using definition tags + some CSS wraps all by itself
2) The code is a bit nicer, since it keeps the words and the glosses for each word together in the code. In a table, you would have a single row of the native language followed by a row of glosses, which for long sentences could mean the original language and gloss are confusingly far about in the HTML.
3) If you care at all, it's a bit more semantic than tables are, since definition lists come a bit closer to glosses than plain old tables do.
In the HTML, it just works as a long series of definition items, like this:
Code: Select all
<div class="glossblock">
<dl>
<dt>Вецераш,</dt>
<dd>Véceraś,<br>yesterday</dd>
</dl>
<dl>
<dt>дуадеши</dt>
<dd>duadéśi<br>twenty</dd>
</dl>
<dl>
<dt>цедиртий</dt>
<dd>cedírtij<br>fourth</dd>
</dl>
...
</div>
Code: Select all
.glossblock
{
clear: both;
font-size: 12px;
padding-top: 5px
padding-bottom: 5px;
}
.glossblock dl
{
float: left;
margin: 0 0.5em 0.5em 0;
text-align: left;
}
.glossblock dt
{
font-style: italic;
}
.glossblock dd
{
margin-left: 0cm;
}
http://www.veche.net/
http://www.veche.net/novegradian - Grammar of Novegradian
http://www.veche.net/alashian - Grammar of Alashian
http://www.veche.net/novegradian - Grammar of Novegradian
http://www.veche.net/alashian - Grammar of Alashian
-
- Avisaru
- Posts: 275
- Joined: Wed Dec 15, 2004 9:05 am
- Location: Nottingham, England
- Contact:
Re: Better formatting for interlinears on the ZBB
In fact, what I did before was a table for each word to make the morphemes within the word align properly. The words automatically align properly because they're in different tables. In your example, it doesn't look like the within-word morphemes line up? Although I guess it could be tweaked to do that, although what it can't do is prevent wrapping in the middle of a word if you use a separate definition for each morpheme.Mecislau wrote:Instead of tables, might I recommend something like what I did on this page in the Novegradian grammar? The overall appearance is the same, but it has a number of advantages:
1) It wraps correctly. Long tables will need manual breaks or will stretch the page, whereas the method I used using definition tags + some CSS wraps all by itself
That's true.2) The code is a bit nicer, since it keeps the words and the glosses for each word together in the code. In a table, you would have a single row of the native language followed by a row of glosses, which for long sentences could mean the original language and gloss are confusingly far about in the HTML.
3) If you care at all, it's a bit more semantic than tables are, since definition lists come a bit closer to glosses than plain old tables do.
In the HTML, it just works as a long series of definition items, like this:And the CSS is just:Code: Select all
<div class="glossblock"> <dl> <dt>Вецераш,</dt> <dd>Véceraś,<br>yesterday</dd> </dl> <dl> <dt>дуадеши</dt> <dd>duadéśi<br>twenty</dd> </dl> <dl> <dt>цедиртий</dt> <dd>cedírtij<br>fourth</dd> </dl> ... </div>
Code: Select all
.glossblock { clear: both; font-size: 12px; padding-top: 5px padding-bottom: 5px; } .glossblock dl { float: left; margin: 0 0.5em 0.5em 0; text-align: left; } .glossblock dt { font-style: italic; } .glossblock dd { margin-left: 0cm; }
Last edited by chris_notts on Wed Oct 19, 2011 2:58 am, edited 2 times in total.
Try the online version of the HaSC sound change applier: http://chrisdb.dyndns-at-home.com/HaSC
-
- Avisaru
- Posts: 275
- Joined: Wed Dec 15, 2004 9:05 am
- Location: Nottingham, England
- Contact:
Re: Better formatting for interlinears on the ZBB
I already mentioned that. But I don't believe that the find and replace functionality it offers is powerful enough for what we want to do. I don't want to force users to manually build the tag structure. What should happen is this:Hakaku wrote:Actually, PhpBB3 possesses the ability to add and create new BBCode through the admin panel, which essentially consists in creating rules to replace [tags][/tags] with appropriately formatted HTML. Though you wouldn't be able to use the php code linked, you could easily find an alternative solution mixing html and css.
http://www.phpbb.com/kb/article/adding- ... in-phpbb3/
Code: Select all
[interlinear]
hola, como esta-s?
hello, how are-you?
[/interlinear]
Try the online version of the HaSC sound change applier: http://chrisdb.dyndns-at-home.com/HaSC
Re: Better formatting for interlinears on the ZBB
Ooooh now see, I tried to do this on the Feayran site but couldn't figure out a good way to make it work--didn't think to use definition lists. Brilliant!Mecislau wrote:Instead of tables, might I recommend something like what I did on this page in the Novegradian grammar?
(Code question: why do you use br tags? Does adding additional dd tags break it?)
Aligning morphemes within the word would be nice, but as Chris says, I'm pretty sure that'd require a good deal of markup to be added to the text. Too much work to do manually, but so long as zompist can add javascript to the page templates, that could work.
Alternatively, Mecislau's system could be implemented pretty easily with some custom bbCode.
-
- Avisaru
- Posts: 275
- Joined: Wed Dec 15, 2004 9:05 am
- Location: Nottingham, England
- Contact:
Re: Better formatting for interlinears on the ZBB
I think it can be done easily by the Javascript solution I proposed, whether that's using tables or definition lists. We apply a simple rule on the board that translations [interlinear] to <span class="interlinear"> then include a small Javascript function that scans through and builds the tables / definition lists afterwards on the client side.Trailsend wrote:Ooooh now see, I tried to do this on the Feayran site but couldn't figure out a good way to make it work--didn't think to use definition lists. Brilliant!Mecislau wrote:Instead of tables, might I recommend something like what I did on this page in the Novegradian grammar?
(Code question: why do you use br tags? Does adding additional dd tags break it?)
Aligning morphemes within the word would be nice, but as Chris says, I'm pretty sure that'd require a good deal of markup to be added to the text. Too much work to do manually, but so long as zompist can add javascript to the page templates, that could work.
Doing it this way also isn't harmful, because if the user for some reason doesn't have javascript enabled, they just get the non-aligned version with a harmless span tag that doesn't really make any difference to formatting.
I think it has to be done this way whether you use tables or definition losts, because otherwise the user has to manually apply a lot of tags to each word/morpheme that will make it too painful to use. Really, the goal has to be that the extent of user intervention required is wrapping their interlinears with [interlinear] and [/interlinear].
That's basically how my home grown blog works, although that's coded up in Haskell on the server side rather than Javascript. See more examples using tables here:
http://chrisdb.dyndns-at-home.com/blog/ ... -agreement
Try the online version of the HaSC sound change applier: http://chrisdb.dyndns-at-home.com/HaSC
Re: Better formatting for interlinears on the ZBB
No, it doesn't. HTML syntax supports several definitions for one item, and the CSS for this type of interlinears does so as well. (I've implemented the same thing as a MediaWiki template for use on both AkanaWiki and FrathWiki, using additional dd tags for additional gloss lines.)Trailsend wrote:Ooooh now see, I tried to do this on the Feayran site but couldn't figure out a good way to make it work--didn't think to use definition lists. Brilliant!Mecislau wrote:Instead of tables, might I recommend something like what I did on this page in the Novegradian grammar?
(Code question: why do you use br tags? Does adding additional dd tags break it?)
Blog: audmanh.wordpress.com
Conlangs: Ronc Tyu | Buruya Nzaysa | Doayâu | Tmaśareʔ
Conlangs: Ronc Tyu | Buruya Nzaysa | Doayâu | Tmaśareʔ
Re: Better formatting for interlinears on the ZBB
Oh, hah, whoops. That was just a silly oversight on my part.cedh audmanh wrote:No, it doesn't. HTML syntax supports several definitions for one item, and the CSS for this type of interlinears does so as well. (I've implemented the same thing as a MediaWiki template for use on both AkanaWiki and FrathWiki, using additional dd tags for additional gloss lines.)Trailsend wrote:Ooooh now see, I tried to do this on the Feayran site but couldn't figure out a good way to make it work--didn't think to use definition lists. Brilliant!Mecislau wrote:Instead of tables, might I recommend something like what I did on this page in the Novegradian grammar?
(Code question: why do you use br tags? Does adding additional dd tags break it?)
And yeah, writing a simple parser in Javascript would not be a problem at all.
http://www.veche.net/
http://www.veche.net/novegradian - Grammar of Novegradian
http://www.veche.net/alashian - Grammar of Alashian
http://www.veche.net/novegradian - Grammar of Novegradian
http://www.veche.net/alashian - Grammar of Alashian