Textpattern Forum

You are not logged in. Register | Login | Help

#1 2009-04-23 09:33:42

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Simple tables in TxP (Ctrl+C, Ctrl+V)

Version 0.2 download link / homepage

Summary

Insert a table in TxP article is very simple! Select in Excel, IE, Mozilla, FireFox, Opera any spreadsheet, Ctrl + C (copy) and Ctrl + V (paste) in TxP Edit area. Add aks_table tags – that’s all.

Note: plugin support only simple table. (rowspan and colspan – unsupported).

.

See Example

Last edited by makss (2009-11-18 21:53:24)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

#2 2009-04-23 11:05:47

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 685
Website

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Nice idea, may come handy in some cases… I’ll give it a try, thanks!

Offline

#3 2009-04-23 11:17:19

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,140
Website

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Really awsome job, i have asked for that before, cause it s really anoying to insert big table manually, even if i use a text editor to convert tab to |, the plugin is much easier to explain the manner to insert table into textpattern.

Offline

#4 2009-04-23 15:34:18

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Very useful, thanks!!!

Offline

#5 2009-10-24 17:26:26

Ldx
Member
Registered: 2009-10-24
Posts: 15

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Hi makss, thank you for your simple and very useful plugin.

I’m having some troubles with (X)HTML validation of the generated code: the generated table is wrapped in a “@<p>@” tag and that’s not valid “XHTML 1.0 Transitional”. In fact, validator.w3.org says something like:

document type does not allow element "table" here; missing one of
"object", "applet", "map", "iframe", "button", "ins", "del" start-tag

	<p><table class="classname"><tr><td>(content)</td> ...

(...)

One possible cause for this message is that you have attempted to put a block-level element
(such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

In fact you can see the <p> tag prefixed to the <table> tag.

I am quite new to TXP and plugins, but anyway I tried to modify your plugin by returning on the last line something like:

return doTag($out, "table", $className);

But it still outputs the “p” tag wrapping the “table” tag. Probably I am not enough good with TxP and its plugins… :-)

The only solution I found so far is to start the <mks_table> line with a blank space, so preventing the generation of the “p” tag, but this is quite unelegant and prone to be forgotten, especially when others have to write and manage the articles with tables.

Do you think I am doing something wrong or maybe the plugin can be improved this way?

Kind regards
Aldo

Last edited by Ldx (2009-10-24 17:28:50)

Offline

#6 2009-10-24 18:44:35

Gocom
Developer
Registered: 2006-07-14
Posts: 4,476
Website

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Ldx wrote:

Do you think I am doing something wrong or maybe the plugin can be improved this way?

It’s intended behaviour. Textile, that is used inside articles, automatically wraps new paragraphs inside paragraps, if not told to otherwise (like for example starting the line with whitespace or using notextile.).


Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

#7 2009-10-24 18:49:08

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Gocom wrote:

(like for example starting the line with whitespace or using notextile.).

Or turn Textile off for that article (under Advanced options).


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#8 2009-10-24 19:04:17

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,093

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Or, more generally solved, wrap <txp:body /> with Gocom’s excellent rah_replace:

<txp:rah_replace from="<p><table>,</table></p>" to="<table>,</table>">
	<txp:body />
</txp:rah_replace>

makss, like Aldo/Ldx says, thinking of the space is a little error prone as is remembering putting the aks_table tags around each article. If the aks_table tags needed to be put in the article form authors could post more careless. Is it possible to reorganize the code a little to achieve this?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Online

#9 2009-10-31 22:16:57

Ldx
Member
Registered: 2009-10-24
Posts: 15

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

Thank you all for the answers. As far as I understood, the plugin cannot be responsible for the “p” tag that is put in place by Textile.
The “rah_replace” plugin is interesting (thanks uli!), but I am wondering if using such a plugin on a quite loaded server can slow down performances, since it has to scan all HTML code of each page served.

Offline

#10 2009-11-18 09:53:25

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: aks_table : Simple tables in TxP (Ctrl+C, Ctrl+V)

uli wrote:

makss, like Aldo/Ldx says, thinking of the space is a little error prone as is remembering putting the aks_table tags around each article. If the aks_table tags needed to be put in the article form authors could post more careless. Is it possible to reorganize the code a little to achieve this?

+1 for this if it’s possible.

The type of client I would find this plugin most useful for isn’t the type of client I’d trust to wrap the txp tags correctly. I’m thinking – if you could apply the aks_table magic pre-output rather than on save it could be used with a glz_custom_fields textarea specified for tabular data, which would mean you’d be able to wrap the aks_table tags only where needed in your article logic.

I suspect that it would need a fairly major overhaul to work this way, but for me it would drastically increase the usability of this plugin.

Offline

Board footer

Powered by FluxBB