-
Notifications
You must be signed in to change notification settings - Fork 743
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
Denik CZ translator #1000
Denik CZ translator #1000
Conversation
🎉 Yay! 1000th ticket!! |
Denik CZ.js
Outdated
@@ -0,0 +1,110 @@ | |||
function detectWeb(doc, url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're missing an entire translator info section. Please use Scaffold to create translators, then commit the complete file that Scaffold generates. See the top of this translator for what I'm referring to https://github.com/zotero/translators/blob/master/3news.co.nz.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so, if i want to generate entire file - in Code tab i have only code without top info seciton. So, how i make them in Scaffold?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save in Scaffold, then look in your translator directory for the file. https://www.zotero.org/support/dev/translators#translator_structure
commited new version |
Denik CZ.js
Outdated
"translatorID": "c5b2b25d-5a0f-4e90-b8e7-4be4931a64f5", | ||
"label": "Denik", | ||
"creator": "Jiří Sedláček - Frettie", | ||
"target": "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Target has to be a regexp that matches URL of the target pages. It should be as restrictive as possible, in the form "^https?://<something that matches the domain here>/<possibly more stuff here>"
Denik CZ.js
Outdated
function scrape(doc, url) { | ||
var newArticle = new Zotero.Item('newspaperArticle'); | ||
newArticle.url = url; | ||
newArticle.title = ZU.trimInternal(ZU.xpathText(doc, '//div[@class = "dv3-clanek-left-fix"]/h1')).replace(/^,/, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move ZU.trimInternal(ZU.xpathText(doc, '//div[@class = "dv3-clanek-left-fix"]/h1')).replace(/^,/, "")
to a function (e.g. getTitle(doc)
) and call it from here. Then add a check in detectWeb
that looks something like
```if (getTitle(doc)) return 'newspaperArticle';`
@frettie What is the status here? |
@zuphilip Hi, thank you for reaction. I am looking at my code and i try to complete this - but, denik.cz was redesigned. So it will be ok i hope. |
Okay, thank you. It seems that denik.cz has quite good embedded metadata now, such that we can simplify a lot of things. I will work on this now and will then come back to you @frettie . |
continued in #1508 |
New translator for denik.cz articles, primary for Wikipedia Zotero translators.