Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate Dom\TokenList methods #1968

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions reference/dom/dom/tokenlist/add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ffd2ef754b37526c0b96e94859d57ce06acfbf41 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="dom-tokenlist.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Dom\TokenList::add</refname>
<refpurpose>Ajoute les jetons donnés à la liste</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Dom\\TokenList">
<modifier>public</modifier> <type>void</type><methodname>Dom\TokenList::add</methodname>
<methodparam rep="repeat"><type>string</type><parameter>tokens</parameter></methodparam>
</methodsynopsis>
<simpara>
Ajoute les <parameter>tokens</parameter> donnés à la liste, mais pas ceux
qui étaient déjà présents.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>tokens</parameter></term>
<listitem>
<simpara>
Les jetons à ajouter.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
&return.void;
</simpara>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
&dom.tokenlist.errors;
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example xml:id="dom-tokenlist.add.example.basic">
<title>Exemple de <methodname>Dom\TokenList::add</methodname></title>
<simpara>
Ajoute deux classes à un élément paragraphe nouvellement créé.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
$dom = Dom\HTMLDocument::createEmpty();
$p = $dom->createElement('p');

$classList = $p->classList;
$classList->add('font-bold', 'important');

echo $dom->saveHtml($p);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<p class="font-bold important"></p>
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
93 changes: 93 additions & 0 deletions reference/dom/dom/tokenlist/contains.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ffd2ef754b37526c0b96e94859d57ce06acfbf41 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="dom-tokenlist.contains" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Dom\TokenList::contains</refname>
<refpurpose>Renvoie si la liste contient un jeton donné</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Dom\\TokenList">
<modifier>public</modifier> <type>bool</type><methodname>Dom\TokenList::contains</methodname>
<methodparam><type>string</type><parameter>token</parameter></methodparam>
</methodsynopsis>
<simpara>
Renvoie si la liste contient <parameter>token</parameter>.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>token</parameter></term>
<listitem>
<simpara>
Le jeton.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Renvoie &true; si la liste contient <parameter>token</parameter>,
sinon &false;.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example xml:id="dom-tokenlist.contains.example.basic">
<title>Exemple de <methodname>Dom\TokenList::contains</methodname></title>
<simpara>
Vérifie si deux classes sont présentes sur le paragraphe.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
$dom = Dom\HTMLDocument::createFromString('<p class="font-bold important"></p>', LIBXML_NOERROR);
$p = $dom->body->firstChild;

$classList = $p->classList;
var_dump(
$classList->contains('important'),
$classList->contains('font-small'),
);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(false)
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
52 changes: 52 additions & 0 deletions reference/dom/dom/tokenlist/count.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ffd2ef754b37526c0b96e94859d57ce06acfbf41 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="dom-tokenlist.count" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Dom\TokenList::count</refname>
<refpurpose>Renvoie le nombre de jetons dans la liste</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Dom\\TokenList">
<modifier>public</modifier> <type>int</type><methodname>Dom\TokenList::count</methodname>
<void/>
</methodsynopsis>
<simpara>
Renvoie le nombre de jetons dans la liste.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Le nombre de jetons dans la liste.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
52 changes: 52 additions & 0 deletions reference/dom/dom/tokenlist/getiterator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ffd2ef754b37526c0b96e94859d57ce06acfbf41 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="dom-tokenlist.getiterator" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Dom\TokenList::getIterator</refname>
<refpurpose>Renvoie un itérateur sur la liste de jetons</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Dom\\TokenList">
<modifier>public</modifier> <type>Iterator</type><methodname>Dom\TokenList::getIterator</methodname>
<void/>
</methodsynopsis>
<simpara>
Renvoie un itérateur sur la liste de jetons.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Un itérateur sur la liste de jetons.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
102 changes: 102 additions & 0 deletions reference/dom/dom/tokenlist/item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ffd2ef754b37526c0b96e94859d57ce06acfbf41 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="dom-tokenlist.item" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Dom\TokenList::item</refname>
<refpurpose>Renvoie un jeton de la liste</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Dom\\TokenList">
<modifier>public</modifier> <type class="union"><type>string</type><type>null</type></type><methodname>Dom\TokenList::item</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
</methodsynopsis>
<simpara>
Renvoie un jeton de la liste à l'<parameter>index</parameter>.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>index</parameter></term>
<listitem>
<simpara>
L'index du jeton.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Renvoie le jeton à l'<parameter>index</parameter> ou &null; lorsque l'index
est hors limites.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example xml:id="dom-tokenlist.item.example.basic">
<title>Exemple de <methodname>Dom\TokenList::item</methodname></title>
<simpara>
Accède à un index valide et un index invalide.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
$dom = Dom\HTMLDocument::createFromString('<p class="font-bold important"></p>', LIBXML_NOERROR);
$p = $dom->body->firstChild;

$classList = $p->classList;
var_dump(
$classList->item(0),
$classList->item(100),
);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(9) "font-bold"
NULL
]]>
</screen>
</example>
</refsect1>

<refsect1 role="notes">
&reftitle.notes;
<note>
<simpara>
Cette méthode est équivalente à l'utilisation de la syntaxe d'accès aux tableaux.
</simpara>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Loading