Download
Magazine
Develop
Account
Download
Magazine
Develop
Login
Forgot Account/Password
Create Account
Language
Help
Language
Help
×
Login
Login Name
Password
×
Forgot Account/Password
Category:
Software
People
PersonalForge
Magazine
Wiki
Search
OSDN
>
Find Software
>
Internet
>
WWW/HTTP
>
Dynamic Content
>
CGI Tools/Libraries
>
PCサイト->携帯変換
>
Forums
>
Open Discussion
>
pc2m_remainを使ってもdiv内のinline style属性が消える
PCサイト->携帯変換
Description
Project Summary
Developer Dashboard
Web Page
Developers
Image Gallery
List of RSS Feeds
Activity
Statistics
History
Downloads
List of Releases
Stats
Ticket
Ticket List
Milestone List
Type List
Component List
List of frequently used tickets/RSS
Submit New Ticket
Documents
Communication
List of Forums
Open Discussion (166)
News
Forums:
Open Discussion
(Thread #19941)
Return to Thread list
RSS
pc2m_remainを使ってもdiv内のinline style属性が消える (2008-09-17 17:50 by
Anonymous
#38889)
Reply
Create ticket
<div style="background:red" align="center"> のようなインラインのstyle属性をそのまま出力したくて、pc2m_remain で囲んでも、style="" が削除されて以下の出力されます。
<div align="center">
pc2m.phpのソースを少し見てみました。2000行あたりの以下の時点で既にstyle=""は削られています。
if (preg_match_all('/<!--pc2m_remain-->(.+?)<!--\/pc2m_remain-->/si', $_content, $matches)) {
そこからはどう追えばいいのかがわかりませんでした。
アドバイス等頂けますでしょうか?
Reply to #38889
×
Subject
Body
Reply To Message #38889 > <div style="background:red" align="center"> のようなインラインのstyle属性をそのまま出力したくて、pc2m_remain で囲んでも、style="" が削除されて以下の出力されます。 > <div align="center"> > > pc2m.phpのソースを少し見てみました。2000行あたりの以下の時点で既にstyle=""は削られています。 > > if (preg_match_all('/<!--pc2m_remain-->(.+?)<!--\/pc2m_remain-->/si', $_content, $matches)) { > > そこからはどう追えばいいのかがわかりませんでした。 > アドバイス等頂けますでしょうか?
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
RE: pc2m_remainを使ってもdiv内のinline style属性が消える (2008-09-19 23:02 by
ucb
#38931)
Reply
Create ticket
HTMLの整形処理(そのしばらく前の $parser->parse($_content); となってる箇所あたり)でSTYLE属性は消え失せます。整形処理のルールファイル(FormatRule.inc.php)にそう書いてるので。
■対処1:STYLE属性を残すようにルールファイルを書き直す。
FormatRule.inc.phpはPC2M専用で、多くの要素と属性を削除してしまうようになってますが、以下からダウンロードできるオリジナルのHTMLParserクラスのアーカイブに入ってるサンプルのルールファイル(xhtml1-transitional_dtd.inc.php)はXHTML 1.0の要素と属性を網羅してるので、両者を参照しながら書き直していただければよいかと。
http://www.rcdtokyo.com/ucb/contents/i000799.php
まあ、必要な要素(divだけですかね?)の「attributes」配列に'style'を加えてやればいいだけの筈なんですけど。
■対処2:「~remain」の保存が整形処理の前になるようにpc2m.phpを書き直す(結構面倒だと思うので推奨しません)
覚えてないんですけど(笑)、たぶんinvalidなHTMLが~remainで括られてるとあとあと面倒なので先に整形処理を済ませちゃってると思うので、そうでなければ支障はないと思うんですよねー。
Reply to
#38889
Reply to #38931
×
Subject
Body
Reply To Message #38931 > HTMLの整形処理(そのしばらく前の $parser->parse($_content); となってる箇所あたり)でSTYLE属性は消え失せます。整形処理のルールファイル(FormatRule.inc.php)にそう書いてるので。 > > ■対処1:STYLE属性を残すようにルールファイルを書き直す。 > > FormatRule.inc.phpはPC2M専用で、多くの要素と属性を削除してしまうようになってますが、以下からダウンロードできるオリジナルのHTMLParserクラスのアーカイブに入ってるサンプルのルールファイル(xhtml1-transitional_dtd.inc.php)はXHTML 1.0の要素と属性を網羅してるので、両者を参照しながら書き直していただければよいかと。 > http://www.rcdtokyo.com/ucb/contents/i000799.php > > まあ、必要な要素(divだけですかね?)の「attributes」配列に'style'を加えてやればいいだけの筈なんですけど。 > > ■対処2:「~remain」の保存が整形処理の前になるようにpc2m.phpを書き直す(結構面倒だと思うので推奨しません) > > 覚えてないんですけど(笑)、たぶんinvalidなHTMLが~remainで括られてるとあとあと面倒なので先に整形処理を済ませちゃってると思うので、そうでなければ支障はないと思うんですよねー。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
RE: pc2m_remainを使ってもdiv内のinline style属性が消える (2008-09-20 09:19 by
Anonymous
#38942)
Reply
Create ticket
FormatRule.inc.php 18行目あたりを以下のように変更しても style属性は消えてしまいます。
'div' => array(
'type' => 'block',
'children' => array('#PCDATA', 'br'),
// 'attributes' => array(),
'attributes' => array('style'),
),
もうちょっと調べてみます。
Reply to
#38889
Reply to #38942
×
Subject
Body
Reply To Message #38942 > FormatRule.inc.php 18行目あたりを以下のように変更しても style属性は消えてしまいます。 > > 'div' => array( > 'type' => 'block', > 'children' => array('#PCDATA', 'br'), > // 'attributes' => array(), > 'attributes' => array('style'), > ), > > もうちょっと調べてみます。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
RE: pc2m_remainを使ってもdiv内のinline style属性が消える (2008-09-22 20:13 by
ucb
#38968)
Reply
Create ticket
それはFormatRule.inc.phpではなく、FormatRule_Text.inc.phpですね(こっちは「写」モード用で、一部を除く全てのタグと属性を削ぎ落とす設定)
FormatRule.inc.phpの、たぶん41行目あたり
'div' => array(
'type' => 'block',
'children' => array('#PCDATA', 'p', ~略
'attributes' => array('align')
),
のattributesのところを
'attributes' => array('align', 'style')
とすれば良い筈です。
Reply to
#38942
Reply to #38968
×
Subject
Body
Reply To Message #38968 > それはFormatRule.inc.phpではなく、FormatRule_Text.inc.phpですね(こっちは「写」モード用で、一部を除く全てのタグと属性を削ぎ落とす設定) > > FormatRule.inc.phpの、たぶん41行目あたり > > 'div' => array( > 'type' => 'block', > 'children' => array('#PCDATA', 'p', ~略 > 'attributes' => array('align') > ), > > のattributesのところを > > 'attributes' => array('align', 'style') > > とすれば良い筈です。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
[]RE: pc2m_remainを使ってもdiv内のinline style属性が消える (2008-09-23 17:34 by
Anonymous
#38979)
Reply
Create ticket
できました。
単純なミスですみませんでした。
Reply to
#38889
Reply to #38979
×
Subject
Body
Reply To Message #38979 > できました。 > 単純なミスですみませんでした。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel