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

Denik CZ translator #1000

Closed
wants to merge 4 commits into from
Closed

Denik CZ translator #1000

wants to merge 4 commits into from

Conversation

frettie
Copy link

@frettie frettie commented Jan 12, 2016

New translator for denik.cz articles, primary for Wikipedia Zotero translators.

@aurimasv
Copy link
Contributor

🎉 Yay! 1000th ticket!!

Denik CZ.js Outdated
@@ -0,0 +1,110 @@
function detectWeb(doc, url) {
Copy link
Contributor

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

Copy link
Author

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?

Copy link
Contributor

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

@frettie
Copy link
Author

frettie commented Jan 12, 2016

commited new version

Denik CZ.js Outdated
"translatorID": "c5b2b25d-5a0f-4e90-b8e7-4be4931a64f5",
"label": "Denik",
"creator": "Jiří Sedláček - Frettie",
"target": "",
Copy link
Contributor

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(/^,/, "");
Copy link
Contributor

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';`

@zuphilip zuphilip added the New Translator Pull requests for new translators label Nov 12, 2017
@zuphilip
Copy link
Contributor

zuphilip commented Jan 1, 2018

@frettie What is the status here?

@frettie
Copy link
Author

frettie commented Jan 1, 2018

@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.

@zuphilip
Copy link
Contributor

zuphilip commented Jan 2, 2018

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 .

@zuphilip
Copy link
Contributor

zuphilip commented Jan 2, 2018

continued in #1508

@zuphilip zuphilip closed this Jan 2, 2018
@zuphilip zuphilip removed the waiting label Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Translator Pull requests for new translators
Development

Successfully merging this pull request may close these issues.

None yet

3 participants