Skip to content

Commit 266323b

Browse files
authored
Merge pull request #1916 from yosmoc/configuable_plantuml_server
Configurable plantuml server
2 parents 60707a8 + a26ff66 commit 266323b

File tree

17 files changed

+32
-1
lines changed

17 files changed

+32
-1
lines changed

browser/lib/markdown.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,13 @@ class Markdown {
145145
const deflate = require('markdown-it-plantuml/lib/deflate')
146146
this.md.use(require('markdown-it-plantuml'), '', {
147147
generateSource: function (umlCode) {
148+
const stripTrailingSlash = (url) => url.endsWith('/') ? url.slice(0, -1) : url
149+
const serverAddress = stripTrailingSlash(config.preview.plantUMLServerAddress) + '/svg'
148150
const s = unescape(encodeURIComponent(umlCode))
149151
const zippedCode = deflate.encode64(
150152
deflate.zip_deflate(`@startuml\n${s}\n@enduml`, 9)
151153
)
152-
return `http://www.plantuml.com/plantuml/svg/${zippedCode}`
154+
return `${serverAddress}/${zippedCode}`
153155
}
154156
})
155157

browser/main/lib/ConfigManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const DEFAULT_CONFIG = {
5353
latexInlineClose: '$',
5454
latexBlockOpen: '$$',
5555
latexBlockClose: '$$',
56+
plantUMLServerAddress: 'http://www.plantuml.com/plantuml',
5657
scrollPastEnd: false,
5758
smartQuotes: true,
5859
sanitize: 'STRICT' // 'STRICT', 'ALLOW_STYLES', 'NONE'

browser/main/modals/PreferencesModal/UiTab.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class UiTab extends React.Component {
9494
latexInlineClose: this.refs.previewLatexInlineClose.value,
9595
latexBlockOpen: this.refs.previewLatexBlockOpen.value,
9696
latexBlockClose: this.refs.previewLatexBlockClose.value,
97+
plantUMLServerAddress: this.refs.previewPlantUMLServerAddress.value,
9798
scrollPastEnd: this.refs.previewScrollPastEnd.checked,
9899
smartQuotes: this.refs.previewSmartQuotes.checked,
99100
sanitize: this.refs.previewSanitize.value
@@ -544,6 +545,19 @@ class UiTab extends React.Component {
544545
/>
545546
</div>
546547
</div>
548+
<div styleName='group-section'>
549+
<div styleName='group-section-label'>
550+
{i18n.__('PlantUML Server')}
551+
</div>
552+
<div styleName='group-section-control'>
553+
<input styleName='group-section-control-input'
554+
ref='previewPlantUMLServerAddress'
555+
value={config.preview.plantUMLServerAddress}
556+
onChange={(e) => this.handleUIChange(e)}
557+
type='text'
558+
/>
559+
</div>
560+
</div>
547561

548562
<div styleName='group-control'>
549563
<button styleName='group-control-rightButton'

locales/da.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"LaTeX Inline Close Delimiter": "LaTeX Inline Close Delimiter",
6363
"LaTeX Block Open Delimiter": "LaTeX Block Open Delimiter",
6464
"LaTeX Block Close Delimiter": "LaTeX Block Close Delimiter",
65+
"PlantUML Server": "PlantUML Server",
6566
"Community": "Community",
6667
"Subscribe to Newsletter": "Subscribe to Newsletter",
6768
"GitHub": "GitHub",

locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"LaTeX Inline Close Delimiter": "LaTeX Inline Ende Kennzeichen",
6363
"LaTeX Block Open Delimiter": "LaTeX Block Beginn Kennzeichen",
6464
"LaTeX Block Close Delimiter": "LaTeX Block Ende Kennzeichen",
65+
"PlantUML Server": "PlantUML Server",
6566
"Community": "Community",
6667
"Subscribe to Newsletter": "Newsletter abonnieren",
6768
"GitHub": "GitHub",

locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"LaTeX Inline Close Delimiter": "LaTeX Inline Close Delimiter",
6363
"LaTeX Block Open Delimiter": "LaTeX Block Open Delimiter",
6464
"LaTeX Block Close Delimiter": "LaTeX Block Close Delimiter",
65+
"PlantUML Server": "PlantUML Server",
6566
"Community": "Community",
6667
"Subscribe to Newsletter": "Subscribe to Newsletter",
6768
"GitHub": "GitHub",

locales/es-ES.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"LaTeX Inline Close Delimiter": "Delimitador de cierre LaTeX en línea",
6363
"LaTeX Block Open Delimiter": "Delimitado de apertura bloque LaTeX",
6464
"LaTeX Block Close Delimiter": "Delimitador de cierre bloque LaTeX",
65+
"PlantUML Server": "PlantUML Server",
6566
"Community": "Comunidad",
6667
"Subscribe to Newsletter": "Suscribirse al boletín",
6768
"GitHub": "GitHub",

locales/fa.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"LaTeX Inline Close Delimiter": "جداکننده پایانی لاتکس خطی",
6363
"LaTeX Block Open Delimiter": "جداکننده آغازین بلوک لاتکس ",
6464
"LaTeX Block Close Delimiter": "جداکننده آغازین بلوک لاتکس ",
65+
"PlantUML Server": "PlantUML Server",
6566
"Community": "کامینیتی",
6667
"Subscribe to Newsletter": "اشتراک در خبرنامه",
6768
"GitHub": "گیت هاب",

locales/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"LaTeX Inline Close Delimiter": "LaTeX Inline Close Delimiter",
6262
"LaTeX Block Open Delimiter": "LaTeX Block Open Delimiter",
6363
"LaTeX Block Close Delimiter": "LaTeX Block Close Delimiter",
64+
"PlantUML Server": "PlantUML Server",
6465
"Community": "Communauté",
6566
"Subscribe to Newsletter": "Souscrire à la newsletter",
6667
"GitHub": "GitHub",

locales/hu.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"LaTeX Inline Close Delimiter": "LaTeX Inline Záró Határolója",
6363
"LaTeX Block Open Delimiter": "LaTeX Blokk Nyitó Határolója",
6464
"LaTeX Block Close Delimiter": "LaTeX Blokk Záró Határolója",
65+
"PlantUML Server": "PlantUML Server",
6566
"Community": "Közösség",
6667
"Subscribe to Newsletter": "Feliratkozás a Hírlevélre",
6768
"GitHub": "GitHub",

0 commit comments

Comments
 (0)