I do not know if Javascript is better, PHP, or even the sublime text, but,
I copied the cf text and pasted it into a txt (to get rid of those strange tags)
Then in the sublime text, I:
- I selected everything crt + to
- alt + shift + w to insert html tags on each line
- I type
li
, hence already creates the opening and closing tags for each line
Then I ask you to select everything:
</li>
<li>TÍTULO
and replace with:
</li>
</ul>
<ul id="titulo" class="titulo">
<li>TÍTULO
And then, I repeated this phase for each subsection: titulo>capítulo>seção>subseção>artigo
I got this result: cf_passo_1.txt
I would like the algorithm to search every ul
and assign the value of id
according to the content of each ul
.
For example, it looks like this:
<ul id="titulo" class="titulo">
<li>
TÍTULO I ...
<ul id="artigo" class="artigo">
<li>
Art. 1º A ...
I would like it to look like this:
<ul id="titulo1" class="titulo">
<li>
TÍTULO I ...
<ul id="artigo1" class="artigo">
<li>
Art. 1º A ...