Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to use Zotero rename rule for naming files #202

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions content/mdnotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,12 @@ function noteToMarkdown(item) {
* Get an item's base file name from setting's preferences
*/
function getFileName(item) {
let citekeyTitle = getPref("citekey_title");
let basenameFormat = getPref("files.basename");

if (citekeyTitle) {
if (basenameFormat === "citekey") {
return getCiteKey(item);
} else if (basenameFormat === "zotero") {
return Zotero.Attachments.getFileBaseNameFromItem(item);
} else {
if (getPref("link_style") === "wiki") {
return sanitizeFilename(item.getField("title"));
Expand Down
12 changes: 11 additions & 1 deletion content/options.xul
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<preference id="pref-mdnotes-templates-directory" name="extensions.mdnotes.templates.directory" type="string" />
<preference id="pref-mdnotes-templates-empty-placeholders" name="extensions.mdnotes.templates.include_empty_placeholders" type="bool" />

<preference id="pref-mdnotes-files-basename" name="extensions.mdnotes.files.basename" type="string" />
<preference id="pref-mdnotes-file-conf" name="extensions.mdnotes.file_conf" type="string" />
<preference id="pref-mdnotes-standalone-menu" name="extensions.mdnotes.standalone_menu" type="bool" />
<preference id="pref-mdnotes-files-zotero-metadata-prefix" name="extensions.mdnotes.files.zotero.metadata.prefix" type="string" />
Expand All @@ -40,7 +41,6 @@
<tabpanel>
<!-- General export settings -->
<vbox>
<checkbox id="id-mdnotes-citekey-title" preference="pref-mdnotes-citekey-title" label="&citekey-title;" />
<checkbox id="id-mdnotes-standalone-menu" preference="pref-mdnotes-standalone-menu" label="&pref-standalone-menu;" />
<separator />
<radiogroup id="id-mdnotes-file-group" preference="pref-mdnotes-file-conf">
Expand Down Expand Up @@ -97,6 +97,16 @@
<tabpanel>
<vbox>
<!-- Mdnotes files -->
<radiogroup id="id-mdnotes-basename-group" preference="pref-mdnotes-files-basename">
<caption label="&basename-files;" />
<description style="font-size: 10px"> &basename-files-description; </description>
<hbox>
<radio id="basename-citekey" label="Item citekey" value="citekey" />
<radio id="basename-title" label="Item title" value="title" />
<radio id="basename-zotero" label="Use Zotero rename rule" value="zotero" />
</hbox>
</radiogroup>
<separator />
<groupbox>
<caption label="&mdnotes-files;"/>
<hbox align="center">
Expand Down
3 changes: 2 additions & 1 deletion locale/en-US/mdnotes.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<!-- First tab -->
<!ENTITY mdnotes-export "Export preferences">
<!ENTITY citekey-title "Use the item's citekey as title?">
<!ENTITY pref-standalone-menu "Show Standalone Note menu">
<!ENTITY mdnotes-file-number-label "File organization:">
<!ENTITY mdnotes-file-number-description "Exporting notes as a single file or in multiple files">
Expand All @@ -20,6 +19,8 @@
<!-- Second tab -->
<!ENTITY file-names "File names">

<!ENTITY basename-files "File name format">
<!ENTITY basename-files-description "Choose format of the base file name. Prefixes and suffixes set below will be added to this base name.">
<!ENTITY mdnotes-files "Mdnotes">
<!ENTITY standalone-files "Standalone">
<!ENTITY zotero-metadata-files "Zotero metadata">
Expand Down