mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
export: support %4 for code block css style url
This commit is contained in:
parent
8f24d38bf8
commit
b355872c5f
@ -528,14 +528,14 @@ void VExportDialog::startExport()
|
|||||||
QString outputFolder = QDir::cleanPath(QDir(getOutputDirectory()).absolutePath());
|
QString outputFolder = QDir::cleanPath(QDir(getOutputDirectory()).absolutePath());
|
||||||
|
|
||||||
QString renderStyle = m_renderStyleCB->currentData().toString();
|
QString renderStyle = m_renderStyleCB->currentData().toString();
|
||||||
QString cssUrl = g_config->getCssStyleUrl(renderStyle);
|
QString renderCodeBlockStyle = m_renderCodeBlockStyleCB->currentData().toString();
|
||||||
|
|
||||||
s_opt = ExportOption(currentSource(),
|
s_opt = ExportOption(currentSource(),
|
||||||
currentFormat(),
|
currentFormat(),
|
||||||
(MarkdownConverterType)m_rendererCB->currentData().toInt(),
|
(MarkdownConverterType)m_rendererCB->currentData().toInt(),
|
||||||
m_renderBgCB->currentData().toString(),
|
m_renderBgCB->currentData().toString(),
|
||||||
renderStyle,
|
renderStyle,
|
||||||
m_renderCodeBlockStyleCB->currentData().toString(),
|
renderCodeBlockStyle,
|
||||||
m_subfolderCB->isChecked(),
|
m_subfolderCB->isChecked(),
|
||||||
ExportPDFOption(&m_pageLayout,
|
ExportPDFOption(&m_pageLayout,
|
||||||
m_wkhtmltopdfCB->isChecked(),
|
m_wkhtmltopdfCB->isChecked(),
|
||||||
@ -555,7 +555,8 @@ void VExportDialog::startExport()
|
|||||||
m_customSrcFormatCB->currentData().toInt(),
|
m_customSrcFormatCB->currentData().toInt(),
|
||||||
m_customSuffixEdit->text(),
|
m_customSuffixEdit->text(),
|
||||||
m_customCmdEdit->toPlainText(),
|
m_customCmdEdit->toPlainText(),
|
||||||
cssUrl,
|
g_config->getCssStyleUrl(renderStyle),
|
||||||
|
g_config->getCodeBlockCssStyleUrl(renderCodeBlockStyle),
|
||||||
m_customAllInOneCB->isChecked(),
|
m_customAllInOneCB->isChecked(),
|
||||||
m_customFolderSepEdit->text(),
|
m_customFolderSepEdit->text(),
|
||||||
m_customTargetFileNameEdit->text()));
|
m_customTargetFileNameEdit->text()));
|
||||||
@ -1304,7 +1305,8 @@ QWidget *VExportDialog::setupCustomAdvancedSettings()
|
|||||||
QLabel *tipsLabel = new QLabel(tr("<span><span style=\"font-weight:bold;\">%0</span> for the input file; "
|
QLabel *tipsLabel = new QLabel(tr("<span><span style=\"font-weight:bold;\">%0</span> for the input file; "
|
||||||
"<span style=\"font-weight:bold;\">%1</span> for the output file; "
|
"<span style=\"font-weight:bold;\">%1</span> for the output file; "
|
||||||
"<span style=\"font-weight:bold;\">%2</span> for the rendering CSS style file; "
|
"<span style=\"font-weight:bold;\">%2</span> for the rendering CSS style file; "
|
||||||
"<span style=\"font-weight:bold;\">%3</span> for the input file directory.</span>"),
|
"<span style=\"font-weight:bold;\">%3</span> for the input file directory; "
|
||||||
|
"<span style=\"font-weight:bold;\">%4</span> for the rendering code block CSS style file.</span>"),
|
||||||
this);
|
this);
|
||||||
tipsLabel->setWordWrap(true);
|
tipsLabel->setWordWrap(true);
|
||||||
|
|
||||||
@ -1336,7 +1338,7 @@ QWidget *VExportDialog::setupCustomAdvancedSettings()
|
|||||||
// Cmd edit.
|
// Cmd edit.
|
||||||
m_customCmdEdit = new QPlainTextEdit(this);
|
m_customCmdEdit = new QPlainTextEdit(this);
|
||||||
m_customCmdEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
m_customCmdEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||||
QString cmdExamp("pandoc --resource-path=.:\"%3\" --css=\"%2\" -s -o \"%1\" \"%0\"");
|
QString cmdExamp("pandoc --resource-path=.:\"%3\" --css=\"%2\" --css=\"%4\" -s -o \"%1\" \"%0\"");
|
||||||
m_customCmdEdit->setPlaceholderText(cmdExamp);
|
m_customCmdEdit->setPlaceholderText(cmdExamp);
|
||||||
m_customCmdEdit->setToolTip(tr("Custom command to be executed"));
|
m_customCmdEdit->setToolTip(tr("Custom command to be executed"));
|
||||||
m_customCmdEdit->setProperty("LineEdit", true);
|
m_customCmdEdit->setProperty("LineEdit", true);
|
||||||
|
@ -167,12 +167,14 @@ struct ExportCustomOption
|
|||||||
const QString &p_outputSuffix,
|
const QString &p_outputSuffix,
|
||||||
const QString &p_cmd,
|
const QString &p_cmd,
|
||||||
const QString &p_cssUrl,
|
const QString &p_cssUrl,
|
||||||
|
const QString &p_codeBlockCssUrl,
|
||||||
bool p_allInOne,
|
bool p_allInOne,
|
||||||
const QString &p_folderSep,
|
const QString &p_folderSep,
|
||||||
const QString &p_targetFileName)
|
const QString &p_targetFileName)
|
||||||
: m_srcFormat(p_srcFormat),
|
: m_srcFormat(p_srcFormat),
|
||||||
m_outputSuffix(p_outputSuffix),
|
m_outputSuffix(p_outputSuffix),
|
||||||
m_cssUrl(p_cssUrl),
|
m_cssUrl(p_cssUrl),
|
||||||
|
m_codeBlockCssUrl(p_codeBlockCssUrl),
|
||||||
m_allInOne(p_allInOne),
|
m_allInOne(p_allInOne),
|
||||||
m_folderSep(p_folderSep),
|
m_folderSep(p_folderSep),
|
||||||
m_targetFileName(p_targetFileName)
|
m_targetFileName(p_targetFileName)
|
||||||
@ -198,6 +200,8 @@ struct ExportCustomOption
|
|||||||
QString m_cmd;
|
QString m_cmd;
|
||||||
|
|
||||||
QString m_cssUrl;
|
QString m_cssUrl;
|
||||||
|
QString m_codeBlockCssUrl;
|
||||||
|
|
||||||
bool m_allInOne;
|
bool m_allInOne;
|
||||||
|
|
||||||
QString m_folderSep;
|
QString m_folderSep;
|
||||||
|
@ -174,13 +174,12 @@ static QString evaluateCommand(const ExportCustomOption &p_opt,
|
|||||||
const QString &p_inputFolder,
|
const QString &p_inputFolder,
|
||||||
const QString &p_output)
|
const QString &p_output)
|
||||||
{
|
{
|
||||||
QString cssStyle = QDir::toNativeSeparators(p_opt.m_cssUrl);
|
|
||||||
|
|
||||||
QString cmd(p_opt.m_cmd);
|
QString cmd(p_opt.m_cmd);
|
||||||
replaceArgument(cmd, "%0", p_input);
|
replaceArgument(cmd, "%0", p_input);
|
||||||
replaceArgument(cmd, "%1", p_output);
|
replaceArgument(cmd, "%1", p_output);
|
||||||
replaceArgument(cmd, "%2", cssStyle);
|
replaceArgument(cmd, "%2", QDir::toNativeSeparators(p_opt.m_cssUrl));
|
||||||
replaceArgument(cmd, "%3", p_inputFolder);
|
replaceArgument(cmd, "%3", p_inputFolder);
|
||||||
|
replaceArgument(cmd, "%4", QDir::toNativeSeparators(p_opt.m_codeBlockCssUrl));
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user