1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- // transformer les balises [...] en <div class="..."> si ça correspond aux classes prédéfinies
- if (debug) console.log('start tagToClass');
- (function() {
-
- let baliseWords = [
- 'labeur',
- 'free',
- 'temps',
- 'moment',
- 'pilote',
- 'free_left',
- 'citation',
- 'latour',
- 'latour_nohead',
- 'lampe',
- 'lampe_nohead',
- 'note',
- 'bibliographie',
- 'imgsmall',
- 'imgsmallsmall',
- 'imgsmall_bottom',
- 'fullpage2imgs',
- 'fullpageimage',
- 'tripleimgs',
- 'tripleimgs_bottom',
- 'tripleimgs2',
- 'tripleimgs2_bottom',
- 'bottomimg',
- 'imgfullspreadleft',
- 'imgfullspreadright',
- 'imgfullspreadright_bleedtop',
- 'imgfullspreadright_bleed',
- 'breakbefore',
- 'breakafter',
- `doublepage_bigright`,
- `doublepage_bigleft`,
- `screenshot`,
- ];
-
- let bodyContent = $('#body').html();
-
- bodyContent = bodyContent.replace(/\[([^\/\]]+)\]/g, function(match, word) {
- if (baliseWords.includes(word)) {
- return word === 'note' ? `<span class="${ word }">` : `<div class="${ word }">`;
- } else {
- return match;
- }
- }).replace(/\[\/([^\]]+)\]/g, function(match, word) {
- if (baliseWords.includes(word)) {
- return word === 'note' ? '</span>' : '</div>';
- } else {
- return match;
- }
- });
-
- $('#body').empty().append(bodyContent);
-
- })();
- if (debug) console.log('end tagToClass');
|