sirdexter
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [Mammoth .docx converter] Exact steps to add custom stylesEverything works fine now. It was the browser caching problem. Thank you.
Forum: Plugins
In reply to: [Mammoth .docx converter] Exact steps to add custom stylesThank you for your help.
I managed to change styles in mammoth-editor.js in mammoth-docx-converter-plugin and it works fine:
"p[style-name='Code'] => pre.wp-block-code > code:separator('\\n')", "p[style-name='Result'] => pre.wp-block-preformatted:separator('\\n')",
But it doesn’t seem to work after I installed the mammoth-options plugin and added both lines there. I installed WordPress on localhost to check it. This is the file:
function MAMMOTH_OPTIONS(mammoth) { var styleMap = [ "p[style-name='Custom Heading 1'] => h1", "p[style-name='Custom Heading 2'] => h2", "r[style-name='Custom Bold'] => strong", "r[style-name='Custom Italic'] => em", "p[style-name='Code Block C'] => pre.language-c:separator('\\n')", "p[style-name='Code Block JavaScript'] => pre.language-javascript:separator('\\n')", "p[style-name='Code Block'] => pre:separator('\\n')", "p[style-name='Code'] => pre.wp-block-code > code:separator('\\n')", "p[style-name='Result'] => pre.wp-block-preformatted:separator('\\n')", ]; function setParagraphStyleNameFromFonts(fonts, styleName, skipStyleNameRegex) { return mammoth.transforms.paragraph(function(paragraph) { var runs = mammoth.transforms.getDescendantsOfType(paragraph, "run"); var isMatch = runs.length > 0 && runs.every(function(run) { return run.font && fonts.indexOf(run.font.toLowerCase()) !== -1; }); if (isMatch && !skipStyleNameRegex.test(paragraph.styleName)) { return {...paragraaph, styleName: styleName}; } else { return paragraph; } }); } return { styleMap: styleMap, // If a paragraph is entirely made up of runs that use monospace fonts, // update the paragraph to use the style "Code Block" if it doesn't // already have a "Code Block" style. transformDocument: setParagraphStyleNameFromFonts( ["consolas", "courier", "courier new"], "Code Block", /^Code Block/i ) }; }
Shouldn’t it work the same as before?
- This reply was modified 2 years, 4 months ago by sirdexter.
Forum: Reviews
In reply to: [Author Bio Box] Destroyed my redirectsI changed it to 5 stars for your quick professional answer. But take a look at why it happened. I have my main domain without redirection for a few months before I noticed, so it could have affected my rankings.
Regards,
Tomasz
Viewing 3 replies - 1 through 3 (of 3 total)